mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-06-22 22:23:49 +08:00
加入ColorSet的enum方便获取,SpkLoading使用主题色
This commit is contained in:
+2
-1
@@ -2,6 +2,7 @@
|
|||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "spkloading.h"
|
#include "spkloading.h"
|
||||||
|
#include "spkui_general.h"
|
||||||
|
|
||||||
SpkLoading::SpkLoading(QWidget *parent) : QWidget(parent)
|
SpkLoading::SpkLoading(QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
@@ -19,7 +20,7 @@ void SpkLoading::paintEvent(QPaintEvent *e)
|
|||||||
{
|
{
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
QPen pen(Qt::NoPen);
|
QPen pen(Qt::NoPen);
|
||||||
QBrush b({ 0, 0x7b, 0xff }, Qt::SolidPattern); // TODO: Customizable accent color
|
QBrush b(SpkUi::CurrentColorSet[SpkUi::AccentColor], Qt::SolidPattern);
|
||||||
p.setBrush(b);
|
p.setBrush(b);
|
||||||
p.setPen(pen);
|
p.setPen(pen);
|
||||||
p.setRenderHint(QPainter::Antialiasing);
|
p.setRenderHint(QPainter::Antialiasing);
|
||||||
|
|||||||
@@ -268,9 +268,9 @@ namespace SpkUi
|
|||||||
|
|
||||||
void UiMetaObject::SetAccentColor(QColor aColor)
|
void UiMetaObject::SetAccentColor(QColor aColor)
|
||||||
{
|
{
|
||||||
CurrentColorSet[3] = aColor.lighter(80);
|
CurrentColorSet[AccentColor] = aColor.lighter(80);
|
||||||
CurrentColorSet[4] = aColor;
|
CurrentColorSet[AccentColorHighlighted] = aColor;
|
||||||
CurrentColorSet[10] = ColorTextOnBackground(aColor);
|
CurrentColorSet[TextOnAccentColor] = ColorTextOnBackground(aColor);
|
||||||
qApp->setStyleSheet(StylesheetFromColors(CurrentColorSet));
|
qApp->setStyleSheet(StylesheetFromColors(CurrentColorSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,23 @@ namespace SpkUi
|
|||||||
{
|
{
|
||||||
enum SpkUiStyle { Light, Dark };
|
enum SpkUiStyle { Light, Dark };
|
||||||
enum SpkButtonStyle { Normal = 0, Recommend, Warn };
|
enum SpkButtonStyle { Normal = 0, Recommend, Warn };
|
||||||
|
enum ColorSetIndex
|
||||||
|
{
|
||||||
|
GlobalBgnd = 0,
|
||||||
|
ControlsBgnd,
|
||||||
|
ControlsBgndHighlighted,
|
||||||
|
SelectionBgnd, AccentColor = SelectionBgnd,
|
||||||
|
SelectionBgndHighlighted, AccentColorHighlighted = SelectionBgndHighlighted,
|
||||||
|
LightCtrlsGradLight,
|
||||||
|
LightCtrlsGradDark,
|
||||||
|
LightCtrlsGradDarker,
|
||||||
|
DarkCtrlsGradLight,
|
||||||
|
DarkCtrlsGradDark,
|
||||||
|
TextOnSelection, TextOnAccentColor = TextOnSelection,
|
||||||
|
TextOnGlobalBgnd,
|
||||||
|
TextOnControlsBgnd,
|
||||||
|
TextLighter
|
||||||
|
};
|
||||||
|
|
||||||
class SpkPopup;
|
class SpkPopup;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user