diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-08-30 13:29:00 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-08-30 12:29:25 +0000 |
commit | f0697c622ab087faa19679725250c0ac7f79372d (patch) | |
tree | 1352e89c391404af361ef2949b7c0ac9da27ca7e /src/quickcontrols2 | |
parent | 31d90e308e46d644d74e9434ce31dd664677bc59 (diff) |
ColorImage: colorize only if needed
QQuickColorImageProvider got replaced by QQuickColorImage in 9fc3659.
This seems to have introduced a performance regression in several
controls that are now colorizing images even when there's no need to.
Various indicator images have the correct default color that matches
the normal state. They need to be colorized only when gaining focus
or being disabled, for example.
The improvement in qmlbench results:
- CheckBox: 70 => 84 frames
- ComboBox: 88 => 92 frames
- Dial: 73 => 77 frames
- MenuItem: 73 => 84 frames
Change-Id: I9155042542f5069cff201a1730b9dd2a62cffd67
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quickcontrols2')
-rw-r--r-- | src/quickcontrols2/qquickcolorimage.cpp | 5 | ||||
-rw-r--r-- | src/quickcontrols2/qquickcolorimage_p.h | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/quickcontrols2/qquickcolorimage.cpp b/src/quickcontrols2/qquickcolorimage.cpp index 430ba6ea..9358c3ca 100644 --- a/src/quickcontrols2/qquickcolorimage.cpp +++ b/src/quickcontrols2/qquickcolorimage.cpp @@ -61,6 +61,11 @@ void QQuickColorImage::setColor(const QColor &color) emit colorChanged(); } +void QQuickColorImage::resetColor() +{ + setColor(Qt::transparent); +} + void QQuickColorImage::pixmapChange() { QQuickImage::pixmapChange(); diff --git a/src/quickcontrols2/qquickcolorimage_p.h b/src/quickcontrols2/qquickcolorimage_p.h index 8b0f769d..6de2e21b 100644 --- a/src/quickcontrols2/qquickcolorimage_p.h +++ b/src/quickcontrols2/qquickcolorimage_p.h @@ -57,13 +57,14 @@ QT_BEGIN_NAMESPACE class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickColorImage : public QQuickImage { Q_OBJECT - Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged FINAL) + Q_PROPERTY(QColor color READ color WRITE setColor RESET resetColor NOTIFY colorChanged FINAL) public: explicit QQuickColorImage(QQuickItem *parent = nullptr); QColor color() const; void setColor(const QColor &color); + void resetColor(); Q_SIGNALS: void colorChanged(); |