适配强调色

This commit is contained in:
zhangyuanyuan1 2022-10-21 18:36:29 +08:00 committed by jzxc95
parent c186b65c44
commit 6e6dd32659
3 changed files with 16 additions and 0 deletions

View File

@ -495,6 +495,8 @@ void NetDetail::initComponent()
connect(fontSetting, &QGSettings::changed,[=](QString key) { connect(fontSetting, &QGSettings::changed,[=](QString key) {
if ("systemFont" == key || "systemFontSize" ==key) { if ("systemFont" == key || "systemFontSize" ==key) {
setNetTabToolTip(); setNetTabToolTip();
} else if ("themeColor" == key) {
onPaletteChanged();
} }
}); });
} }

View File

@ -36,6 +36,7 @@
#define FOREGROUND_COLOR_PRESS_ACTIVE QColor(36,109,212,255) #define FOREGROUND_COLOR_PRESS_ACTIVE QColor(36,109,212,255)
#define COLOR_BRIGHT_TEXT qApp->palette().brightText().color() #define COLOR_BRIGHT_TEXT qApp->palette().brightText().color()
#define COLOR_HIGH_LIGHT qApp->palette().highlight().color() #define COLOR_HIGH_LIGHT qApp->palette().highlight().color()
#define THEME_SCHAME "org.ukui.style"
QColor mixColor(const QColor &c1, const QColor &c2, qreal bias); QColor mixColor(const QColor &c1, const QColor &c2, qreal bias);
@ -49,6 +50,17 @@ RadioItemButton::RadioItemButton(QWidget *parent) : QPushButton(parent)
m_iconLabel->setAlignment(Qt::AlignCenter); m_iconLabel->setAlignment(Qt::AlignCenter);
setActive(false); setActive(false);
const QByteArray id(THEME_SCHAME);
if (QGSettings::isSchemaInstalled(id)) {
m_styleGSettings = new QGSettings(id);
connect(m_styleGSettings, &QGSettings::changed, this, [=](QString key){
if ("themeColor" == key) {
onPaletteChanged();
}
});
}
//JXJ_TODO loading动画 //JXJ_TODO loading动画
connect(this, &RadioItemButton::requestStartLoading, this, &RadioItemButton::onLoadingStarted); connect(this, &RadioItemButton::requestStartLoading, this, &RadioItemButton::onLoadingStarted);
connect(this , &RadioItemButton::requestStopLoading, this, &RadioItemButton::onLoadingStopped); connect(this , &RadioItemButton::requestStopLoading, this, &RadioItemButton::onLoadingStopped);

View File

@ -24,6 +24,7 @@
#include <QLabel> #include <QLabel>
#include <QTimer> #include <QTimer>
#include <QVariantAnimation> #include <QVariantAnimation>
#include <QGSettings>
#define MIDDLE_COLOR 178 #define MIDDLE_COLOR 178
@ -66,6 +67,7 @@ private:
QVariantAnimation * m_animation = nullptr; QVariantAnimation * m_animation = nullptr;
QPixmap m_pixmap; QPixmap m_pixmap;
QGSettings *m_styleGSettings = nullptr;
void refreshButtonIcon(); void refreshButtonIcon();