aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/Dial.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-09-26 09:42:34 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-09-26 12:36:52 +0000
commita98b02635aee2317b9e1f2b93ed8c7f96243b237 (patch)
treefa8446bc9e4d8b99b3cfdb0a2eb32276c16ae703 /src/imports/controls/Dial.qml
parent0074d98fbb582bbfcb923bdff514b188910be0ae (diff)
Default: make Dial use palettes
NOTE: Now that we have configurable palettes, we cannot assume that the default color of the indicator image matches the default palette color. Therefore we need to make ColorImage aware of the default color to avoid unnecessary expensive colorizing (see f0697c6). An extra QML property assignment of a constant value is much cheaper than colorizing the image. Starting from f0697c6, the indicator color has been defined like this: color: control.visualFocus ? Default.focusColor : undefined This assumes that the image has a default color of #353637 when not focused. With this, qmlbench delegates_dial.qml gives a result of 76 frames. The following options were considered: A) color: visualFocus ? palette.highlight : palette.dark => 71 frames B) color: visualFocus ? palette.highlight : palette.dark !== "#353637" ? palette.dark : "transparent" => 71 frames C) defaultColor: "#353637" color: visualFocus ? palette.highlight : palette.dark => 75 frames The last option was a clear winner. Task-number: QTBUG-63369 Change-Id: Ib8d56724de55b874d1c4ecdf0c09b91cfd2dc3df Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/controls/Dial.qml')
-rw-r--r--src/imports/controls/Dial.qml5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/imports/controls/Dial.qml b/src/imports/controls/Dial.qml
index d7b271c4..f3706fa3 100644
--- a/src/imports/controls/Dial.qml
+++ b/src/imports/controls/Dial.qml
@@ -48,7 +48,7 @@ T.Dial {
background: DialImpl {
width: control.availableWidth
height: control.availableHeight
- color: control.visualFocus ? Default.focusColor : Default.frameDarkColor
+ color: control.visualFocus ? control.palette.highlight : control.palette.dark
progress: control.position
opacity: control.enabled ? 1 : 0.3
}
@@ -59,7 +59,8 @@ T.Dial {
y: background.y + background.height / 2 - handle.height / 2
width: 14
height: 10
- color: control.visualFocus ? Default.focusColor : undefined
+ defaultColor: "#353637"
+ color: control.visualFocus ? control.palette.highlight : control.palette.dark
source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/images/dial-indicator.png"
antialiasing: true
opacity: control.enabled ? 1 : 0.3