QmlDesigner: Apply theming to transient scrollbars

Change-Id: Iea76d981447f2367615ce624da399ecb984cb662
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2023-09-01 15:53:39 +02:00
committed by Henning Gründl
parent b2ee8acafa
commit f4466ed7b6
8 changed files with 21 additions and 13 deletions

View File

@@ -8,6 +8,8 @@ import StudioTheme 1.0 as StudioTheme
T.ScrollBar {
id: control
property StudioTheme.ControlStyle style: StudioTheme.Values.controlStyle
property bool show: false
property bool otherInUse: false
property bool isNeeded: control.size < 1.0
@@ -31,12 +33,12 @@ T.ScrollBar {
implicitWidth: control.thickness
implicitHeight: control.thickness
radius: width / 2
color: "#D9D9D9"
color: control.inUse ? control.style.scrollBar.handleHover : control.style.scrollBar.handle
}
background: Rectangle {
id: controlTrack
color: "#D9D9D9"
color: control.style.scrollBar.track
opacity: control.inUse || control.otherInUse ? 0.3 : 0.0
radius: width / 2

View File

@@ -150,7 +150,8 @@ QtObject {
component ScrollBarColors: QtObject {
property color track: Values.themeScrollBarTrack
property color handle: Values.themeScrollBarHandle
property color handle: Values.themeScrollBarHandle_idle
property color handleHover: Values.themeScrollBarHandle
}
property ScrollBarColors scrollBar: ScrollBarColors {}

View File

@@ -383,6 +383,7 @@ QtObject {
property color themeScrollBarTrack: Theme.color(Theme.DSscrollBarTrack)
property color themeScrollBarHandle: Theme.color(Theme.DSscrollBarHandle)
property color themeScrollBarHandle_idle: Theme.color(Theme.DSscrollBarHandle_idle)
property color themeSectionHeadBackground: Theme.color(Theme.DSsectionHeadBackground)

View File

@@ -21,7 +21,7 @@ QtObject {
pixelSize: Qt.application.font.pixelSize * 1.6
})
readonly property color backgroundColor: "#c2c2c2"
readonly property color backgroundColor: "#EAEAEA"
@if %{IsQt6Project}

View File

@@ -169,8 +169,9 @@ DSsliderHandleHover=ff606060
DSsliderHandleFocus=ff0492c9
DSsliderHandleInteraction=ff2aafd3
DSscrollBarTrack=ffb5b4b4
DSscrollBarHandle=ff9b9b9b
DSscrollBarTrack=smokeGrey
DSscrollBarHandle=shadowGrey
DSscrollBarHandle_idle=slateGrey
DSsectionHeadBackground=ffd8d8d8

View File

@@ -135,8 +135,9 @@ DSnavigatorTextSelected=highlightBlue
QmlDesigner_BackgroundColorDarkAlternate=dawnGrey
;TODO
DSscrollBarTrack=dawnGrey
DSscrollBarHandle=offBlack
DSscrollBarTrack=smokeGrey
DSscrollBarHandle=concreteGrey
DSscrollBarHandle_idle=slateGrey
DSdockWidgetTitleBar=dawnGrey
DSdockWidgetSplitter=fullBlack

View File

@@ -342,6 +342,9 @@ public:
DSpopoutButtonBorder_hover,
DSpopoutButtonBorder_interaction,
DSpopoutButtonBorder_disabled,
DSscrollBarTrack,
DSscrollBarHandle,
DSscrollBarHandle_idle,
/*Legacy QtDS*/
DSiconColor,
@@ -365,8 +368,6 @@ public:
DSsliderHandleHover,
DSsliderHandleFocus,
DSsliderHandleInteraction,
DSscrollBarTrack,
DSscrollBarHandle,
DSsectionHeadBackground,
DSstateDefaultHighlight,
DSstateSeparatorColor,

View File

@@ -736,7 +736,8 @@ void StudioStyle::drawComplexControl(
bool enabled = scrollBar->state & QStyle::State_Enabled;
bool hovered = enabled && scrollBar->state & QStyle::State_MouseOver;
QColor buttonColor = hovered ? "#D9D9D9" : "#9B9B9B";
QColor buttonColor = creatorTheme()->color(hovered ? Theme::DSscrollBarHandle
: Theme::DSscrollBarHandle_idle);
QColor gradientStartColor = buttonColor.lighter(118);
QColor gradientStopColor = buttonColor;
if (hasTransientStyle) {
@@ -755,12 +756,12 @@ void StudioStyle::drawComplexControl(
painter->save();
painter->setPen(Qt::NoPen);
if (hasTransientStyle) {
QColor brushColor("#D9D9D9");
QColor brushColor(creatorTheme()->color(Theme::DSscrollBarTrack));
brushColor.setAlpha(0.3 * 255);
painter->setBrush(QBrush(brushColor));
painter->drawRoundedRect(scrollBarGroove, 4, 4);
} else {
painter->setBrush(QBrush("#773E3E"));
painter->setBrush(QBrush(creatorTheme()->color(Theme::DSscrollBarTrack)));
painter->drawRect(rect);
}
painter->restore();