fix bug 128215控制面板有线/无线按钮效果
This commit is contained in:
parent
0153114412
commit
ee491b775a
|
@ -34,6 +34,11 @@ AddNetBtn::AddNetBtn(bool isWlan, QWidget *parent) : QPushButton(parent)
|
|||
this->setMaximumSize(QSize(16777215, 60));
|
||||
this->setProperty("useButtonPalette", true);
|
||||
this->setFlat(true);
|
||||
QPalette pal = this->palette();
|
||||
QColor color = pal.color(QPalette::Button);
|
||||
color.setAlphaF(0.5);
|
||||
pal.setColor(QPalette::Button, color);
|
||||
this->setPalette(pal);
|
||||
QHBoxLayout *addLyt = new QHBoxLayout;
|
||||
|
||||
QLabel *iconLabel = new QLabel();
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#include "grayinfobutton.h"
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
#define BUTTON_SIZE 36,36
|
||||
#define ICON_SIZE 16,16
|
||||
|
||||
GrayInfoButton::GrayInfoButton(QWidget *parent): QPushButton(parent)
|
||||
{
|
||||
this->setFixedSize(BUTTON_SIZE);
|
||||
this->setIcon(QIcon::fromTheme("preferences-system-details-symbolic"));
|
||||
this->setProperty("useButtonPalette", true);
|
||||
this->setFlat(true);
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef GRAYINFOBUTTON_H
|
||||
#define GRAYINFOBUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QIcon>
|
||||
|
||||
class GrayInfoButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GrayInfoButton(QWidget * parent = nullptr);
|
||||
~GrayInfoButton() = default;
|
||||
};
|
||||
|
||||
#endif // GRAYINFOBUTTON_H
|
|
@ -2,8 +2,10 @@
|
|||
|
||||
SOURCES += \
|
||||
$$PWD/AddBtn/addnetbtn.cpp \
|
||||
$$PWD/AddBtn/grayinfobutton.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/AddBtn/addnetbtn.h \
|
||||
$$PWD/AddBtn/grayinfobutton.h
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,11 @@ LanItem::LanItem(bool isAcitve, QWidget *parent)
|
|||
this->setMinimumSize(550, 58);
|
||||
this->setProperty("useButtonPalette", true);
|
||||
this->setFlat(true);
|
||||
QPalette pal = this->palette();
|
||||
QColor color = pal.color(QPalette::Button);
|
||||
color.setAlphaF(0.5);
|
||||
pal.setColor(QPalette::Button, color);
|
||||
this->setPalette(pal);
|
||||
// setStyleSheet("QPushButton:!checked{background-color: palette(base)}");
|
||||
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
|
||||
mLanLyt->setContentsMargins(16,0,16,0);
|
||||
|
@ -41,7 +46,7 @@ LanItem::LanItem(bool isAcitve, QWidget *parent)
|
|||
statusLabel = new QLabel(this);
|
||||
statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
// statusLabel->setMinimumSize(36,36);
|
||||
infoLabel = new InfoButton(this);
|
||||
infoLabel = new GrayInfoButton(this);
|
||||
mLanLyt->addWidget(iconLabel);
|
||||
mLanLyt->addWidget(titileLabel,Qt::AlignLeft);
|
||||
mLanLyt->addStretch();
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
#include <QImage>
|
||||
#include <QPainter>
|
||||
#include "fixlabel.h"
|
||||
#include "infobutton.h"
|
||||
//#include "infobutton.h"
|
||||
#include "../component/AddBtn/grayinfobutton.h"
|
||||
|
||||
class LanItem : public QPushButton
|
||||
{
|
||||
|
@ -39,7 +40,7 @@ public:
|
|||
~LanItem();
|
||||
public:
|
||||
QLabel * iconLabel = nullptr;
|
||||
InfoButton * infoLabel = nullptr;
|
||||
GrayInfoButton * infoLabel = nullptr;
|
||||
FixLabel * titileLabel = nullptr;
|
||||
QLabel * statusLabel = nullptr;
|
||||
|
||||
|
|
|
@ -438,7 +438,7 @@ void NetConnect::addLanItem(ItemFrame *frame, QString devName, QStringList infoL
|
|||
lanItem->uuid = infoList.at(1);
|
||||
lanItem->dbusPath = infoList.at(2);
|
||||
|
||||
connect(lanItem->infoLabel, &InfoButton::clicked, this, [=]{
|
||||
connect(lanItem->infoLabel, &GrayInfoButton::clicked, this, [=]{
|
||||
// open landetail page
|
||||
if (!m_interface->isValid()) {
|
||||
return;
|
||||
|
@ -707,7 +707,7 @@ void NetConnect::addOneLanFrame(ItemFrame *frame, QString deviceName, QStringLis
|
|||
lanItem->uuid = connUuid;
|
||||
lanItem->dbusPath = connDbusPath;
|
||||
|
||||
connect(lanItem->infoLabel, &InfoButton::clicked, this, [=]{
|
||||
connect(lanItem->infoLabel, &GrayInfoButton::clicked, this, [=]{
|
||||
// open landetail page
|
||||
if (!m_interface->isValid()) {
|
||||
return;
|
||||
|
|
|
@ -1026,7 +1026,7 @@ void WlanConnect::addOneWlanFrame(ItemFrame *frame, QString deviceName, QString
|
|||
wlanItem->statusLabel->setText("");
|
||||
}
|
||||
|
||||
connect(wlanItem->infoLabel, &InfoButton::clicked, this, [=]{
|
||||
connect(wlanItem->infoLabel, &GrayInfoButton::clicked, this, [=]{
|
||||
// open detail page
|
||||
if (!m_interface->isValid()) {
|
||||
return;
|
||||
|
|
|
@ -33,6 +33,11 @@ WlanItem::WlanItem(bool bAcitve, bool isLock, QWidget *parent)
|
|||
this->setMinimumSize(550, 58);
|
||||
this->setProperty("useButtonPalette", true);
|
||||
this->setFlat(true);
|
||||
QPalette pal = this->palette();
|
||||
QColor color = pal.color(QPalette::Button);
|
||||
color.setAlphaF(0.5);
|
||||
pal.setColor(QPalette::Button, color);
|
||||
this->setPalette(pal);
|
||||
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
|
||||
mLanLyt->setContentsMargins(16,0,16,0);
|
||||
mLanLyt->setSpacing(16);
|
||||
|
@ -41,7 +46,7 @@ WlanItem::WlanItem(bool bAcitve, bool isLock, QWidget *parent)
|
|||
statusLabel = new QLabel(this);
|
||||
statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
// statusLabel->setMinimumSize(36,36);
|
||||
infoLabel = new InfoButton(this);
|
||||
infoLabel = new GrayInfoButton(this);
|
||||
mLanLyt->addWidget(iconLabel);
|
||||
mLanLyt->addWidget(titileLabel,Qt::AlignLeft);
|
||||
mLanLyt->addStretch();
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
#include <QGSettings>
|
||||
#include <QImage>
|
||||
#include "fixlabel.h"
|
||||
#include "infobutton.h"
|
||||
//#include "infobutton.h"
|
||||
#include "../component/AddBtn/grayinfobutton.h"
|
||||
|
||||
class WlanItem : public QPushButton
|
||||
{
|
||||
|
@ -38,7 +39,7 @@ public:
|
|||
~WlanItem();
|
||||
public:
|
||||
QLabel * iconLabel = nullptr;
|
||||
InfoButton * infoLabel = nullptr;
|
||||
GrayInfoButton * infoLabel = nullptr;
|
||||
FixLabel * titileLabel = nullptr;
|
||||
QLabel * statusLabel = nullptr;
|
||||
QString uuid = "";
|
||||
|
|
Loading…
Reference in New Issue