优化代码

This commit is contained in:
zhaominyong 2022-04-08 16:03:36 +08:00
parent 10acd924eb
commit 72498f5650
4 changed files with 18 additions and 14 deletions

View File

@ -0,0 +1,4 @@
#ifndef CUSTOMIZESYSTEMBACKUPPROXY_H
#define CUSTOMIZESYSTEMBACKUPPROXY_H
#endif // CUSTOMIZESYSTEMBACKUPPROXY_H

View File

@ -10,7 +10,7 @@
class MyBackupManager : public QObject {
Q_OBJECT
// Q_CLASSINFO("D-Bus Interface", "com.kylin.backup.manager")
Q_CLASSINFO("D-Bus Interface", "com.kylin.backup.manager")
public:
explicit MyBackupManager();

View File

@ -13,11 +13,11 @@ MyIconButton::MyIconButton(QWidget *parent) :
{
this->setCheckable(false);
this->setProperty("useButtonPalette", true);
m_hoverColor = pluginBtnHoverColor(true);
m_clickColor = pluginBtnHoverColor(false);
if (!this->isChecked())
this->setStyleSheet(QString("QPushButton:hover{background-color:%1;border-radius: 6px;}"
"QPushButton:pressed{background-color:%2;border-radius: 6px;}").arg(m_hoverColor).arg(m_clickColor));
// m_hoverColor = pluginBtnHoverColor(true);
// m_clickColor = pluginBtnHoverColor(false);
// if (!this->isChecked())
// this->setStyleSheet(QString("QPushButton:hover{background-color:%1;border-radius: 6px;}"
// "QPushButton:pressed{background-color:%2;border-radius: 6px;}").arg(m_hoverColor).arg(m_clickColor));
m_pixSize = 16;
m_iconButton = new QPushButton(this);
@ -59,11 +59,11 @@ MyIconButton::MyIconButton(QWidget *parent) :
connect(this, &MyIconButton::toggled, this, [=](bool checked) {
m_iconButton->setChecked(this->isChecked());
if (checked) {
this->setStyleSheet("QPushButton:checked{background-color: palette(highlight);border-radius: 6px;}");
// this->setStyleSheet("QPushButton:checked{background-color: palette(highlight);border-radius: 6px;}");
m_textLabel->setStyleSheet("color:white");
} else {
this->setStyleSheet(QString("QPushButton:hover{background-color:%1;border-radius: 6px;}"
"QPushButton:pressed{background-color:%2;border-radius: 6px;}").arg(this->m_hoverColor).arg(this->m_clickColor));
// this->setStyleSheet(QString("QPushButton:hover{background-color:%1;border-radius: 6px;}"
// "QPushButton:pressed{background-color:%2;border-radius: 6px;}").arg(this->m_hoverColor).arg(this->m_clickColor));
m_textLabel->setStyleSheet("color:palette(windowText)");
}
});
@ -75,11 +75,11 @@ MyIconButton::MyIconButton(QWidget *parent) :
else
this->m_iconButton->setIcon(ImageUtil::loadTheme(this->m_themeIconName, this->m_defaultIconName, "default", this->m_pixSize));
this->m_hoverColor = pluginBtnHoverColor(true);
this->m_clickColor = pluginBtnHoverColor(false);
if (!this->isChecked())
this->setStyleSheet(QString("QPushButton:hover{background-color:%1;border-radius: 6px;}"
"QPushButton:pressed{background-color:%2;border-radius: 6px;}").arg(this->m_hoverColor).arg(this->m_clickColor));
// this->m_hoverColor = pluginBtnHoverColor(true);
// this->m_clickColor = pluginBtnHoverColor(false);
// if (!this->isChecked())
// this->setStyleSheet(QString("QPushButton:hover{background-color:%1;border-radius: 6px;}"
// "QPushButton:pressed{background-color:%2;border-radius: 6px;}").arg(this->m_hoverColor).arg(this->m_clickColor));
});
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::fontChanged, this, [=](int fontSize) {