From a62416550d92537ba4452efbdc499630265df8f9 Mon Sep 17 00:00:00 2001 From: hewenfei Date: Tue, 27 Jun 2023 16:19:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=89=E6=80=81=E9=A2=9C?= =?UTF-8?q?=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qml/AppControls2/AppItem.qml | 1 + qml/AppUI/AppPage.qml | 3 +-- src/uiconfig/theme-palette.cpp | 7 +++++++ src/uiconfig/theme-palette.h | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/qml/AppControls2/AppItem.qml b/qml/AppControls2/AppItem.qml index 2d7207c..1027465 100644 --- a/qml/AppControls2/AppItem.qml +++ b/qml/AppControls2/AppItem.qml @@ -19,6 +19,7 @@ MouseArea { anchors.fill: parent radius: 4 useStyleTransparent: false + paletteRole: Palette.Light alpha: isSelect ? 1.00 : control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00 ToolTip.visible: content.textTruncated && control.containsMouse ToolTip.text: name diff --git a/qml/AppUI/AppPage.qml b/qml/AppUI/AppPage.qml index 181d5bb..6234cee 100644 --- a/qml/AppUI/AppPage.qml +++ b/qml/AppUI/AppPage.qml @@ -18,12 +18,11 @@ import QtQuick 2.12 import QtQuick.Layouts 1.12 -import QtQuick.Controls 2.5 +import QtQuick.Controls 2.12 import AppControls2 1.0 as AppControls2 import org.ukui.menu.core 1.0 AppControls2.StyleBackground { - paletteRole: Palette.Window radius: 12 property alias header: appPageHeader property alias content: appPageContent diff --git a/src/uiconfig/theme-palette.cpp b/src/uiconfig/theme-palette.cpp index 05bb1a9..e687364 100644 --- a/src/uiconfig/theme-palette.cpp +++ b/src/uiconfig/theme-palette.cpp @@ -56,6 +56,8 @@ QColor ThemePalette::paletteColor(Palette::ColorRole colorRole, Palette::ColorGr return base(colorGroup); case Palette::Text: return text(colorGroup); + case Palette::BrightText: + return brightText(colorGroup); case Palette::AlternateBase: return alternateBase(colorGroup); case Palette::Button: @@ -111,6 +113,11 @@ QColor ThemePalette::text(Palette::ColorGroup colorGroup) const return QGuiApplication::palette().color(switchColorGroup(colorGroup), QPalette::Text); } +QColor ThemePalette::brightText(Palette::ColorGroup colorGroup) const +{ + return QGuiApplication::palette().color(switchColorGroup(colorGroup), QPalette::BrightText); +} + QColor ThemePalette::base(Palette::ColorGroup colorGroup) const { return QGuiApplication::palette().color(switchColorGroup(colorGroup), QPalette::Base); diff --git a/src/uiconfig/theme-palette.h b/src/uiconfig/theme-palette.h index a558546..95272cb 100644 --- a/src/uiconfig/theme-palette.h +++ b/src/uiconfig/theme-palette.h @@ -38,7 +38,7 @@ public: Q_ENUM(ColorGroup) enum ColorRole { - Window, WindowText, Base, Text, AlternateBase, + Window, WindowText, Base, BrightText, Text, AlternateBase, Button, ButtonText, Light, MidLight, Dark, Mid, Shadow, Highlight, HighlightedText }; @@ -80,6 +80,7 @@ public: Q_INVOKABLE QColor windowText(Palette::ColorGroup colorGroup = Palette::Active) const; Q_INVOKABLE QColor base(Palette::ColorGroup colorGroup = Palette::Active) const; Q_INVOKABLE QColor text(Palette::ColorGroup colorGroup = Palette::Active) const; + Q_INVOKABLE QColor brightText(Palette::ColorGroup colorGroup = Palette::Active) const; Q_INVOKABLE QColor alternateBase(Palette::ColorGroup colorGroup = Palette::Active) const; Q_INVOKABLE QColor button(Palette::ColorGroup colorGroup = Palette::Active) const; Q_INVOKABLE QColor buttonText(Palette::ColorGroup colorGroup = Palette::Active) const;