Fix bug unable to fit ukui light theme

This commit is contained in:
chenlelin 2020-10-11 15:02:18 +08:00
parent b49bea1e06
commit 890c97d2f4
18 changed files with 387 additions and 207 deletions

1
debian/control vendored
View File

@ -14,6 +14,7 @@ Build-Depends: debhelper-compat (= 12),
libgsettings-qt-dev,
libkf5windowsystem-dev,
libx11-dev,
libqt5svg5-dev,
Standards-Version: 4.5.0
Rules-Requires-Root: no
Homepage: https://github.com/ukui/kylin-nm

View File

@ -4,7 +4,7 @@
#
#-------------------------------------------------
QT += core gui x11extras dbus KWindowSystem
QT += core gui x11extras dbus KWindowSystem svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

View File

@ -78,5 +78,6 @@
<file>res/s/conning-s/11.png</file>
<file>res/s/conning-s/12.png</file>
<file>res/x/setup.png</file>
<file>res/x/control.svg</file>
</qresource>
</RCC>

15
res/x/control.svg Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 19 19" style="enable-background:new 0 0 19 19;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<title>画板 1</title>
<path class="st0" d="M9.5,6.2c1.9,0,3.3,1.4,3.3,3.3s-1.4,3.3-3.3,3.3s-3.3-1.4-3.3-3.3S7.6,6.2,9.5,6.2 M9.5,5.7
c-2.1,0-3.8,1.7-3.8,3.8s1.7,3.8,3.8,3.8s3.8-1.7,3.8-3.8S11.6,5.7,9.5,5.7z"/>
<path class="st0" d="M17,8.1c-0.2-1.1-0.5-2-1.2-2.9L17,4.1l-2-2l-1.3,1.2c-0.8-0.5-1.8-1-2.9-1.2V0.5H8.1V2c-1.1,0.3-2,0.6-2.9,1.3
L4.1,2.1l-2,2l1.2,1.2c-0.5,0.8-1,1.8-1.2,2.9H0.5V11H2c0.2,1.1,0.5,2,1.2,2.9L2,15l2,2l1.3-1.2c0.8,0.5,1.8,1,2.9,1.2v1.5H11V17
c1.1-0.2,2-0.5,2.9-1.2L15,17l2-2l-1.2-1.3c0.5-0.8,1-1.8,1.2-2.9h1.5V8.1H17z M9.5,16.2c-3.7,0-6.7-3-6.7-6.7s3-6.7,6.7-6.7
s6.7,3,6.7,6.7S13.2,16.2,9.5,16.2z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -48,13 +48,13 @@ ConfForm::ConfForm(QWidget *parent) :
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
this->setStyleSheet("QWidget{border-radius:6px;border:none;}");
KylinDBus mkylindbus;
double trans = mkylindbus.getTransparentData();
QString strTrans;
strTrans = QString::number(trans, 10, 2);
QString sty = "#centralWidget{border:1px solid rgba(255,255,255,0.05);border-radius:6px;background:rgba(19,19,20," + strTrans + ");}";
ui->centralWidget->setStyleSheet(sty);
// this->setStyleSheet("QWidget{border-radius:6px;border:none;}");
// KylinDBus mkylindbus;
// double trans = mkylindbus.getTransparentData();
// QString strTrans;
// strTrans = QString::number(trans, 10, 2);
// QString sty = "#centralWidget{border:1px solid rgba(255,255,255,0.05);border-radius:6px;background:rgba(19,19,20," + strTrans + ");}";
// ui->centralWidget->setStyleSheet(sty);
labelQss = "QLabel{border:0px;color:rgba(255,255,255,0.97);background-color:transparent;}";
cbxQss = "QComboBox{padding-left:20px;font-size:13px;color:rgba(255,255,255,0.91);"
@ -71,35 +71,35 @@ ConfForm::ConfForm(QWidget *parent) :
btnOnQss = "QPushButton{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);color:white;font-size:14px;}"
"QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}"
"QPushButton:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);}";
lineQss = "background:rgba(255,255,255,0.08);";
lineQss = "background:rgba(156,156,156,0.1);";
// ui->centralWidget->setStyleSheet("#centralWidget{border:1px solid #297a97;background-color:#ffffff;}");
ui->wdHead->setStyleSheet("#wdHead{border:none}");
ui->wgManual->setStyleSheet("#wgManual{border:none}");
ui->wdBottom->setStyleSheet("#wdBottom{border:none}");
ui->lbLeftupTitle->setStyleSheet("QLabel{border:0px;font-size:20px;color:rgba(255,255,255,0.97);background-color:transparent;}");
ui->lbName->setStyleSheet(labelQss);
ui->lbTxt1->setStyleSheet(labelQss);
ui->lbTxt2->setStyleSheet(labelQss);
ui->lbTxt3->setStyleSheet(labelQss);
ui->lbTxt4->setStyleSheet(labelQss);
ui->lbTxt5->setStyleSheet(labelQss);
ui->lbTxt6->setStyleSheet(labelQss);
// ui->lbLeftupTitle->setStyleSheet("QLabel{border:0px;font-size:20px;color:rgba(255,255,255,0.97);background-color:transparent;}");
// ui->lbName->setStyleSheet(labelQss);
// ui->lbTxt1->setStyleSheet(labelQss);
// ui->lbTxt2->setStyleSheet(labelQss);
// ui->lbTxt3->setStyleSheet(labelQss);
// ui->lbTxt4->setStyleSheet(labelQss);
// ui->lbTxt5->setStyleSheet(labelQss);
// ui->lbTxt6->setStyleSheet(labelQss);
ui->cbType->setStyleSheet(cbxQss);
ui->cbType->setView(new QListView());
ui->cbMask->setStyleSheet(cbxQss);
ui->cbMask->setView(new QListView());
// ui->cbType->setStyleSheet(cbxQss);
// ui->cbType->setView(new QListView());
// ui->cbMask->setStyleSheet(cbxQss);
// ui->cbMask->setView(new QListView());
ui->leName->setStyleSheet(leQss);
ui->leAddr->setStyleSheet(leQss);
ui->leGateway->setStyleSheet(leQss);
ui->leDns->setStyleSheet(leQss);
ui->leDns2->setStyleSheet(leQss);
// ui->leName->setStyleSheet(leQss);
// ui->leAddr->setStyleSheet(leQss);
// ui->leGateway->setStyleSheet(leQss);
// ui->leDns->setStyleSheet(leQss);
// ui->leDns2->setStyleSheet(leQss);
ui->btnCancel->setStyleSheet(btnOffQss);
ui->btnOk->setStyleSheet(btnOnQss);
ui->btnCreate->setStyleSheet(btnOnQss);
// ui->btnCancel->setStyleSheet(btnOffQss);
// ui->btnOk->setStyleSheet(btnOnQss);
// ui->btnCreate->setStyleSheet(btnOnQss);
ui->lineUp->setStyleSheet(lineQss);
ui->lineDown->setStyleSheet(lineQss);
ui->lineUp->hide();
@ -337,10 +337,10 @@ void ConfForm::cbTypeChanged(int index)
this->resize(432, 510);
}
if (index == 3) {
ui->btnOk->setStyleSheet(btnOffQss);
// ui->btnOk->setStyleSheet(btnOffQss);
ui->btnOk->setEnabled(false);
ui->btnCreate->setStyleSheet(btnOffQss);
// ui->btnCreate->setStyleSheet(btnOffQss);
ui->btnCreate->setEnabled(false);
ui->leName->setEnabled(true);
@ -413,10 +413,10 @@ void ConfForm::setEnableOfBtn()
}
}
ui->btnOk->setStyleSheet(btnOnQss);
// ui->btnOk->setStyleSheet(btnOnQss);
ui->btnOk->setEnabled(true);
ui->btnCreate->setStyleSheet(btnOnQss);
// ui->btnCreate->setStyleSheet(btnOnQss);
ui->btnCreate->setEnabled(true);
}
@ -435,10 +435,10 @@ bool ConfForm::getTextEditState(QString text)
//设置创建或保存按钮不可点击
void ConfForm::setBtnEnableFalse()
{
ui->btnOk->setStyleSheet(btnOffQss);
// ui->btnOk->setStyleSheet(btnOffQss);
ui->btnOk->setEnabled(false);
ui->btnCreate->setStyleSheet(btnOffQss);
// ui->btnCreate->setStyleSheet(btnOffQss);
ui->btnCreate->setEnabled(false);
}
@ -448,5 +448,12 @@ void ConfForm::paintEvent(QPaintEvent *event)
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QRect rect = this->rect();
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base));
//p.setOpacity(1);
p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event);
}

View File

@ -974,3 +974,12 @@ double KylinDBus::getTransparentData()
return 0.7;
}
}
//使用GSetting获取当前系统主题样式
void KylinDBus::getUkuiStyleState()
{
// if(QGSettings::isSchemaInstalled(QString("org.ukui.style").toLocal8Bit())) {
// QGSettings* gsetting=new QGSettings(QString("org.ukui.style").toLocal8Bit());
// connect(gsetting,&QGSettings::changed,this,&SideBarWidget::themeModeChangeSlot);
// }
}

View File

@ -57,6 +57,7 @@ public:
void initTaskbarGsetting();
int getTaskbarHeight();
int getTaskbarPos();
void getUkuiStyleState();
void getWifiSwitchState();
bool getSwitchStatus(QString key);

View File

@ -53,9 +53,9 @@ MainWindow::MainWindow(QWidget *parent) :
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
this->setStyleSheet("QWidget{border:none;border-radius:6px;}");
//this->setStyleSheet("QWidget{border:none;border-radius:6px;}");
ui->centralWidget->setStyleSheet("#centralWidget{border:none;border-radius:6px;background:rgba(19,19,20,0.7);}");
//ui->centralWidget->setStyleSheet("#centralWidget{border:none;border-radius:6px;background:rgba(19,19,20,0.5);}");
editQssString(); //编辑部分控件QSS
createTopLanUI(); //创建顶部有线网item
@ -205,11 +205,11 @@ void MainWindow::editQssString()
btnOnQss = "QLabel{min-width: 37px; min-height: 37px;max-width:37px; max-height: 37px;border-radius: 4px; background-color:rgba(61,107,229,1)}";
btnBgOffQss = "QLabel{min-width: 48px; min-height: 22px;max-width:48px; max-height: 22px;border-radius: 10px; background-color:rgba(255,255,255,0.2)}";
btnBgOnQss = "QLabel{min-width: 48px; min-height: 22px;max-width:48px; max-height: 22px;border-radius: 10px; background-color:rgba(61,107,229,1);}";
btnBgHoverQss = "QLabel{border-radius: 4px; background-color:rgba(255,255,255,0.12)}";
btnBgHoverQss = "QLabel{border-radius: 4px; background-color:rgba(156,156,156,0.3)}";
btnBgLeaveQss = "QLabel{border-radius: 4px; background-color:rgba(255,255,255,0)}";
leftBtnQss = "QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0);}"
"QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(255,255,255,0.12);}"
"QPushButton:Pressed{border-radius:4px;background-color:rgba(255,255,255,0.12);}";
"QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(156,156,156,0.3);}"
"QPushButton:Pressed{border-radius:4px;background-color:rgba(156,156,156,0.3);}";
funcBtnQss = "QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0);color:rgba(107,142,235,0.97);font-size:14px;}"
"QPushButton:Hover{border:0px;border-radius:4px;background-color:rgba(255,255,255,0);color:rgba(151,175,241,0.97);font-size:14px;}"
"QPushButton:Pressed{border-radius:4px;background-color:rgba(255,255,255,0);color:rgba(61,107,229,0.97);font-size:14px;}";
@ -225,7 +225,7 @@ void MainWindow::createTopLanUI()
lbTopLanList->setText(tr("Ethernet Networks"));//"可用网络列表"
lbTopLanList->resize(W_MIDDLE_WORD, H_MIDDLE_WORD);
lbTopLanList->move(X_MIDDLE_WORD, H_NORMAL_ITEM + H_GAP_UP);
lbTopLanList->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.97);}");
// lbTopLanList->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.97);}");
lbTopLanList->show();
/*新建有线网按钮*/
btnCreateNet = new QPushButton(topLanListWidget);
@ -248,7 +248,7 @@ void MainWindow::createTopWifiUI()
lbTopWifiList->setText(tr("Wifi Networks"));//"可用网络列表"
lbTopWifiList->resize(W_MIDDLE_WORD, H_MIDDLE_WORD);
lbTopWifiList->move(X_MIDDLE_WORD, H_NORMAL_ITEM + H_GAP_UP);
lbTopWifiList->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.97);}");
// lbTopWifiList->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.97);}");
lbTopWifiList->show();
/*新建有线网按钮*/
btnAddNet = new QPushButton(topWifiListWidget);
@ -283,7 +283,8 @@ void MainWindow::createOtherUI()
lbNoItemTip = new QLabel(ui->centralWidget);
lbNoItemTip->resize(W_NO_ITEM_TIP, H_NO_ITEM_TIP);
lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2);
lbNoItemTip->setStyleSheet("QLabel{border:none;background:transparent;font-size:14px;color:rgba(255,255,255,0.91);}");
// lbNoItemTip->setStyleSheet("QLabel{border:none;background:transparent;font-size:14px;color:rgba(255,255,255,0.91);}");
lbNoItemTip->setStyleSheet("QLabel{border:none;background:transparent;}");
lbNoItemTip->setText(tr("No usable network in the list"));//列表暂无可连接网络
lbNoItemTip->setAlignment(Qt::AlignCenter);
lbNoItemTip->hide();
@ -308,7 +309,7 @@ void MainWindow::createListAreaUI()
lbLanList = new QLabel(lanListWidget);
lbWifiList = new QLabel(wifiListWidget);
ui->lbNetwork->setStyleSheet("QLabel{font-size:20px;color:rgba(255,255,255,0.97);}");
// ui->lbNetwork->setStyleSheet("QLabel{font-size:20px;color:rgba(255,255,255,0.97);}");
ui->lbNetwork->show();
topLanListWidget->setStyleSheet("QWidget{border:none;}");
@ -317,19 +318,19 @@ void MainWindow::createListAreaUI()
topWifiListWidget->setStyleSheet("QWidget{border:none;}");
topWifiListWidget->setStyleSheet("background-color:transparent;");
lbLoadUp->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.57);}");
lbLoadDown->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.57);}");
// lbLoadUp->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.57);}");
// lbLoadDown->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.57);}");
lbLoadUp->setText("0KB/s");
lbLoadDown->setText("0KB/s.");
this->on_setNetSpeed();
scrollAreal->setStyleSheet("QScrollArea{border:none;}");
scrollAreal->viewport()->setStyleSheet("background-color:transparent;");
//scrollAreal->verticalScrollBar()->setStyleSheet(scrollBarQss);
//scrollAreal->verticalScrollBar()->setStyleSheet(scrollBarQss);////
scrollAreaw->setStyleSheet("QScrollArea{border:none;}");
scrollAreaw->viewport()->setStyleSheet("background-color:transparent;");
//scrollAreaw->verticalScrollBar()->setStyleSheet(scrollBarQss);
//scrollAreaw->verticalScrollBar()->setStyleSheet(scrollBarQss);////
}
void MainWindow::createLeftAreaUI()
@ -340,13 +341,32 @@ void MainWindow::createLeftAreaUI()
QString txtEthernet(tr("Ethernet"));
ui->btnNetList->setToolTip(txtEthernet);
ui->lbNetListBG->setStyleSheet(btnOffQss);
ui->lbNetListImg->setStyleSheet("QLabel{background-image:url(:/res/x/net-list-bg.svg);}");
//ui->lbNetListImg->setStyleSheet("QLabel{background-image:url(:/res/x/net-list-bg.svg);}");
//ui->btnNetListImg->setStyleSheet("QPushButton{background:transparent;}");
//设置PushButton背景透明
QPalette paletteLan = ui->btnNetListImg->palette();
paletteLan.setColor(QPalette::Highlight, Qt::transparent);
paletteLan.setBrush(QPalette::Button, QBrush(QColor(1,1,1,0)));
ui->btnNetListImg->setPalette(paletteLan);
//添加PushButton的svg图片
ui->btnNetListImg->setIcon(QIcon(":/res/x/net-list-bg.svg"));
ui->btnNetListImg->setProperty("useIconHighlightEffect", true);
ui->btnNetListImg->setProperty("iconHighlightEffectMode", true);
ui->btnWifiList->setFocusPolicy(Qt::NoFocus);
QString txtWifi(tr("Wifi"));
ui->btnWifiList->setToolTip(txtWifi);
ui->lbWifiListBG->setStyleSheet(btnOffQss);
ui->lbWifiListImg->setStyleSheet("QLabel{background-image:url(:/res/x/wifi-list-bg.svg);}");
//ui->lbWifiListImg->setStyleSheet("QLabel{background-image:url(:/res/x/wifi-list-bg.svg);}");
//设置PushButton背景透明
QPalette paletteWifi = ui->btnWifiListImg->palette();
paletteWifi.setColor(QPalette::Highlight, Qt::transparent);
paletteWifi.setBrush(QPalette::Button, QBrush(QColor(1,1,1,0)));
ui->btnWifiListImg->setPalette(paletteWifi);
//添加PushButton的svg图片
ui->btnWifiListImg->setIcon(QIcon(":/res/x/wifi-list-bg.svg"));
ui->btnWifiListImg->setProperty("useIconHighlightEffect", true);
ui->btnWifiListImg->setProperty("iconHighlightEffectMode", true);
ui->btnNet->hide();
@ -376,9 +396,16 @@ void MainWindow::createLeftAreaUI()
ui->btnAdvConf->setFocusPolicy(Qt::NoFocus);
QString txtAdvanced(tr("Advanced"));
ui->btnAdvConf->setToolTip(txtAdvanced);
//ui->lbBtnConfImg->setStyleSheet("QLabel{background-image:url(:/res/x/setup.png);}");
ui->btnConfImg->setStyleSheet("QPushButton{background-image:url(:/res/x/setup.png);}");
//ui->btnConfImg->setIcon(QIcon::fromTheme("settings-app-symbolic.svg", QIcon(":/res/x/setup.png")) );
//ui->lbBtnConfImg->setStyleSheet("QLabel{background-image:url(:/res/x/control.svg);}");
//设置PushButton背景透明
QPalette paletteConf = ui->btnConfImg->palette();
paletteConf.setColor(QPalette::Highlight, Qt::transparent);
paletteConf.setBrush(QPalette::Button, QBrush(QColor(1,1,1,0)));
ui->btnConfImg->setPalette(paletteConf);
//添加PushButton的svg图片
ui->btnConfImg->setIcon(QIcon(":/res/x/control.svg"));
ui->btnConfImg->setProperty("useIconHighlightEffect", true);
ui->btnConfImg->setProperty("iconHighlightEffectMode", true);
}
// 初始化有线网列表
@ -429,15 +456,15 @@ void MainWindow::initNetwork()
syslog(LOG_DEBUG, "current network state: wired state =%d, wifi state =%d", iface->lstate, iface->wstate);
qDebug()<<"===";
//ui->lbBtnNetBG->setStyleSheet(btnOnQss);
//ui->lbBtnNetBG->setStyleSheet(btnOnQss);////
if (iface->wstate == 0 || iface->wstate == 1) {
// ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);
// ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);////
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);////
btnWireless->setSwitchStatus(true);
} else {
btnWireless->setSwitchStatus(false);
//ui->lbBtnWifiBG->setStyleSheet(btnBgOffQss);
//ui->lbBtnWifiBall->move(X_LEFT_WIFI_BALL, Y_WIFI_BALL);
//ui->lbBtnWifiBG->setStyleSheet(btnBgOffQss);////
//ui->lbBtnWifiBall->move(X_LEFT_WIFI_BALL, Y_WIFI_BALL);////
}
// 初始化网络列表
@ -604,11 +631,11 @@ void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason)
handleIconClicked();
if (this->isHidden()) {
double trans = objKyDBus->getTransparentData();
QString strTrans;
strTrans = QString::number(trans, 10, 2);
QString sty = "#centralWidget{background:rgba(19,19,20," + strTrans + ");}";
ui->centralWidget->setStyleSheet(sty);
// double trans = objKyDBus->getTransparentData();
// QString strTrans;
// strTrans = QString::number(trans, 10, 2);
// QString sty = "#centralWidget{background:rgba(19,19,20," + strTrans + ");}";
// ui->centralWidget->setStyleSheet(sty);
this->showNormal();
if (is_btnNetList_clicked == 1) {
@ -1242,18 +1269,18 @@ void MainWindow::on_btnWifiList_clicked()
//ui->lbBtnWifiBG->show();
//ui->lbBtnWifiBall->show();
if (iface->wstate == 0 || iface->wstate == 1) {
//ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);
//ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);////
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);////
btnWireless->setSwitchStatus(true);
} else {
//ui->lbBtnWifiBG->setStyleSheet(btnBgOffQss);
//ui->lbBtnWifiBall->move(X_LEFT_WIFI_BALL, Y_WIFI_BALL);
//ui->lbBtnWifiBG->setStyleSheet(btnBgOffQss);////
//ui->lbBtnWifiBall->move(X_LEFT_WIFI_BALL, Y_WIFI_BALL);////
btnWireless->setSwitchStatus(false);
}
if (iface->wstate != 2) {
//ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);
//ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);////
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);////
btnWireless->setSwitchStatus(true);
lbTopWifiList->show();
btnAddNet->show();
@ -1261,8 +1288,8 @@ void MainWindow::on_btnWifiList_clicked()
this->startLoading();
this->ksnm->execGetWifiList();
} else {
//ui->lbBtnWifiBG->setStyleSheet(btnBgOffQss);
//ui->lbBtnWifiBall->move(X_LEFT_WIFI_BALL, Y_WIFI_BALL);
//ui->lbBtnWifiBG->setStyleSheet(btnBgOffQss);////
//ui->lbBtnWifiBall->move(X_LEFT_WIFI_BALL, Y_WIFI_BALL);////
btnWireless->setSwitchStatus(false);
delete topWifiListWidget; //清空top列表
createTopWifiUI(); //创建顶部无线网item
@ -1778,15 +1805,15 @@ void MainWindow::on_btnAdvConf_released()
void MainWindow::on_btnFlyMode_clicked()
{
if (is_fly_mode_on == 0) {
ui->lbFlyImg->setStyleSheet("QLabel{background-image:url(:/res/x/fly-mode-on.svg);}");
ui->lbFlyBG->setStyleSheet(btnOnQss);
// ui->lbFlyImg->setStyleSheet("QLabel{background-image:url(:/res/x/fly-mode-on.svg);}");
// ui->lbFlyBG->setStyleSheet(btnOnQss);
is_fly_mode_on = 1;
onBtnWifiClicked(0);
on_btnWifiList_clicked();
} else {
ui->lbFlyImg->setStyleSheet("QLabel{background-image:url(:/res/x/fly-mode-off.svg);}");
ui->lbFlyBG->setStyleSheet(btnOffQss);
// ui->lbFlyImg->setStyleSheet("QLabel{background-image:url(:/res/x/fly-mode-off.svg);}");
// ui->lbFlyBG->setStyleSheet(btnOffQss);
is_fly_mode_on = 0;
}
}
@ -2159,13 +2186,13 @@ void MainWindow::enNetDone()
BackThread *bt = new BackThread();
mwBandWidth = bt->execChkLanWidth(lname);
ui->lbBtnNetBG->setStyleSheet(btnOnQss);
// ui->lbBtnNetBG->setStyleSheet(btnOnQss);
// 打开网络开关时如果Wifi开关是打开的设置其样式
if (checkWlOn()) {
btnWireless->setSwitchStatus(true);
//ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);
//ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);////
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);////
}
onBtnNetListClicked(1);
@ -2207,7 +2234,7 @@ void MainWindow::disNetDone()
ccf->move(L_VERTICAL_LINE_TO_ITEM, 0);
ccf->show();
ui->lbBtnNetBG->setStyleSheet(btnOffQss);
// ui->lbBtnNetBG->setStyleSheet(btnOffQss);
btnWireless->setSwitchStatus(false);
@ -2227,13 +2254,13 @@ void MainWindow::disNetDone()
}
void MainWindow::launchLanDone()
{
ui->lbBtnNetBG->setStyleSheet(btnOnQss);
// ui->lbBtnNetBG->setStyleSheet(btnOnQss);
}
void MainWindow::enWifiDone()
{
//ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);
//ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss);////
//ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL);////
is_update_wifi_list = 0;
if (is_btnWifiList_clicked) {
@ -2262,8 +2289,8 @@ void MainWindow::disWifiStateKeep()
{
if (this->is_btnNetList_clicked == 1) {
btnWireless->setSwitchStatus(false);
//ui->lbBtnWifiBG->setStyleSheet(btnBgOffQss);
//ui->lbBtnWifiBall->move(X_LEFT_WIFI_BALL, Y_WIFI_BALL);
//ui->lbBtnWifiBG->setStyleSheet(btnBgOffQss);////
//ui->lbBtnWifiBall->move(X_LEFT_WIFI_BALL, Y_WIFI_BALL);////
}
if (this->is_btnWifiList_clicked== 1) {
disWifiDoneChangeUI();
@ -2304,8 +2331,8 @@ void MainWindow::disWifiDoneChangeUI()
}
btnWireless->setSwitchStatus(false);
//ui->lbBtnWifiBG->setStyleSheet(btnBgOffQss);
//ui->lbBtnWifiBall->move(X_LEFT_WIFI_BALL, Y_WIFI_BALL);
//ui->lbBtnWifiBG->setStyleSheet(btnBgOffQss);////
//ui->lbBtnWifiBall->move(X_LEFT_WIFI_BALL, Y_WIFI_BALL);////
this->lanListWidget->hide();
this->topLanListWidget->hide();
@ -2526,3 +2553,96 @@ void MainWindow::connWifiDone(int connFlag)
syslog(LOG_DEBUG, "Launch kylin-nm, Wi-Fi already connected");
}
}
//重新绘制背景色
void MainWindow::paintEvent(QPaintEvent *event)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
QRect rect = this->rect();
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base));
//p.setOpacity(1);
p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event);
}
///////////////////////////////////////////////////////////////////////////////
//控件随主题色置灰或置白
void MainWindow::setUkuiStyle(QString style)
{
qDebug() << "zzzzz" << style;
// const auto ratio=devicePixelRatioF();
// QPixmap pixmap=loadSvg(iconStr,19*ratio);
// if (style == "ukui-light") {
// pixmap=drawSymbolicBlackColoredPixmap(pixmap);
// } else {
// pixmap=drawSymbolicColoredPixmap(pixmap);//反白
// }
// pixmap.setDevicePixelRatio(qApp->devicePixelRatio());
// label->setPixmap(pixmap);
}
QPixmap MainWindow::drawSymbolicColoredPixmap(const QPixmap &source)
{
QColor gray(128,128,128);
QColor standard (31,32,34);
QImage img = source.toImage();
for (int x = 0; x < img.width(); x++) {
for (int y = 0; y < img.height(); y++) {
auto color = img.pixelColor(x, y);
if (color.alpha() > 0) {
if (qAbs(color.red()-gray.red())<20 && qAbs(color.green()-gray.green())<20 && qAbs(color.blue()-gray.blue())<20) {
color.setRed(255);
color.setGreen(255);
color.setBlue(255);
img.setPixelColor(x, y, color);
} else if(qAbs(color.red()-standard.red())<20 && qAbs(color.green()-standard.green())<20 && qAbs(color.blue()-standard.blue())<20) {
color.setRed(255);
color.setGreen(255);
color.setBlue(255);
img.setPixelColor(x, y, color);
} else {
img.setPixelColor(x, y, color);
}
}
}
}
return QPixmap::fromImage(img);
}
QPixmap MainWindow::drawSymbolicBlackColoredPixmap(const QPixmap &source)
{
QImage img = source.toImage();
for (int x = 0; x < img.width(); x++) {
for (int y = 0; y < img.height(); y++) {
auto color = img.pixelColor(x, y);
if (color.alpha() > 0) {
if (qAbs(color.red())>=200 && qAbs(color.green())>=200 && qAbs(color.blue())>=200) {
color.setRed(56);
color.setGreen(56);
color.setBlue(56);
img.setPixelColor(x, y, color);
}
}
}
}
return QPixmap::fromImage(img);
}
const QPixmap MainWindow::loadSvg(const QString &fileName, const int size)
{
QPixmap pixmap(size, size);
QSvgRenderer renderer(fileName);
pixmap.fill(Qt::transparent);
QPainter painter;
painter.begin(&pixmap);
renderer.render(&painter);
painter.end();
return pixmap;
}

View File

@ -62,6 +62,7 @@
#include <QStandardPaths>
#include <QStringList>
#include <QToolTip>
#include <QSvgRenderer>
#define W_LEFT_AREA 41
#define W_VERTICAL_LINE 1 //左边竖线宽度
@ -166,6 +167,7 @@ public slots:
void onNetworkDeviceAdded(QDBusObjectPath objPath);
void onNetworkDeviceRemoved(QDBusObjectPath objPath);
void getLanBandWidth();
void setUkuiStyle(QString style);
void onExternalConnectionChange(QString type);
void onExternalLanChange();
@ -185,6 +187,7 @@ public slots:
protected:
bool eventFilter(QObject *obj, QEvent *event);
void paintEvent(QPaintEvent *event);
private:
void checkSingle();
@ -197,6 +200,9 @@ private:
void getLanList();
void getWifiList();
void getInitLanSlist();
QPixmap drawSymbolicColoredPixmap(const QPixmap &source);
QPixmap drawSymbolicBlackColoredPixmap(const QPixmap &source);
const QPixmap loadSvg(const QString &fileName, const int size);
Ui::MainWindow *ui;

View File

@ -170,32 +170,6 @@
<string/>
</property>
</widget>
<widget class="QLabel" name="lbNetListImg">
<property name="geometry">
<rect>
<x>11</x>
<y>20</y>
<width>19</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbWifiListImg">
<property name="geometry">
<rect>
<x>11</x>
<y>67</y>
<width>19</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="lbHotBG">
<property name="geometry">
<rect>
@ -258,26 +232,51 @@
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255,0.06);</string>
<string notr="true">background-color: rgba(156, 156, 156,0.1);</string>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<widget class="QPushButton" name="btnConfImg">
<widget class="QPushButton" name="btnNetListImg">
<property name="geometry">
<rect>
<x>11</x>
<y>499</y>
<width>19</width>
<height>19</height>
<x>8</x>
<y>18</y>
<width>24</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="btnWifiListImg">
<property name="geometry">
<rect>
<x>8</x>
<y>65</y>
<width>24</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="btnConfImg">
<property name="geometry">
<rect>
<x>8</x>
<y>497</y>
<width>24</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<zorder>btnConfImg</zorder>
<zorder>lbFlyBG</zorder>
<zorder>lbHotBG</zorder>
<zorder>lbFlyImg</zorder>
@ -285,18 +284,19 @@
<zorder>lbBtnNetBG</zorder>
<zorder>btnNet</zorder>
<zorder>lbBtnWifiBG</zorder>
<zorder>btnAdvConf</zorder>
<zorder>btnHotspot</zorder>
<zorder>btnFlyMode</zorder>
<zorder>lbBtnWifiBall</zorder>
<zorder>lbNetListBG</zorder>
<zorder>lbWifiListBG</zorder>
<zorder>lbWifiListImg</zorder>
<zorder>lbNetListImg</zorder>
<zorder>btnNetList</zorder>
<zorder>btnWifiList</zorder>
<zorder>lbNetwork</zorder>
<zorder>vLine</zorder>
<zorder>btnNetListImg</zorder>
<zorder>btnNetList</zorder>
<zorder>btnWifiListImg</zorder>
<zorder>btnConfImg</zorder>
<zorder>btnWifiList</zorder>
<zorder>btnAdvConf</zorder>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>

View File

@ -50,8 +50,8 @@ OneConnForm::OneConnForm(QWidget *parent, MainWindow *mainWindow, ConfForm *conf
ui->lePassword->setEchoMode(QLineEdit::Normal);
ui->btnConnPWD->setEnabled(false);
leQssLow = "QLineEdit{border:none;background:transparent;font-size:14px;color:rgba(255,255,255,0.57);font-family:Noto Sans CJK SC;}";
leQssHigh = "QLineEdit{border:none;background:transparent;font-size:14px;color:rgba(255,255,255,0.91);font-family:Noto Sans CJK SC;}";
leQssLow = "QLineEdit{border:none;background:transparent;font-family:Noto Sans CJK SC;}";
leQssHigh = "QLineEdit{border:none;background:transparent;font-family:Noto Sans CJK SC;}";
ui->leInfo_1->setStyleSheet(leQssLow);
ui->leInfo_2->setStyleSheet(leQssLow);
@ -60,13 +60,14 @@ OneConnForm::OneConnForm(QWidget *parent, MainWindow *mainWindow, ConfForm *conf
ui->leInfo_2->setEnabled(false);
ui->leInfo_3->setEnabled(false);
ui->btnInfo->setStyleSheet("QPushButton{border:none;background:transparent;}");
ui->wbg->setStyleSheet("#wbg{border-radius:4px;background-color:rgba(255,255,255,0);}");
ui->wbg_2->setStyleSheet("#wbg_2{border-radius:4px;background-color:rgba(255,255,255,0.1);}");
ui->wbg_3->setStyleSheet("#wbg_3{border-radius:4px;background-color:rgba(255,255,255,0.1);}");
ui->lbName->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.91);}");
ui->lbConned->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.57);}");
ui->lePassword->setStyleSheet("QLineEdit{border:1px solid rgba(61,107,229,1);border-radius:4px;"
"background:rgba(0,0,0,0.2);color:rgba(255,255,255,0.35);font-size:14px;}");
ui->wbg->setStyleSheet("#wbg{border-radius:4px;background-color:rgba(156,156,156,0);}");
ui->wbg_2->setStyleSheet("#wbg_2{border-radius:4px;background-color:rgba(156,156,156,0.1);}");
ui->wbg_3->setStyleSheet("#wbg_3{border-radius:4px;background-color:rgba(156,156,156,0.1);}");
// ui->lbName->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.91);}");
// ui->lbConned->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.57);}");
// ui->lePassword->setStyleSheet("QLineEdit{border:1px solid rgba(61,107,229,1);border-radius:4px;"
// "background:rgba(0,0,0,0.2);color:rgba(255,255,255,0.35);font-size:14px;}");
ui->lePassword->setStyleSheet("QLineEdit{border:1px solid rgba(61,107,229,1);border-radius:4px;background:rgba(0,0,0,0.2);}");
ui->checkBoxPwd->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
@ -79,9 +80,12 @@ OneConnForm::OneConnForm(QWidget *parent, MainWindow *mainWindow, ConfForm *conf
ui->btnConnPWD->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0.12);color:white;font-size:14px;}"
"QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(255,255,255,0.2);}"
"QPushButton:Pressed{border-radius:4px;background-color:rgba(255,255,255,0.08);}");
ui->btnDisConn->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0.12);color:white;font-size:14px;}"
"QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(255,255,255,0.2);}"
"QPushButton:Pressed{border-radius:4px;background-color:rgba(255,255,255,0.08);}");
// ui->btnDisConn->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0.12);color:white;font-size:14px;}"
// "QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(255,255,255,0.2);}"
// "QPushButton:Pressed{border-radius:4px;background-color:rgba(255,255,255,0.08);}");
ui->btnDisConn->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(156,156,156,0.2);}"
"QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(156,156,156,0.3);}"
"QPushButton:Pressed{border-radius:4px;background-color:rgba(156,156,156,0.1);}");
ui->btnHideConn->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);color:white;font-size:14px;}"
"QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}"
"QPushButton:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);}");
@ -172,14 +176,14 @@ bool OneConnForm::eventFilter(QObject *obj, QEvent *event)
if (!this->isTopItem) {
if (!this->isSelected) {
ui->btnConn->show();
ui->wbg->setStyleSheet("#wbg{border-radius:4px;background-color:rgba(255,255,255,0.1);}");
ui->wbg->setStyleSheet("#wbg{border-radius:4px;background-color:rgba(156,156,156,0.1);}");
ui->wbg->show();
}
}
return true;
} else if (event->type() == QEvent::HoverLeave) {
ui->btnConn->hide();
ui->wbg->setStyleSheet("#wbg{border-radius:4px;background-color:rgba(255,255,255,0);}");
ui->wbg->setStyleSheet("#wbg{border-radius:4px;background-color:rgba(156,156,156,0);}");
ui->wbg->hide();
return true;
}
@ -200,10 +204,10 @@ bool OneConnForm::eventFilter(QObject *obj, QEvent *event)
void OneConnForm::setAct(bool isAct)
{
if (isAct) {
ui->lbName->setStyleSheet("QLabel{font-size:14px;color:#ffffff;}");
//ui->lbName->setStyleSheet("QLabel{font-size:14px;color:#ffffff;}");
ui->lbConned->show();
} else {
ui->lbName->setStyleSheet("QLabel{font-size:14px;color:#ffffff;}");
//ui->lbName->setStyleSheet("QLabel{font-size:14px;color:#ffffff;}");
ui->lbConned->hide();
}
isActive = isAct;
@ -283,8 +287,7 @@ void OneConnForm::setSelected(bool isSelected, bool isCurrName)
} else {
resize(W_ITEM, H_ITEM);
ui->lePassword->setText(tr("Input Password..."));//"输入密码..."
ui->lePassword->setStyleSheet("QLineEdit{border:1px solid rgba(61,107,229,1);border-radius:4px;"
"background:rgba(0,0,0,0.2);color:rgba(255,255,255,0.35);font-size:14px;}");
ui->lePassword->setStyleSheet("QLineEdit{border:1px solid rgba(61,107,229,1);border-radius:4px;background:rgba(0,0,0,0.2);}");
ui->lePassword->setEchoMode(QLineEdit::Normal);
ui->checkBoxPwd->setChecked(true);
@ -589,7 +592,7 @@ bool OneConnForm::isWifiConfExist(QString netName)
void OneConnForm::on_checkBoxPwd_stateChanged(int arg1)
{
if (arg1 == 0) {
ui->lePassword ->setEchoMode(QLineEdit::Password);
ui->lePassword->setEchoMode(QLineEdit::Password);
} else {
ui->lePassword->setEchoMode(QLineEdit::Normal);
}
@ -597,17 +600,15 @@ void OneConnForm::on_checkBoxPwd_stateChanged(int arg1)
void OneConnForm::on_lePassword_textEdited(const QString &arg1)
{
ui->lePassword->setStyleSheet("QLineEdit{border:2px solid rgba(28, 47, 146, 1);border-radius:4px;"
"background:rgba(0,0,0,0.2);color:rgba(255,255,255,0.91);font-size:14px;}");
ui->lePassword->setStyleSheet("QLineEdit{border:2px solid rgba(28, 47, 146, 1);border-radius:4px;background:rgba(0,0,0,0.2);}");
if (ui->lePassword->text().size() < 5){
if (ui->lePassword->text().size() < 5) {
ui->btnConnPWD->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0.12);color:white;font-size:14px;}"
"QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(255,255,255,0.2);}"
"QPushButton:Pressed{border-radius:4px;background-color:rgba(255,255,255,0.08);}");
ui->btnConnPWD->setEnabled(false);
if (ui->lePassword->text().size() == 0){
ui->lePassword->setStyleSheet("QLineEdit{border:1px solid rgba(61,107,229,1);border-radius:4px;"
"background:rgba(0,0,0,0.2);color:rgba(255,255,255,0.35);font-size:14px;}");
if (ui->lePassword->text().size() == 0) {
ui->lePassword->setStyleSheet("QLineEdit{border:1px solid rgba(61,107,229,1);border-radius:4px;background:rgba(0,0,0,0.2);}");
}
} else {
ui->btnConnPWD->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);color:white;font-size:14px;}"

View File

@ -217,7 +217,7 @@
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255,0.05);</string>
<string notr="true">background-color: rgba(156, 156, 156,0.1);</string>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>

View File

@ -34,27 +34,32 @@ OneLancForm::OneLancForm(QWidget *parent, MainWindow *mainWindow, ConfForm *conf
ui->lbConned->setAlignment(Qt::AlignLeft);
leQssLow = "QLineEdit{border:none;background:transparent;font-size:14px;color:rgba(255,255,255,0.57);font-family:Noto Sans CJK SC;}";
leQssHigh = "QLineEdit{border:none;background:transparent;font-size:14px;color:rgba(255,255,255,0.91);font-family:Noto Sans CJK SC;}";
// leQssLow = "QLineEdit{border:none;background:transparent;font-size:14px;color:rgba(255,255,255,0.57);font-family:Noto Sans CJK SC;}";
// leQssHigh = "QLineEdit{border:none;background:transparent;font-size:14px;color:rgba(255,255,255,0.91);font-family:Noto Sans CJK SC;}";
leQssLow = "QLineEdit{border:none;background:transparent;font-family:Noto Sans CJK SC;}";
leQssHigh = "QLineEdit{border:none;background:transparent;font-family:Noto Sans CJK SC;}";
ui->leInfo_1->setStyleSheet(leQssLow);
ui->leInfo_2->setStyleSheet(leQssLow);
ui->leInfo_3->setStyleSheet(leQssLow);
ui->leInfo_4->setStyleSheet(leQssLow);
ui->btnInfo->setStyleSheet("QPushButton{border:none;background:transparent;}");
ui->wbg->setStyleSheet("#wbg{border-radius:4px;background-color:rgba(255,255,255,0.1);}");
ui->wbg_2->setStyleSheet("#wbg_2{border-radius:4px;background-color:rgba(255,255,255,0);}");
ui->lbName->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.91);}");
ui->lbConned->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.57);}");
ui->wbg->setStyleSheet("#wbg{border-radius:4px;background-color:rgba(156,156,156,0.1);}");
ui->wbg_2->setStyleSheet("#wbg_2{border-radius:4px;background-color:rgba(156,156,156,0);}");
// ui->lbName->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.91);}");
// ui->lbConned->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.57);}");
ui->btnConnSub->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);color:white;font-size:14px;}"
"QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}"
"QPushButton:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);}");
ui->btnConn->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);color:white;font-size:14px;}"
"QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}"
"QPushButton:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);}");
ui->btnDisConn->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0.12);color:white;font-size:14px;}"
"QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(255,255,255,0.2);}"
"QPushButton:Pressed{border-radius:4px;background-color:rgba(255,255,255,0.08);}");
// ui->btnDisConn->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0.12);color:white;font-size:14px;}"
// "QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(255,255,255,0.2);}"
// "QPushButton:Pressed{border-radius:4px;background-color:rgba(255,255,255,0.08);}");
ui->btnDisConn->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(156,156,156,0.2);}"
"QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(156,156,156,0.3);}"
"QPushButton:Pressed{border-radius:4px;background-color:rgba(156,156,156,0.1);}");
ui->lbWaiting->setStyleSheet("QLabel{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);}");
ui->lbWaitingIcon->setStyleSheet("QLabel{border:0px;background-color:transparent;}");
@ -127,14 +132,14 @@ bool OneLancForm::eventFilter(QObject *obj, QEvent *event)
if (!this->isTopItem) {
if (!this->isSelected) {
ui->btnConn->show();
ui->wbg_2->setStyleSheet("#wbg_2{border-radius:4px;background-color:rgba(255,255,255,0.1);}");
ui->wbg_2->setStyleSheet("#wbg_2{border-radius:4px;background-color:rgba(156,156,156,0.1);}");
ui->wbg_2->show();
}
}
return true;
} else if(event->type() == QEvent::HoverLeave) {
ui->btnConn->hide();
ui->wbg_2->setStyleSheet("#wbg_2{border-radius:4px;background-color:rgba(255,255,255,0);}");
ui->wbg_2->setStyleSheet("#wbg_2{border-radius:4px;background-color:rgba(156,156,156,0);}");
ui->wbg_2->hide();
return true;
}
@ -147,11 +152,11 @@ bool OneLancForm::eventFilter(QObject *obj, QEvent *event)
void OneLancForm::setAct(bool isAct)
{
if (isAct) {
ui->lbName->setStyleSheet("QLabel{font-size:14px;color:#ffffff;}");
//ui->lbName->setStyleSheet("QLabel{font-size:14px;color:#ffffff;}");
ui->lbConned->show();
ui->btnConnSub->hide();
} else {
ui->lbName->setStyleSheet("QLabel{font-size:14px;color:#ffffff;}");
//ui->lbName->setStyleSheet("QLabel{font-size:14px;color:#ffffff;}");
ui->lbConned->hide();
ui->btnConnSub->hide();
}

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>424</width>
<height>250</height>
<height>60</height>
</rect>
</property>
<property name="windowTitle">
@ -115,7 +115,7 @@
<rect>
<x>63</x>
<y>86</y>
<width>250</width>
<width>260</width>
<height>20</height>
</rect>
</property>
@ -169,7 +169,7 @@
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255,0.05);</string>
<string notr="true">background-color: rgba(156, 156, 156,0.1);</string>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>

View File

@ -70,8 +70,8 @@ void SwitchButton::paintEvent(QPaintEvent *event) {
painter.setRenderHint(QPainter::Antialiasing); //抗锯齿效果
painter.setPen(Qt::NoPen);
QColor colorActive(61,107,229);
QColor colorInactive(255,255,255);
colorInactive.setAlphaF(0.12);
QColor colorInactive(190,190,190);
colorInactive.setAlphaF(0.12);
if(m_bIsOn) {
painter.save();
painter.setBrush(colorActive);

View File

@ -47,31 +47,31 @@ DlgConnHidWifi::DlgConnHidWifi(int type, MainWindow *mainWindow, QWidget *parent
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
KylinDBus mkylindbus;
double trans = mkylindbus.getTransparentData();
QString strTrans;
strTrans = QString::number(trans, 10, 2);
QString sty = "QWidget{border-radius:6px;background-color:rgba(19,19,20," + strTrans + ");border:1px solid rgba(255, 255, 255, 0.05);}";
this->setStyleSheet(sty);
// KylinDBus mkylindbus;
// double trans = mkylindbus.getTransparentData();
// QString strTrans;
// strTrans = QString::number(trans, 10, 2);
// QString sty = "QWidget{border-radius:6px;background-color:rgba(19,19,20," + strTrans + ");border:1px solid rgba(255, 255, 255, 0.05);}";
// this->setStyleSheet(sty);
//this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}");
MyQss objQss;
ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}");
// ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}");
ui->lbBoder->hide();
ui->lbLeftupTitle->setStyleSheet("QLabel{border:0px;font-size:20px;color:rgba(255,255,255,0.97);background-color:transparent;}");
ui->lbConn->setStyleSheet(objQss.labelQss);
ui->lbNetName->setStyleSheet(objQss.labelQss);
ui->lbSecurity->setStyleSheet(objQss.labelQss);
// ui->lbLeftupTitle->setStyleSheet("QLabel{border:0px;font-size:20px;color:rgba(255,255,255,0.97);background-color:transparent;}");
// ui->lbConn->setStyleSheet(objQss.labelQss);
// ui->lbNetName->setStyleSheet(objQss.labelQss);
// ui->lbSecurity->setStyleSheet(objQss.labelQss);
ui->cbxConn->setStyleSheet(objQss.cbxQss);
ui->cbxConn->setView(new QListView());
ui->leNetName->setStyleSheet(objQss.leQss);
ui->cbxSecurity->setStyleSheet(objQss.cbxQss);
ui->cbxSecurity->setView(new QListView());
// ui->cbxConn->setStyleSheet(objQss.cbxQss);
// ui->cbxConn->setView(new QListView());
// ui->leNetName->setStyleSheet(objQss.leQss);
// ui->cbxSecurity->setStyleSheet(objQss.cbxQss);
// ui->cbxSecurity->setView(new QListView());
ui->btnConnect->setStyleSheet(objQss.btnConnQss);
ui->btnCancel->setStyleSheet(objQss.btnCancelQss);
// ui->btnConnect->setStyleSheet(objQss.btnConnQss);
// ui->btnCancel->setStyleSheet(objQss.btnCancelQss);
ui->lineUp->setStyleSheet(objQss.lineQss);
ui->lineDown->setStyleSheet(objQss.lineQss);
@ -323,5 +323,12 @@ void DlgConnHidWifi::paintEvent(QPaintEvent *event)
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QRect rect = this->rect();
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base));
//p.setOpacity(1);
p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event);
}

View File

@ -46,34 +46,34 @@ DlgConnHidWifiWpa::DlgConnHidWifiWpa(int type, MainWindow *mainWindow, QWidget *
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
KylinDBus mkylindbus;
double trans = mkylindbus.getTransparentData();
QString strTrans;
strTrans = QString::number(trans, 10, 2);
QString sty = "QWidget{border-radius:6px;background-color:rgba(19,19,20," + strTrans + ");border:1px solid rgba(255, 255, 255, 0.05);}";
this->setStyleSheet(sty);
// KylinDBus mkylindbus;
// double trans = mkylindbus.getTransparentData();
// QString strTrans;
// strTrans = QString::number(trans, 10, 2);
// QString sty = "QWidget{border-radius:6px;background-color:rgba(19,19,20," + strTrans + ");border:1px solid rgba(255, 255, 255, 0.05);}";
// this->setStyleSheet(sty);
//this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}");
MyQss objQss;
ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}");
// ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}");
ui->lbBoder->hide();
ui->lbLeftupTitle->setStyleSheet("QLabel{border:0px;font-size:20px;color:rgba(255,255,255,0.97);background-color:transparent;}");
ui->lbConn->setStyleSheet(objQss.labelQss);
ui->lbNetName->setStyleSheet(objQss.labelQss);
ui->lbSecurity->setStyleSheet(objQss.labelQss);
ui->lbPassword->setStyleSheet(objQss.labelQss);
// ui->lbLeftupTitle->setStyleSheet("QLabel{border:0px;font-size:20px;color:rgba(255,255,255,0.97);background-color:transparent;}");
// ui->lbConn->setStyleSheet(objQss.labelQss);
// ui->lbNetName->setStyleSheet(objQss.labelQss);
// ui->lbSecurity->setStyleSheet(objQss.labelQss);
// ui->lbPassword->setStyleSheet(objQss.labelQss);
ui->cbxConn->setStyleSheet(objQss.cbxQss);
ui->cbxConn->setView(new QListView());
ui->leNetName->setStyleSheet(objQss.leQss);
ui->lePassword->setStyleSheet(objQss.leQss);
ui->cbxSecurity->setStyleSheet(objQss.cbxQss);
ui->cbxSecurity->setView(new QListView());
// ui->cbxConn->setStyleSheet(objQss.cbxQss);
// ui->cbxConn->setView(new QListView());
// ui->leNetName->setStyleSheet(objQss.leQss);
// ui->lePassword->setStyleSheet(objQss.leQss);
// ui->cbxSecurity->setStyleSheet(objQss.cbxQss);
// ui->cbxSecurity->setView(new QListView());
ui->checkBoxPwd->setStyleSheet(objQss.checkBoxQss);
ui->btnCancel->setStyleSheet(objQss.btnCancelQss);
ui->btnConnect->setStyleSheet(objQss.btnConnQss);
// ui->btnCancel->setStyleSheet(objQss.btnCancelQss);
// ui->btnConnect->setStyleSheet(objQss.btnConnQss);
ui->lineUp->setStyleSheet(objQss.lineQss);
ui->lineDown->setStyleSheet(objQss.lineQss);
ui->btnCancel->setFocusPolicy(Qt::NoFocus);
@ -353,5 +353,12 @@ void DlgConnHidWifiWpa::paintEvent(QPaintEvent *event)
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QRect rect = this->rect();
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base));
//p.setOpacity(1);
p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event);
}

View File

@ -40,5 +40,5 @@ MyQss::MyQss()
btnConnQss = "QPushButton{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);color:white;font-size:14px;}"
"QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}"
"QPushButton:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);}";
lineQss = "background:rgba(255,255,255,0.08);";
lineQss = "background:rgba(156,156,156,0.1);";
}