diff options
Diffstat (limited to 'src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp')
-rw-r--r-- | src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index 41bc1944ca..94814b7436 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -91,7 +91,12 @@ QStringList globalQtEnums() "Horizontal", "Vertical", "AlignVCenter", "AlignLeft", "LeftToRight", "RightToLeft", "AlignHCenter", "AlignRight", "AlignBottom", "AlignBaseline", "AlignTop", "BottomLeft", "LeftEdge", "RightEdge", "BottomEdge", "TopEdge", "TabFocus", "ClickFocus", "StrongFocus", - "WheelFocus", "NoFocus" + "WheelFocus", "NoFocus", "ArrowCursor", "UpArrowCursor", "CrossCursor", "WaitCursor", + "IBeamCursor", "SizeVerCursor", "SizeHorCursor", "SizeBDiagCursor", "SizeFDiagCursor", + "SizeAllCursor", "BlankCursor", "SplitVCursor", "SplitHCursor", "PointingHandCursor", + "ForbiddenCursor", "WhatsThisCursor", "BusyCursor", "OpenHandCursor", "ClosedHandCursor", + "DragCopyCursor", "DragMoveCursor", "DragLinkCursor", "TopToBottom", + "LeftButton", "RightButton", "MiddleButton", "BackButton", "ForwardButton", "AllButtons" }; return list; @@ -101,7 +106,7 @@ QStringList knownEnumScopes() { static const QStringList list = { "TextInput", "TextEdit", "Material", "Universal", "Font", "Shape", "ShapePath", - "AbstractButton", "Text", "ShaderEffectSource" + "AbstractButton", "Text", "ShaderEffectSource", "Grid" }; return list; } @@ -306,7 +311,7 @@ bool isPropertyChangesType(const QmlDesigner::TypeName &type) bool isConnectionsType(const QmlDesigner::TypeName &type) { - return type == "Connections" || type == "QtQuick.Connections" || type == "Qt.Connections"; + return type == "Connections" || type == "QtQuick.Connections" || type == "Qt.Connections" || type == "QtQml.Connections"; } bool propertyIsComponentType(const QmlDesigner::NodeAbstractProperty &property, const QmlDesigner::TypeName &type, QmlDesigner::Model *model) @@ -1014,7 +1019,7 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH } - m_vContext = ModelManagerInterface::instance()->defaultVContext(Dialect::Qml, m_document); + m_vContext = ModelManagerInterface::instance()->projectVContext(Dialect::Qml, m_document); ReadingContext ctxt(snapshot, m_document, m_vContext); m_scopeChain = QSharedPointer<const ScopeChain>( new ScopeChain(ctxt.scopeChain())); @@ -2171,6 +2176,37 @@ QSet<QPair<QString, QString> > TextToModelMerger::qrcMapping() const return m_qrcMapping; } +QList<QmlTypeData> TextToModelMerger::getQMLSingletons() const +{ + QList<QmlTypeData> list; + const QmlJS::Imports *imports = m_scopeChain->context()->imports( + m_scopeChain->document().data()); + + if (!imports) + return list; + + for (const QmlJS::Import &import : imports->all()) { + if (import.info.type() == ImportType::Library && !import.libraryPath.isEmpty()) { + const LibraryInfo &libraryInfo = m_scopeChain->context()->snapshot().libraryInfo( + import.libraryPath); + + for (const QmlDirParser::Component &component : libraryInfo.components()) { + if (component.singleton) { + QmlTypeData qmlData; + + qmlData.typeName = component.typeName; + qmlData.importUrl = import.info.name(); + qmlData.versionString = import.info.version().toString(); + qmlData.isSingleton = component.singleton; + + list.append(qmlData); + } + } + } + } + return list; +} + QString TextToModelMerger::textAt(const Document::Ptr &doc, const SourceLocation &location) { |