From a98b02635aee2317b9e1f2b93ed8c7f96243b237 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 26 Sep 2017 09:42:34 +0200 Subject: 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 --- src/imports/controls/Dial.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/imports/controls/Dial.qml') 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 -- cgit v1.2.3