diff options
Diffstat (limited to 'src/plugins/qmldesigner/designercore')
9 files changed, 291 insertions, 54 deletions
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp index 2d60729a61..e1384e6eb2 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp @@ -488,7 +488,7 @@ InformationName NodeInstance::setInformationIsInLayoutable(bool isInLayoutable) InformationName NodeInstance::setInformationSceneTransform(const QTransform &sceneTransform) { - if (!directUpdates() && d->sceneTransform != sceneTransform) { + if (d->sceneTransform != sceneTransform) { d->sceneTransform = sceneTransform; return SceneTransform; } diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp index 8c265dd0e4..a45fbcd589 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp @@ -101,8 +101,8 @@ static bool hasQtQuick1(NodeInstanceView *nodeInstanceView) static void showCannotConnectToPuppetWarningAndSwitchToEditMode() { QmlDesignerWarning::show(QCoreApplication::translate("NodeInstanceServerProxy", "Cannot Connect to QML Emulation Layer (QML Puppet)"), - QCoreApplication::translate("NodeInstanceServerProxy", "The executable of the QML emulation layer (QML Puppet) process is maybe hanging. " - "Switching to an other kit maybe helps.")); + QCoreApplication::translate("NodeInstanceServerProxy", "The executable of the QML emulation layer (QML Puppet) may not be responding. " + "Switching to another kit might help.")); QmlDesignerPlugin::instance()->switchToTextModeDeferred(); @@ -201,7 +201,7 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV } else { QmlDesignerWarning::show(tr("Cannot Start QML Emulation Layer (QML Puppet)"), - tr("The executable of the QML emulation layer (QML Puppet) process cannot be started or is hanging.")); + tr("The executable of the QML emulation layer (QML Puppet) process cannot be started or does not respond.")); QmlDesignerPlugin::instance()->switchToTextModeDeferred(); } @@ -525,7 +525,7 @@ void NodeInstanceServerProxy::readThirdDataStream() void NodeInstanceServerProxy::printEditorProcessOutput() { - while (m_qmlPuppetEditorProcess->canReadLine()) { + while (m_qmlPuppetEditorProcess && m_qmlPuppetEditorProcess->canReadLine()) { QByteArray line = m_qmlPuppetEditorProcess->readLine(); line.chop(1); qDebug().nospace() << "Editor Puppet: " << qPrintable(line); @@ -535,7 +535,7 @@ void NodeInstanceServerProxy::printEditorProcessOutput() void NodeInstanceServerProxy::printPreviewProcessOutput() { - while (m_qmlPuppetPreviewProcess->canReadLine()) { + while (m_qmlPuppetPreviewProcess && m_qmlPuppetPreviewProcess->canReadLine()) { QByteArray line = m_qmlPuppetPreviewProcess->readLine(); line.chop(1); qDebug().nospace() << "Preview Puppet: " << qPrintable(line); @@ -545,7 +545,7 @@ void NodeInstanceServerProxy::printPreviewProcessOutput() void NodeInstanceServerProxy::printRenderProcessOutput() { - while (m_qmlPuppetRenderProcess->canReadLine()) { + while (m_qmlPuppetRenderProcess && m_qmlPuppetRenderProcess->canReadLine()) { QByteArray line = m_qmlPuppetRenderProcess->readLine(); line.chop(1); qDebug().nospace() << "Render Puppet: " << qPrintable(line); diff --git a/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.cpp b/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.cpp index adf6c5ec7a..4bcd929159 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.cpp +++ b/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.cpp @@ -41,11 +41,13 @@ namespace QmlDesigner { PuppetBuildProgressDialog::PuppetBuildProgressDialog() : QDialog(Core::ICore::dialogParent()), ui(new Ui::PuppetBuildProgressDialog), - m_lineCount(0) + m_lineCount(0), + m_useFallbackPuppet(false) { setWindowFlags(Qt::SplashScreen); ui->setupUi(this); ui->buildProgressBar->setMaximum(85); + connect(ui->useFallbackPuppetPushButton, SIGNAL(clicked()), this, SLOT(setUseFallbackPuppet())); } PuppetBuildProgressDialog::~PuppetBuildProgressDialog() @@ -56,7 +58,17 @@ PuppetBuildProgressDialog::~PuppetBuildProgressDialog() void PuppetBuildProgressDialog::setProgress(int progress) { ui->buildProgressBar->setValue(progress); - QApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); + QApplication::processEvents(QEventLoop::ExcludeSocketNotifiers); +} + +bool PuppetBuildProgressDialog::useFallbackPuppet() const +{ + return m_useFallbackPuppet; +} + +void PuppetBuildProgressDialog::setUseFallbackPuppet() +{ + m_useFallbackPuppet = true; } void PuppetBuildProgressDialog::newBuildOutput(const QByteArray &standardOutput) diff --git a/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.h b/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.h index 0f20985194..5437e4766e 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.h +++ b/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.h @@ -49,12 +49,16 @@ public: ~PuppetBuildProgressDialog(); void setProgress(int progress); - void newBuildOutput(const QByteArray &standardOutput); + bool useFallbackPuppet() const; + +private slots: + void setUseFallbackPuppet(); private: Ui::PuppetBuildProgressDialog *ui; int m_lineCount; + bool m_useFallbackPuppet; }; } diff --git a/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.ui b/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.ui index 0825b53043..3ef3ba9da0 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.ui +++ b/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>609</width> - <height>67</height> + <width>695</width> + <height>99</height> </rect> </property> <property name="windowTitle"> @@ -31,6 +31,33 @@ </property> </widget> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="useFallbackPuppetPushButton"> + <property name="text"> + <string>Use fallback QML emulation layer</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> </layout> </widget> <resources/> diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp index f7e69c674e..48096c6d03 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp @@ -78,6 +78,31 @@ QDateTime PuppetCreator::qtLastModified() const return QDateTime(); } +QDateTime PuppetCreator::puppetSourceLastModified() const +{ + QString basePuppetSourcePath = puppetSourceDirectoryPath(); + QStringList sourceDirectoryPathes; + QDateTime lastModified; + + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/commands")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/container")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/instances")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/interfaces")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/types")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/qmlpuppet")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/qmlpuppet/instances")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/qml2puppet")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/qml2puppet/instances")); + + foreach (const QString directoryPath, sourceDirectoryPathes) { + QDateTime directoryPathLastModified = QFileInfo(directoryPath).lastModified(); + if (lastModified < directoryPathLastModified) + lastModified = directoryPathLastModified; + } + + return lastModified; +} + PuppetCreator::PuppetCreator(ProjectExplorer::Kit *kit, const QString &qtCreatorVersion) : m_qtCreatorVersion(qtCreatorVersion), m_kit(kit), @@ -101,9 +126,9 @@ QProcess *PuppetCreator::createPuppetProcess(PuppetCreator::QmlPuppetVersion pup { QString puppetPath; if (puppetVersion == Qml1Puppet) - puppetPath = qmlpuppetPath(m_availablePuppetType); + puppetPath = qmlPuppetPath(m_availablePuppetType); else - puppetPath = qml2puppetPath(m_availablePuppetType); + puppetPath = qml2PuppetPath(m_availablePuppetType); return puppetProcess(puppetPath, puppetMode, @@ -165,12 +190,12 @@ bool PuppetCreator::build(const QString &qmlPuppetProjectFilePath) const QStringList qmakeArguments; qmakeArguments.append(QStringLiteral("-r")); qmakeArguments.append(QStringLiteral("-after")); - qmakeArguments.append(QStringLiteral("DESTDIR=") + qmlpuppetDirectory(UserSpacePuppet)); + qmakeArguments.append(QStringLiteral("DESTDIR=") + qmlPuppetDirectory(UserSpacePuppet)); #ifndef QT_DEBUG qmakeArguments.append(QStringLiteral("CONFIG+=release")); #endif qmakeArguments.append(qmlPuppetProjectFilePath); - buildSucceeded = startBuildProcess(buildDirectory.path(), qmakeCommand(), qmakeArguments); + buildSucceeded = startBuildProcess(buildDirectory.path(), qmakeCommand(), qmakeArguments, &progressDialog); if (buildSucceeded) { progressDialog.show(); QString buildingCommand = buildCommand(); @@ -223,7 +248,7 @@ void PuppetCreator::createQml1PuppetExecutableIfMissing() } else { if (m_kit->isValid()) { - bool buildSucceeded = build(qmlpuppetProjectFile()); + bool buildSucceeded = build(qmlPuppetProjectFile()); if (buildSucceeded) m_availablePuppetType = UserSpacePuppet; else @@ -245,11 +270,11 @@ void PuppetCreator::createQml2PuppetExecutableIfMissing() if (m_qml2PuppetForKitPuppetHash.contains(m_kit->id())) { m_availablePuppetType = m_qml2PuppetForKitPuppetHash.value(m_kit->id()); - } else if (checkQml2puppetIsReady()) { + } else if (checkQml2PuppetIsReady()) { m_availablePuppetType = UserSpacePuppet; } else { if (m_kit->isValid()) { - bool buildSucceeded = build(qml2puppetProjectFile()); + bool buildSucceeded = build(qml2PuppetProjectFile()); if (buildSucceeded) m_availablePuppetType = UserSpacePuppet; else @@ -265,7 +290,7 @@ void PuppetCreator::createQml2PuppetExecutableIfMissing() } } -QString PuppetCreator::qmlpuppetDirectory(PuppetType puppetType) const +QString PuppetCreator::qmlPuppetDirectory(PuppetType puppetType) const { if (puppetType == UserSpacePuppet) @@ -275,22 +300,22 @@ QString PuppetCreator::qmlpuppetDirectory(PuppetType puppetType) const + qtHash(); - return qmlpuppetFallbackDirectory(); + return qmlPuppetFallbackDirectory(); } -QString PuppetCreator::qmlpuppetFallbackDirectory() const +QString PuppetCreator::qmlPuppetFallbackDirectory() const { return QCoreApplication::applicationDirPath(); } -QString PuppetCreator::qml2puppetPath(PuppetType puppetType) const +QString PuppetCreator::qml2PuppetPath(PuppetType puppetType) const { - return qmlpuppetDirectory(puppetType) + QStringLiteral("/qml2puppet") + QStringLiteral(QTC_HOST_EXE_SUFFIX); + return qmlPuppetDirectory(puppetType) + QStringLiteral("/qml2puppet") + QStringLiteral(QTC_HOST_EXE_SUFFIX); } -QString PuppetCreator::qmlpuppetPath(PuppetType puppetType) const +QString PuppetCreator::qmlPuppetPath(PuppetType puppetType) const { - return qmlpuppetDirectory(puppetType) + QStringLiteral("/qmlpuppet") + QStringLiteral(QTC_HOST_EXE_SUFFIX); + return qmlPuppetDirectory(puppetType) + QStringLiteral("/qmlpuppet") + QStringLiteral(QTC_HOST_EXE_SUFFIX); } QProcessEnvironment PuppetCreator::processEnvironment() const @@ -346,6 +371,9 @@ bool PuppetCreator::startBuildProcess(const QString &buildDirectoryPath, process.start(command, processArguments); process.waitForStarted(); while (process.waitForReadyRead(-1)) { + if (progressDialog->useFallbackPuppet()) + return false; + QByteArray newOutput = process.readAllStandardOutput(); if (progressDialog) progressDialog->newBuildOutput(newOutput); @@ -357,8 +385,8 @@ bool PuppetCreator::startBuildProcess(const QString &buildDirectoryPath, if (process.exitStatus() == QProcess::NormalExit && process.exitCode() == 0) return true; - else - return false; + + return false; } QString PuppetCreator::puppetSourceDirectoryPath() @@ -366,12 +394,12 @@ QString PuppetCreator::puppetSourceDirectoryPath() return Core::ICore::resourcePath() + QStringLiteral("/qml/qmlpuppet"); } -QString PuppetCreator::qml2puppetProjectFile() +QString PuppetCreator::qml2PuppetProjectFile() { return puppetSourceDirectoryPath() + QStringLiteral("/qml2puppet/qml2puppet.pro"); } -QString PuppetCreator::qmlpuppetProjectFile() +QString PuppetCreator::qmlPuppetProjectFile() { return puppetSourceDirectoryPath() + QStringLiteral("/qmlpuppet/qmlpuppet.pro"); } @@ -379,18 +407,28 @@ QString PuppetCreator::qmlpuppetProjectFile() bool PuppetCreator::checkPuppetIsReady(const QString &puppetPath) const { QFileInfo puppetFileInfo(puppetPath); + if (puppetFileInfo.exists()) { + QDateTime puppetExecutableLastModified = puppetFileInfo.lastModified(); + + return puppetExecutableLastModified > qtLastModified() && puppetExecutableLastModified > puppetSourceLastModified(); + } - return puppetFileInfo.exists() && puppetFileInfo.lastModified() > qtLastModified(); + return false; } -bool PuppetCreator::checkQml2puppetIsReady() const +bool PuppetCreator::checkQml2PuppetIsReady() const { - return checkPuppetIsReady(qml2puppetPath(UserSpacePuppet)); + return checkPuppetIsReady(qml2PuppetPath(UserSpacePuppet)); } bool PuppetCreator::checkQmlpuppetIsReady() const { - return checkPuppetIsReady(qmlpuppetPath(UserSpacePuppet)); + return checkPuppetIsReady(qmlPuppetPath(UserSpacePuppet)); +} + +static bool nonEarlyQt5Version(const QtSupport::QtVersionNumber ¤tQtVersionNumber) +{ + return currentQtVersionNumber >= QtSupport::QtVersionNumber(5, 2, 0) || currentQtVersionNumber < QtSupport::QtVersionNumber(5, 0, 0); } bool PuppetCreator::qtIsSupported() const @@ -399,7 +437,7 @@ bool PuppetCreator::qtIsSupported() const if (currentQtVersion && currentQtVersion->isValid() - && currentQtVersion->qtVersion() >= QtSupport::QtVersionNumber(5, 2, 0) + && nonEarlyQt5Version(currentQtVersion->qtVersion()) && (currentQtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT) || currentQtVersion->type() == QLatin1String(QtSupport::Constants::SIMULATORQT))) return true; diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.h b/src/plugins/qmldesigner/designercore/instances/puppetcreator.h index 63edbdd53a..31bc499c43 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.h +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.h @@ -75,21 +75,21 @@ protected: void createQml1PuppetExecutableIfMissing(); void createQml2PuppetExecutableIfMissing(); - QString qmlpuppetDirectory(PuppetType puppetPathType) const; - QString qmlpuppetFallbackDirectory() const; - QString qml2puppetPath(PuppetType puppetType) const; - QString qmlpuppetPath(PuppetType puppetPathType) const; + QString qmlPuppetDirectory(PuppetType puppetPathType) const; + QString qmlPuppetFallbackDirectory() const; + QString qml2PuppetPath(PuppetType puppetType) const; + QString qmlPuppetPath(PuppetType puppetPathType) const; bool startBuildProcess(const QString &buildDirectoryPath, const QString &command, const QStringList &processArguments = QStringList(), PuppetBuildProgressDialog *progressDialog = 0) const; static QString puppetSourceDirectoryPath(); - static QString qml2puppetProjectFile(); - static QString qmlpuppetProjectFile(); + static QString qml2PuppetProjectFile(); + static QString qmlPuppetProjectFile(); bool checkPuppetIsReady(const QString &puppetPath) const; - bool checkQml2puppetIsReady() const; + bool checkQml2PuppetIsReady() const; bool checkQmlpuppetIsReady() const; bool qtIsSupported() const; static bool checkPuppetVersion(const QString &qmlPuppetPath); @@ -107,6 +107,7 @@ protected: QByteArray qtHash() const; QDateTime qtLastModified() const; + QDateTime puppetSourceLastModified() const; private: QString m_qtCreatorVersion; diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index e50d18383d..0f48b1a2c2 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -122,6 +122,157 @@ static TypeName resolveTypeName(const ASTPropertyReference *ref, const ContextPt return type; } +static QString qualifiedTypeNameForContext(const ObjectValue *objectValue, + const ViewerContext &vContext, + const ImportDependencies &dep) +{ + QString cppName; + QStringList packages; + if (const CppComponentValue *cppComponent = value_cast<CppComponentValue>(objectValue)) { + QString className = cppComponent->className(); + foreach (const LanguageUtils::FakeMetaObject::Export &e, cppComponent->metaObject()->exports()) { + if (e.type == className) + packages << e.package; + if (e.package == QmlJS::CppQmlTypes::cppPackage) + cppName = e.type; + } + if (packages.size() == 1 && packages.at(0) == QmlJS::CppQmlTypes::cppPackage) + return packages.at(0) + QLatin1Char('.') + className; + } + // try to recover a "global context name" + QStringList possibleLibraries; + QStringList possibleQrcFiles; + QStringList possibleFiles; + bool hasQtQuick = false; + do { + if (objectValue->originId().isEmpty()) + break; + CoreImport cImport = dep.coreImport(objectValue->originId()); + if (!cImport.valid()) + break; + foreach (const Export &e, cImport.possibleExports) { + if (e.pathRequired.isEmpty() || vContext.paths.contains(e.pathRequired)) { + switch (e.exportName.type) { + case ImportType::Library: + { + QString typeName = objectValue->className(); + if (!e.typeName.isEmpty() && e.typeName != Export::LibraryTypeName) { + typeName = e.typeName; + if (typeName != objectValue->className()) + qCWarning(qmljsLog) << "Outdated classname " << objectValue->className() + << " vs " << typeName + << " for " << e.exportName.toString(); + } + if (packages.isEmpty() || packages.contains(e.exportName.libPath())) { + if (e.exportName.splitPath.value(0) == QLatin1String("QtQuick")) + hasQtQuick = true; + possibleLibraries.append(e.exportName.libPath() + '.' + typeName); + } + break; + } + case ImportType::File: + { + // remove the search path prefix. + // this means that the same relative path wrt. different import paths will clash + QString filePath = e.exportName.path(); + foreach (const QString &path, vContext.paths) { + if (filePath.startsWith(path) && filePath.size() > path.size() + && filePath.at(path.size()) == QLatin1Char('/')) + { + filePath = filePath.mid(path.size() + 1); + break; + } + } + + if (filePath.startsWith(QLatin1Char('/'))) + filePath = filePath.mid(1); + QFileInfo fileInfo(filePath); + QStringList splitName = fileInfo.path().split(QLatin1Char('/')); + QString typeName = fileInfo.baseName(); + if (!e.typeName.isEmpty()) { + if (e.typeName != fileInfo.baseName()) + qCWarning(qmljsLog) << "type renaming in file import " << e.typeName + << " for " << e.exportName.path(); + typeName = e.typeName; + } + if (typeName != objectValue->className()) + qCWarning(qmljsLog) << "Outdated classname " << objectValue->className() + << " vs " << typeName + << " for " << e.exportName.toString(); + splitName.append(typeName); + possibleFiles.append(splitName.join(QLatin1Char('.'))); + break; + } + case ImportType::QrcFile: + { + QString filePath = e.exportName.path(); + if (filePath.startsWith(QLatin1Char('/'))) + filePath = filePath.mid(1); + QFileInfo fileInfo(filePath); + QStringList splitName = fileInfo.path().split(QLatin1Char('/')); + QString typeName = fileInfo.baseName(); + if (!e.typeName.isEmpty()) { + if (e.typeName != fileInfo.baseName()) + qCWarning(qmljsLog) << "type renaming in file import " << e.typeName + << " for " << e.exportName.path(); + typeName = e.typeName; + } + if (typeName != objectValue->className()) + qCWarning(qmljsLog) << "Outdated classname " << objectValue->className() + << " vs " << typeName + << " for " << e.exportName.toString(); + splitName.append(typeName); + possibleQrcFiles.append(splitName.join(QLatin1Char('.'))); + break; + } + case ImportType::Invalid: + case ImportType::UnknownFile: + break; + case ImportType::Directory: + case ImportType::ImplicitDirectory: + case ImportType::QrcDirectory: + qCWarning(qmljsLog) << "unexpected import type in export " + << e.exportName.toString() << " of coreExport " + << objectValue->originId(); + break; + } + } + } + auto optimalName = [] (const QStringList &list) -> QString { + QString res = list.at(0); + for (int i = 1; i < list.size(); ++i) { + const QString &nameNow = list.at(i); + if (nameNow.size() < res.size() + || (nameNow.size() == res.size() && nameNow < res)) + res = nameNow; + } + return res; + }; + if (!possibleLibraries.isEmpty()) { + if (hasQtQuick) { + foreach (const QString &libImport, possibleLibraries) + if (!libImport.startsWith(QLatin1String("QtQuick"))) + possibleLibraries.removeAll(libImport); + } + return optimalName(possibleLibraries); + } + if (!possibleQrcFiles.isEmpty()) + return optimalName(possibleQrcFiles); + if (!possibleFiles.isEmpty()) + return optimalName(possibleFiles); + } while (false); + if (!cppName.isEmpty()) + return QmlJS::CppQmlTypes::cppPackage + QLatin1Char('.') + cppName; + if (const CppComponentValue *cppComponent = value_cast<CppComponentValue>(objectValue)) { + if (cppComponent->moduleName().isEmpty()) + return cppComponent->className(); + else + return cppComponent->moduleName() + QLatin1Char('.') + cppComponent->className(); + } else { + return objectValue->className(); + } +} + class PropertyMemberProcessor : public MemberProcessor { public: @@ -144,8 +295,10 @@ public: } } } else { + if (const CppComponentValue * cppComponentValue = value_cast<CppComponentValue>(value)) { - TypeName qualifiedTypeName = cppComponentValue->moduleName().isEmpty() ? cppComponentValue->className().toUtf8() : cppComponentValue->moduleName().toUtf8() + '.' + cppComponentValue->className().toUtf8(); + TypeName qualifiedTypeName = qualifiedTypeNameForContext(cppComponentValue, + m_context->vContext(), *m_context->snapshot().importDependencies()).toUtf8(); m_properties.append(qMakePair(propertyName, qualifiedTypeName)); } else { TypeId typeId; @@ -519,19 +672,19 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, TypeName type, int maj, i m_model(model) { if (context()) { - const CppComponentValue *objectValue = getCppComponentValue(); + const CppComponentValue *cppObjectValue = getCppComponentValue(); - if (objectValue) { + if (cppObjectValue) { if (m_majorVersion == -1 && m_minorVersion == -1) { - m_majorVersion = objectValue->componentVersion().majorVersion(); - m_minorVersion = objectValue->componentVersion().minorVersion(); + m_majorVersion = cppObjectValue->componentVersion().majorVersion(); + m_minorVersion = cppObjectValue->componentVersion().minorVersion(); } - setupPropertyInfo(getTypes(objectValue, context())); - setupLocalPropertyInfo(getTypes(objectValue, context(), true)); - m_defaultPropertyName = objectValue->defaultPropertyName().toUtf8(); + setupPropertyInfo(getTypes(cppObjectValue, context())); + setupLocalPropertyInfo(getTypes(cppObjectValue, context(), true)); + m_defaultPropertyName = cppObjectValue->defaultPropertyName().toUtf8(); m_isValid = true; setupPrototypes(); - m_signals = getSignals(objectValue, context()); + m_signals = getSignals(cppObjectValue, context()); } else { const ObjectValue *objectValue = getObjectValue(); if (objectValue) { diff --git a/src/plugins/qmldesigner/designercore/model/propertyparser.cpp b/src/plugins/qmldesigner/designercore/model/propertyparser.cpp index 8dda0a418f..9f1aee3769 100644 --- a/src/plugins/qmldesigner/designercore/model/propertyparser.cpp +++ b/src/plugins/qmldesigner/designercore/model/propertyparser.cpp @@ -193,9 +193,11 @@ QVariant read(const QString &typeStr, const QString &str) { int type = QMetaType::type(typeStr.toUtf8().constData()); if (type == 0) { - qWarning() << "Type " << typeStr - << " is unknown to QMetaType system. Cannot create properly typed QVariant for value " - << str; + if (typeStr != QStringLiteral("binding")) { + qWarning() << "Type " << typeStr + << " is unknown to QMetaType system. Cannot create properly typed QVariant for value " + << str; + } // Fall back to a QVariant of type String return QVariant(str); } |