forked from qt-creator/qt-creator
QmlDesigner: Quick fix for Popup
This is a quickfix for Controls 2 Popup, Drawer, Menu and Dialog. We pretend everything derived from QtQuick.Controls.Popup is an item instead of a QQObject. Change-Id: I603dce8a1a1b08df3e2c1dccc0fa57e7ccef0800 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -605,14 +605,22 @@ ObjectNodeInstance::Pointer ObjectNodeInstance::create(QObject *object)
|
|||||||
|
|
||||||
QObject *ObjectNodeInstance::createPrimitive(const QString &typeName, int majorNumber, int minorNumber, QQmlContext *context)
|
QObject *ObjectNodeInstance::createPrimitive(const QString &typeName, int majorNumber, int minorNumber, QQmlContext *context)
|
||||||
{
|
{
|
||||||
QObject *object = QmlPrivateGate::createPrimitive(typeName, majorNumber, minorNumber, context);
|
QString polishTypeName = typeName;
|
||||||
|
if (typeName == "QtQuick.Controls/Popup"
|
||||||
|
|| typeName == "QtQuick.Controls/Drawer"
|
||||||
|
|| typeName == "QtQuick.Controls/Dialog"
|
||||||
|
|| typeName == "QtQuick.Controls/Menu"
|
||||||
|
|| typeName == "QtQuick.Controls/ToolTip")
|
||||||
|
polishTypeName = "QtQuick/Item";
|
||||||
|
|
||||||
|
QObject *object = QmlPrivateGate::createPrimitive(polishTypeName, majorNumber, minorNumber, context);
|
||||||
|
|
||||||
/* Let's try to create the primitive from source, since with incomplete meta info this might be a pure
|
/* Let's try to create the primitive from source, since with incomplete meta info this might be a pure
|
||||||
* QML type. This is the case for example if a C++ type is mocked up with a QML file.
|
* QML type. This is the case for example if a C++ type is mocked up with a QML file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!object)
|
if (!object)
|
||||||
object = createPrimitiveFromSource(typeName, majorNumber, minorNumber, context);
|
object = createPrimitiveFromSource(polishTypeName, majorNumber, minorNumber, context);
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1560,7 +1560,9 @@ bool NodeMetaInfo::isSubclassOf(const TypeName &type, int majorVersion, int mino
|
|||||||
|
|
||||||
bool NodeMetaInfo::isGraphicalItem() const
|
bool NodeMetaInfo::isGraphicalItem() const
|
||||||
{
|
{
|
||||||
return isSubclassOf("QtQuick.Item") || isSubclassOf("QtQuick.Window.Window");
|
return isSubclassOf("QtQuick.Item")
|
||||||
|
|| isSubclassOf("QtQuick.Window.Window")
|
||||||
|
|| isSubclassOf("QtQuick.Controls.Popup");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeMetaInfo::clearCache()
|
void NodeMetaInfo::clearCache()
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ bool QmlItemNode::isItemOrWindow(const ModelNode &modelNode)
|
|||||||
if (modelNode.metaInfo().isSubclassOf("QtQuick.Window.Window") && modelNode.isRootNode())
|
if (modelNode.metaInfo().isSubclassOf("QtQuick.Window.Window") && modelNode.isRootNode())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (modelNode.metaInfo().isSubclassOf("QtQuick.Controls.Popup"))
|
||||||
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user