Merge branch 'modify-color' into 'dbus-interface'

fix bug 128215 ukui3.20控制面板-网路界面悬停点击状态颜色过深

See merge request kylin-desktop/kylin-nm!654
This commit is contained in:
赵世旭 2022-07-15 05:45:31 +00:00
commit cc286fc592
10 changed files with 95 additions and 9 deletions

View File

@ -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();

View File

@ -0,0 +1,33 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#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);
}

View File

@ -0,0 +1,34 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#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

View File

@ -2,8 +2,10 @@
SOURCES += \
$$PWD/AddBtn/addnetbtn.cpp \
$$PWD/AddBtn/grayinfobutton.cpp
HEADERS += \
$$PWD/AddBtn/addnetbtn.h \
$$PWD/AddBtn/grayinfobutton.h

View File

@ -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();

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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 = "";