aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickicon_p.h
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-05-09 16:44:08 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-05-10 16:19:57 +0000
commit6c2a24a4f2695ae5565b9a5a42b04c9b68833866 (patch)
tree5373f36a6d5c54ce6c2caf386113142ed5e9fa89 /src/quicktemplates2/qquickicon_p.h
parent9947c815ea54c781bc1a9c95e26e2af1e6eebb87 (diff)
Make QQuickIcon a value type
QQuickIcon no longer inherits QObject, but becomes a light-weight implicitly shared Q_GADGET-type, that is passed by value the same way fonts and colors are. Before: SUB: OS: Fedora 25 (Workstation Edition) SUB: QPA: xcb SUB: GL_VENDOR: Intel Open Source Technology Center SUB: GL_RENDERER: Mesa DRI Intel(R) Haswell Desktop SUB: GL_VERSION: 3.0 Mesa 13.0.4 SUB: running: benchmarks/auto/creation/controls/delegates_buttoncontrol2.qml SUB: 110 frames SUB: 109 frames SUB: 109 frames SUB: 109 frames SUB: 109 frames SUB: Average: SUB: 109.2 frames; using samples; MedianAll=109; StdDev=0.447214, CoV=0.00409536 After: [...] SUB: running: benchmarks/auto/creation/controls/delegates_buttoncontrol2.qml SUB: 123 frames SUB: 124 frames SUB: 124 frames SUB: 122 frames SUB: 125 frames SUB: Average: SUB: 123.6 frames; using samples; MedianAll=124; StdDev=1.14018, CoV=0.00922472 Change-Id: I604532204fb94fc0726d0c9b8b6097f9ebc265e8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickicon_p.h')
-rw-r--r--src/quicktemplates2/qquickicon_p.h38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/quicktemplates2/qquickicon_p.h b/src/quicktemplates2/qquickicon_p.h
index 4b1557a0..6e28f2a9 100644
--- a/src/quicktemplates2/qquickicon_p.h
+++ b/src/quicktemplates2/qquickicon_p.h
@@ -49,7 +49,9 @@
//
#include <QtCore/qurl.h>
-#include <QtCore/qobject.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qobjectdefs.h>
+#include <QtCore/qshareddata.h>
#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
#include <QtGui/qcolor.h>
@@ -57,17 +59,25 @@ QT_BEGIN_NAMESPACE
class QQuickIconPrivate;
-class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickIcon : public QObject
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickIcon
{
- Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged FINAL)
- Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged FINAL)
- Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged FINAL)
- Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged FINAL)
- Q_PROPERTY(QColor color READ color WRITE setColor RESET resetColor NOTIFY colorChanged FINAL)
+ Q_GADGET
+ Q_PROPERTY(QString name READ name WRITE setName FINAL)
+ Q_PROPERTY(QUrl source READ source WRITE setSource FINAL)
+ Q_PROPERTY(int width READ width WRITE setWidth FINAL)
+ Q_PROPERTY(int height READ height WRITE setHeight FINAL)
+ Q_PROPERTY(QColor color READ color WRITE setColor RESET resetColor FINAL)
public:
- explicit QQuickIcon(QObject *parent = nullptr);
+ QQuickIcon();
+ QQuickIcon(const QQuickIcon &other);
+ ~QQuickIcon();
+
+ QQuickIcon& operator=(const QQuickIcon &other);
+ bool operator==(const QQuickIcon &other) const;
+ bool operator!=(const QQuickIcon &other) const;
+
+ bool isEmpty() const;
QString name() const;
void setName(const QString &name);
@@ -85,16 +95,8 @@ public:
void setColor(const QColor &color);
void resetColor();
-Q_SIGNALS:
- void nameChanged(const QString &name);
- void sourceChanged(const QUrl &source);
- void widthChanged(int width);
- void heightChanged(int height);
- void colorChanged(const QColor &color);
-
private:
- Q_DISABLE_COPY(QQuickIcon)
- Q_DECLARE_PRIVATE(QQuickIcon)
+ QSharedDataPointer<QQuickIconPrivate> d;
};
QT_END_NAMESPACE