summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2017-05-04 13:23:03 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2017-05-04 12:34:32 +0000
commitcf3454d7fdefc67dc51d75748e595faf660631fb (patch)
tree961569131916d75079cedf101803349aa36a6d7d
parentface7b13cd08c73dc3f300acf15bc7cb1adedaab (diff)
downloadqt-creator-cf3454d7fdefc67dc51d75748e595faf660631fb.tar.gz
QmlDesigner: Add flag to check for designer
The property runningInDesigner can be checked to find out if a component is running in the designer. Change-Id: Ibf35daba4bb30c7d919b1ff149c92b348d7e8059 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/dummycontextobject.cpp5
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/dummycontextobject.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/dummycontextobject.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/dummycontextobject.cpp
index 6026e22242..ac2089a44d 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/dummycontextobject.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/dummycontextobject.cpp
@@ -45,4 +45,9 @@ void DummyContextObject::setParentDummy(QObject *parentDummy)
}
}
+bool DummyContextObject::runningInDesigner() const
+{
+ return true;
+}
+
} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/dummycontextobject.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/dummycontextobject.h
index 73320dfcf6..a5257a2086 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/dummycontextobject.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/dummycontextobject.h
@@ -35,12 +35,14 @@ class DummyContextObject : public QObject
{
Q_OBJECT
Q_PROPERTY(QObject * parent READ parentDummy WRITE setParentDummy NOTIFY parentDummyChanged DESIGNABLE false FINAL)
+ Q_PROPERTY(bool runningInDesigner READ runningInDesigner FINAL)
public:
explicit DummyContextObject(QObject *parent = 0);
QObject *parentDummy() const;
void setParentDummy(QObject *parentDummy);
+ bool runningInDesigner() const;
signals:
void parentDummyChanged();