aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Hartmetz <andreas.hartmetz@kdab.com>2012-11-30 16:35:45 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-30 18:46:35 +0100
commit90f28df50a51743988f8e9b9c95cfb9608239cfd (patch)
treeb666bbb1f3cea32d72d801a102a194fd95ec81b6
parentf424629374b2d04d80dde4b07f17c1f2e52fe884 (diff)
Make static QQmlProperty::read() take a const QObject pointer.
It uses the QObject in a non-const, but still logically const, way internally. Given that the compiler disregards const for code generation and that the QObject won't change in any way observable from the outside, that should not be a problem. Task-number: QTBUG-28258 Change-Id: I1a852a2597eb2ff05b421e8024e70e7ac5299627 Reviewed-by: Alan Alpert <aalpert@rim.com>
-rw-r--r--src/qml/qml/qqmlproperty.cpp12
-rw-r--r--src/qml/qml/qqmlproperty.h6
2 files changed, 9 insertions, 9 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 4f445948ba..a2bd3742aa 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -1074,9 +1074,9 @@ Return the \a name property value of \a object. This method is equivalent to:
p.read();
\endcode
*/
-QVariant QQmlProperty::read(QObject *object, const QString &name)
+QVariant QQmlProperty::read(const QObject *object, const QString &name)
{
- QQmlProperty p(object, name);
+ QQmlProperty p(const_cast<QObject *>(object), name);
return p.read();
}
@@ -1090,9 +1090,9 @@ QVariant QQmlProperty::read(QObject *object, const QString &name)
p.read();
\endcode
*/
-QVariant QQmlProperty::read(QObject *object, const QString &name, QQmlContext *ctxt)
+QVariant QQmlProperty::read(const QObject *object, const QString &name, QQmlContext *ctxt)
{
- QQmlProperty p(object, name, ctxt);
+ QQmlProperty p(const_cast<QObject *>(object), name, ctxt);
return p.read();
}
@@ -1107,9 +1107,9 @@ QVariant QQmlProperty::read(QObject *object, const QString &name, QQmlContext *c
p.read();
\endcode
*/
-QVariant QQmlProperty::read(QObject *object, const QString &name, QQmlEngine *engine)
+QVariant QQmlProperty::read(const QObject *object, const QString &name, QQmlEngine *engine)
{
- QQmlProperty p(object, name, engine);
+ QQmlProperty p(const_cast<QObject *>(object), name, engine);
return p.read();
}
diff --git a/src/qml/qml/qqmlproperty.h b/src/qml/qml/qqmlproperty.h
index d651315d13..2a688a8e93 100644
--- a/src/qml/qml/qqmlproperty.h
+++ b/src/qml/qml/qqmlproperty.h
@@ -100,9 +100,9 @@ public:
QString name() const;
QVariant read() const;
- static QVariant read(QObject *, const QString &);
- static QVariant read(QObject *, const QString &, QQmlContext *);
- static QVariant read(QObject *, const QString &, QQmlEngine *);
+ static QVariant read(const QObject *, const QString &);
+ static QVariant read(const QObject *, const QString &, QQmlContext *);
+ static QVariant read(const QObject *, const QString &, QQmlEngine *);
bool write(const QVariant &) const;
static bool write(QObject *, const QString &, const QVariant &);