diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-04-21 17:30:01 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-04-24 09:01:21 +0000 |
commit | 46cd10b3a5be2557d40336ca5cc236690ce8398a (patch) | |
tree | 80f080b7584a0565f6b69dd94666f21a7f9f3fc5 /src/quicktemplates2/qquickicon_p.h | |
parent | 2aa0c5015e26e1374f6b24ee7023adc58e380403 (diff) |
QQuickIcon: fix the type of the source property
For example, something like:
Button {
icon.source: "../images/drawer.png"
}
did not work in the Gallery example, even though it works fine for
Image elements etc. The URL needs to be resolved relative to the
caller. By making the property an URL instead of a plain string,
the QML engine does the correct thing automatically.
Note: icon.source.length no longer works in auto tests, so it got
replaced by a compare().
Change-Id: I5fdb3aa55003d2f04e5458b7636e4dae3fa9857c
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickicon_p.h')
-rw-r--r-- | src/quicktemplates2/qquickicon_p.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/quicktemplates2/qquickicon_p.h b/src/quicktemplates2/qquickicon_p.h index d4790579..4b1557a0 100644 --- a/src/quicktemplates2/qquickicon_p.h +++ b/src/quicktemplates2/qquickicon_p.h @@ -48,6 +48,7 @@ // We mean it. // +#include <QtCore/qurl.h> #include <QtCore/qobject.h> #include <QtQuickTemplates2/private/qtquicktemplates2global_p.h> #include <QtGui/qcolor.h> @@ -60,7 +61,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickIcon : public QObject { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged FINAL) - Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged 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) @@ -71,8 +72,8 @@ public: QString name() const; void setName(const QString &name); - QString source() const; - void setSource(const QString &source); + QUrl source() const; + void setSource(const QUrl &source); int width() const; void setWidth(int width); @@ -86,7 +87,7 @@ public: Q_SIGNALS: void nameChanged(const QString &name); - void sourceChanged(const QString &source); + void sourceChanged(const QUrl &source); void widthChanged(int width); void heightChanged(int height); void colorChanged(const QColor &color); |