125640 【设计】【UKUI攻关】【备份还原】系统备份、数据备份界面的管理备份文字主题高亮不变化
This commit is contained in:
parent
e90cf2a31a
commit
c8984cb3ef
Binary file not shown.
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.3 KiB |
|
@ -75,7 +75,13 @@ void CircleLable::paintEvent(QPaintEvent *event)
|
|||
m_textColor = m_oldTextColor;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果设置的是蓝色,则使用调色板里的高亮色
|
||||
if (m_backgroundColor == QColor(COLOR_BLUE)) {
|
||||
painter.setBrush(QBrush(this->palette().highlight().color()));
|
||||
} else {
|
||||
painter.setBrush(QBrush(m_backgroundColor));
|
||||
}
|
||||
painter.setPen(Qt::NoPen);
|
||||
QRect rect = this->rect();
|
||||
// 也可用QPainterPath 绘制代替 painter.drawRoundedRect(rect, 15, 15); { QPainterPath painterPath; painterPath.addRoundedRect(rect, 15, 15); p.drawPath(painterPath); }
|
||||
|
|
|
@ -34,7 +34,12 @@ void LineLabel::paintEvent(QPaintEvent *event)
|
|||
}
|
||||
}
|
||||
QPen pen = painter.pen();
|
||||
// 如果设置的是蓝色,则使用调色板里的高亮色
|
||||
if (m_color == QColor(COLOR_BLUE)) {
|
||||
pen.setColor(this->palette().highlight().color());
|
||||
} else {
|
||||
pen.setColor(m_color);
|
||||
}
|
||||
pen.setWidth(2);
|
||||
painter.setPen(pen);
|
||||
QRect rect = this->rect();
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <QFont>
|
||||
#include <QFontMetrics>
|
||||
#include <QPainter>
|
||||
#include "../../common/mydefine.h"
|
||||
#include "../globalbackupinfo.h"
|
||||
#include "../gsettingswrapper.h"
|
||||
|
||||
|
@ -125,9 +126,21 @@ void MyLabel::setFontColor(QColor color)
|
|||
} else {
|
||||
m_bAutoTheme = true;
|
||||
}
|
||||
m_fontColor = color;
|
||||
|
||||
QPalette palette = this->palette();
|
||||
if (m_fontColor == QColor(COLOR_BLUE)) {
|
||||
palette.setColor(QPalette::WindowText, palette.highlight().color());
|
||||
|
||||
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::themeColorChanged, this, [=]() {
|
||||
// 强调色更换,高亮等颜色已经改变,所以要重新加载图标。
|
||||
QPalette pal(this->palette());
|
||||
pal.setColor(QPalette::WindowText, this->palette().highlight().color());
|
||||
this->setPalette(pal);
|
||||
});
|
||||
} else {
|
||||
palette.setColor(QPalette::WindowText, color);
|
||||
}
|
||||
this->setPalette(palette);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <QLabel>
|
||||
#include <QRect>
|
||||
#include <QColor>
|
||||
|
||||
class MyLabel : public QLabel
|
||||
{
|
||||
|
@ -32,6 +33,7 @@ private:
|
|||
bool m_isOriginal = false;
|
||||
bool m_needResize = false;
|
||||
QRect m_rect;
|
||||
QColor m_fontColor;
|
||||
|
||||
// 背景及字体颜色是否自动跟随主题
|
||||
bool m_bAutoTheme;
|
||||
|
|
|
@ -33,7 +33,6 @@ void RingsProgressbar::paintEvent(QPaintEvent *)
|
|||
else
|
||||
p.setBrush(QBrush(QColor(COLOR_LIGHT_BLUE)));
|
||||
p.drawEllipse(outRect);
|
||||
p.setBrush(QBrush(QColor(COLOR_BLUE)));
|
||||
|
||||
//画遮罩
|
||||
p.setPen(Qt::NoPen);
|
||||
|
@ -45,7 +44,8 @@ void RingsProgressbar::paintEvent(QPaintEvent *)
|
|||
|
||||
//画圆弧
|
||||
pen.setCapStyle(Qt::RoundCap);
|
||||
pen.setColor(QColor(COLOR_BLUE));
|
||||
// pen.setColor(QColor(COLOR_BLUE));
|
||||
pen.setColor(this->palette().highlight().color());
|
||||
qreal penWidth = 5;
|
||||
pen.setWidthF(penWidth);
|
||||
p.setPen(pen);
|
||||
|
@ -57,15 +57,15 @@ void RingsProgressbar::paintEvent(QPaintEvent *)
|
|||
p.save();
|
||||
QPainterPath path;
|
||||
path.moveTo(inRect.center());
|
||||
path.arcTo(QRectF(5 + penWidth/2 , 5 + penWidth/2, side - 10 - penWidth, side - 10 - penWidth), 90, -m_rotateAngle);
|
||||
path.arcTo(QRectF(5 + penWidth/2 , 5 + penWidth/2, side - 10 - penWidth, side - 10 - penWidth), 90, -1 * m_rotateAngle);
|
||||
QPointF currentPosition = path.currentPosition();
|
||||
QColor color(QColor(COLOR_BLUE));
|
||||
QColor color(this->palette().highlight().color());
|
||||
color.setAlphaF(0.5);
|
||||
p.setPen(color);
|
||||
p.setBrush(QBrush(QColor(Qt::white)));
|
||||
p.drawEllipse(currentPosition, 6, 6);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(QBrush(QColor(COLOR_BLUE)));
|
||||
p.setBrush(QBrush(this->palette().highlight().color()));
|
||||
p.drawEllipse(currentPosition, 3.5, 3.5);
|
||||
p.restore();
|
||||
|
||||
|
@ -74,7 +74,7 @@ void RingsProgressbar::paintEvent(QPaintEvent *)
|
|||
f.setBold(true);
|
||||
f.setPixelSize(25);
|
||||
p.setFont(f);
|
||||
p.setPen(QColor(COLOR_BLUE));
|
||||
p.setPen(this->palette().highlight().color());
|
||||
p.drawText(inRect, Qt::AlignCenter, valueStr);
|
||||
|
||||
p.restore();
|
||||
|
|
|
@ -25,6 +25,9 @@ signals:
|
|||
|
||||
// 字体(家族或大小)变化
|
||||
void fontChanged(int fontSize);
|
||||
|
||||
// 强调色变化
|
||||
void themeColorChanged();
|
||||
};
|
||||
|
||||
#endif // GLOBALSIGNALS_H
|
||||
|
|
|
@ -43,6 +43,9 @@ GSettingsWrapper::GSettingsWrapper(token)
|
|||
// 字体大小或字体类型发生变化
|
||||
int fontSize = m_pGsettingThemeData->get("system-font-size").toInt();
|
||||
emit GlobelBackupInfo::inst().getGlobalSignals()->fontChanged(fontSize);
|
||||
} else if (key == COLOR_QT_KEY) {
|
||||
// 强调色变化
|
||||
emit GlobelBackupInfo::inst().getGlobalSignals()->themeIconChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ class QWidget;
|
|||
#define STYLE_NAME_VALUE_WHITE "ukui-white"
|
||||
#define ICON_THEME_NAME "iconThemeName"
|
||||
#define TRANSPARENCY_NAME "transparency"
|
||||
#define COLOR_QT_KEY "theme-color"
|
||||
|
||||
// 颜色
|
||||
// 浅灰
|
||||
|
|
|
@ -34,9 +34,9 @@ MainDialog::MainDialog(QWidget *parent)
|
|||
// 使得窗口无边框
|
||||
// w.setWindowFlag(Qt::FramelessWindowHint);
|
||||
// 指示窗口管理器模糊给定窗口后面指定区域的背景(毛玻璃化背景)
|
||||
KWindowEffects::enableBlurBehind(this->winId(), true);
|
||||
// KWindowEffects::enableBlurBehind(this->winId(), true);
|
||||
// 或使用设置毛玻璃属性的方式实现毛玻璃背景(两者都行,可使用其一)
|
||||
// this->setProperty("useSystemStyleBlur", true);
|
||||
this->setProperty("useSystemStyleBlur", true);
|
||||
this->setAutoFillBackground(true);
|
||||
|
||||
// 添加窗管协议
|
||||
|
|
|
@ -202,7 +202,7 @@ void DataBackup::initFirstWidget()
|
|||
backupPointManage->setFlat(true);
|
||||
backupPointManage->setProperty("useButtonPalette", true);
|
||||
QPalette pal(backupPointManage->palette());
|
||||
pal.setColor(QPalette::ButtonText, this->palette().link().color());
|
||||
pal.setColor(QPalette::ButtonText, this->palette().highlight().color());
|
||||
pal.setColor(QPalette::Button, this->palette().base().color());
|
||||
backupPointManage->setPalette(pal);
|
||||
bottomHBoxLayout->addWidget(backupPointManage);
|
||||
|
@ -223,6 +223,14 @@ void DataBackup::initFirstWidget()
|
|||
Q_UNUSED(isDark)
|
||||
// 深浅主题切换时,因为调色板已经更换,高亮等颜色已经改变,所以要重新加载图标。
|
||||
QPalette pal(backupPointManage->palette());
|
||||
pal.setColor(QPalette::ButtonText, this->palette().highlight().color());
|
||||
pal.setColor(QPalette::Button, this->palette().base().color());
|
||||
backupPointManage->setPalette(pal);
|
||||
});
|
||||
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::themeColorChanged, this, [=]() {
|
||||
// 强调色更换,高亮等颜色已经改变,所以要重新加载图标。
|
||||
QPalette pal(backupPointManage->palette());
|
||||
pal.setColor(QPalette::ButtonText, this->palette().highlight().color());
|
||||
pal.setColor(QPalette::Button, this->palette().base().color());
|
||||
backupPointManage->setPalette(pal);
|
||||
});
|
||||
|
|
|
@ -119,8 +119,8 @@ void ManageBackupPointList::insertLines(const QList<ParseBackupList::BackupPoint
|
|||
}
|
||||
|
||||
//hide factory backup
|
||||
if (backupPoint.m_uuid == FACTORY_BACKUP_UUID)
|
||||
continue;
|
||||
// if (backupPoint.m_uuid == FACTORY_BACKUP_UUID)
|
||||
// continue;
|
||||
|
||||
//udisk unique
|
||||
if (backupPoint.m_path.startsWith(preDevPath)) {
|
||||
|
|
|
@ -170,6 +170,14 @@ void SystemBackup::initFirstWidget()
|
|||
Q_UNUSED(isDark)
|
||||
// 深浅主题切换时,因为调色板已经更换,高亮等颜色已经改变,所以要重新加载图标。
|
||||
QPalette pal(backupPointManage->palette());
|
||||
pal.setColor(QPalette::ButtonText, this->palette().highlight().color());
|
||||
pal.setColor(QPalette::Button, this->palette().base().color());
|
||||
backupPointManage->setPalette(pal);
|
||||
});
|
||||
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::themeColorChanged, this, [=]() {
|
||||
// 强调色更换,高亮等颜色已经改变,所以要重新加载图标。
|
||||
QPalette pal(backupPointManage->palette());
|
||||
pal.setColor(QPalette::ButtonText, this->palette().highlight().color());
|
||||
pal.setColor(QPalette::Button, this->palette().base().color());
|
||||
backupPointManage->setPalette(pal);
|
||||
});
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<message>
|
||||
<location filename="component/backuplistwidget.cpp" line="103"/>
|
||||
<source>File drag and drop area</source>
|
||||
<translation>拖放文件夹识别路径</translation>
|
||||
<translation>拖放文件或文件夹识别路径</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue