forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -45,4 +45,9 @@ void DummyContextObject::setParentDummy(QObject *parentDummy)
|
||||
}
|
||||
}
|
||||
|
||||
bool DummyContextObject::runningInDesigner() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user