From 90f28df50a51743988f8e9b9c95cfb9608239cfd Mon Sep 17 00:00:00 2001 From: Andreas Hartmetz Date: Fri, 30 Nov 2012 16:35:45 +0100 Subject: 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 --- src/qml/qml/qqmlproperty.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/qml/qml/qqmlproperty.cpp') 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(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(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(object), name, engine); return p.read(); } -- cgit v1.2.3