aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2/qquickcolorimage_p.h
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/quickcontrols2/qquickcolorimage_p.h
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/quickcontrols2/qquickcolorimage_p.h')
-rw-r--r--src/quickcontrols2/qquickcolorimage_p.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/quickcontrols2/qquickcolorimage_p.h b/src/quickcontrols2/qquickcolorimage_p.h
index 6de2e21b..873bc2db 100644
--- a/src/quickcontrols2/qquickcolorimage_p.h
+++ b/src/quickcontrols2/qquickcolorimage_p.h
@@ -58,6 +58,7 @@ class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickColorImage : public QQuickImage
{
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor RESET resetColor NOTIFY colorChanged FINAL)
+ Q_PROPERTY(QColor defaultColor READ defaultColor WRITE setDefaultColor RESET resetDefaultColor NOTIFY defaultColorChanged FINAL)
public:
explicit QQuickColorImage(QQuickItem *parent = nullptr);
@@ -66,14 +67,20 @@ public:
void setColor(const QColor &color);
void resetColor();
+ QColor defaultColor() const;
+ void setDefaultColor(const QColor &color);
+ void resetDefaultColor();
+
Q_SIGNALS:
void colorChanged();
+ void defaultColorChanged();
protected:
void pixmapChange() override;
private:
QColor m_color;
+ QColor m_defaultColor;
};
QT_END_NAMESPACE