Commit 6e30faba authored by Thomas Hartmann's avatar Thomas Hartmann

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's avatarTim Jenssen <tim.jenssen@qt.io>
parent 68130c5f
...@@ -605,14 +605,22 @@ ObjectNodeInstance::Pointer ObjectNodeInstance::create(QObject *object) ...@@ -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 ...@@ -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) ...@@ -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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment