126419 【备份还原工具】界面内容图标与设计稿不一致
This commit is contained in:
parent
b54fd37a59
commit
80e2f70953
|
@ -2,11 +2,16 @@
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include "../globalsignals.h"
|
||||||
|
#include "../globalbackupinfo.h"
|
||||||
|
#include "../gsettingswrapper.h"
|
||||||
|
#include "imageutil.h"
|
||||||
|
|
||||||
MyIconLabel::MyIconLabel(QWidget *parent /*= nullptr*/) :
|
MyIconLabel::MyIconLabel(QWidget *parent /*= nullptr*/) :
|
||||||
QLabel(parent)
|
QLabel(parent)
|
||||||
{
|
{
|
||||||
m_iconLabel = new CircleLable("", this, 36);
|
m_iconLabel = new CircleLable("", this, 36);
|
||||||
|
m_iconSize = 16;
|
||||||
// border:1px solid black;
|
// border:1px solid black;
|
||||||
// const QString greySheetStyle = "min-width: 36px; min-height: 36px;max-width:36px; max-height: 36px;border-radius: 18px; background:grey";
|
// const QString greySheetStyle = "min-width: 36px; min-height: 36px;max-width:36px; max-height: 36px;border-radius: 18px; background:grey";
|
||||||
// const QString greySheetStyle = "min-width: 36px; min-height: 36px;max-width:36px; max-height: 36px;border-radius: 18px; background:#F4F4F4";
|
// const QString greySheetStyle = "min-width: 36px; min-height: 36px;max-width:36px; max-height: 36px;border-radius: 18px; background:#F4F4F4";
|
||||||
|
@ -27,18 +32,25 @@ MyIconLabel::MyIconLabel(QWidget *parent /*= nullptr*/) :
|
||||||
hLayout->addWidget(m_textLabel);
|
hLayout->addWidget(m_textLabel);
|
||||||
hLayout->addStretch();
|
hLayout->addStretch();
|
||||||
setLayout(hLayout);
|
setLayout(hLayout);
|
||||||
|
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::styleNameChanged, this, [=](){
|
||||||
|
this->setThemeIcon(this->m_themeIconName, this->m_defaultIconName, this->m_iconSize);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
MyIconLabel::~MyIconLabel()
|
MyIconLabel::~MyIconLabel()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void MyIconLabel::setThemeIcon(const QString &themeIconName, const QString &defaultIconName)
|
void MyIconLabel::setThemeIcon(const QString &themeIconName, const QString &defaultIconName, int size)
|
||||||
{
|
{
|
||||||
m_themeIconName = themeIconName;
|
m_themeIconName = themeIconName;
|
||||||
m_defaultIconName = defaultIconName;
|
m_defaultIconName = defaultIconName;
|
||||||
|
m_iconSize = size;
|
||||||
|
|
||||||
QIcon icon = QIcon::fromTheme(themeIconName, QIcon(defaultIconName));
|
if (g_GSettingWrapper.isDarkTheme())
|
||||||
m_iconLabel->setPixmap(icon.pixmap(icon.actualSize(QSize(16, 16))));
|
m_iconLabel->setPixmap(ImageUtil::loadTheme(this->m_themeIconName, this->m_defaultIconName, "white", m_iconSize));
|
||||||
|
else
|
||||||
|
m_iconLabel->setPixmap(ImageUtil::loadTheme(this->m_themeIconName, this->m_defaultIconName, "default", m_iconSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyIconLabel::setDesplayText(const QString &text)
|
void MyIconLabel::setDesplayText(const QString &text)
|
||||||
|
|
|
@ -10,7 +10,7 @@ public:
|
||||||
explicit MyIconLabel(QWidget *parent = nullptr);
|
explicit MyIconLabel(QWidget *parent = nullptr);
|
||||||
virtual ~MyIconLabel();
|
virtual ~MyIconLabel();
|
||||||
|
|
||||||
void setThemeIcon(const QString &themeIconName, const QString &defaultIconName = "");
|
void setThemeIcon(const QString &themeIconName, const QString &defaultIconName = "", int size = 16);
|
||||||
|
|
||||||
void setDesplayText(const QString &text);
|
void setDesplayText(const QString &text);
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ private:
|
||||||
QString m_themeIconName;
|
QString m_themeIconName;
|
||||||
QString m_defaultIconName;
|
QString m_defaultIconName;
|
||||||
QString m_originalText;
|
QString m_originalText;
|
||||||
|
int m_iconSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MYICONLABEL_H
|
#endif // MYICONLABEL_H
|
||||||
|
|
Loading…
Reference in New Issue