From 79bbe93c1bba433e30afd31b4974634a6bbbdf39 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 5 Dec 2019 10:32:35 +0100 Subject: [PATCH 01/27] Android: Make more logged command calls copy&pasteable Change-Id: I43e01efc4cb583235ad2d97150d4478b23558659 Reviewed-by: Christian Stenger --- src/plugins/android/androidmanager.cpp | 10 ++++++---- src/plugins/android/androidrunnerworker.cpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index 14b5ef2050e..d883496e6cc 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -768,7 +768,7 @@ QProcess *AndroidManager::runAdbCommandDetached(const QStringList &args, QString { std::unique_ptr p(new QProcess); const QString adb = AndroidConfigurations::currentConfig().adbToolPath().toString(); - qCDebug(androidManagerLog) << "Running command:" << adb << args.join(' '); + qCDebug(androidManagerLog) << "Running command (async):" << CommandLine(adb, args).toUserOutput(); p->start(adb, args); if (p->waitForStarted(500) && p->state() == QProcess::Running) { if (deleteOnFinish) { @@ -779,7 +779,9 @@ QProcess *AndroidManager::runAdbCommandDetached(const QStringList &args, QString } QString errorStr = QString::fromUtf8(p->readAllStandardError()); - qCDebug(androidManagerLog) << "Running command failed" << adb << args.join(' ') << errorStr; + qCDebug(androidManagerLog) << "Running command (async) failed:" + << CommandLine(adb, args).toUserOutput() + << "Output:" << errorStr; if (err) *err = errorStr; return nullptr; @@ -791,12 +793,12 @@ SdkToolResult AndroidManager::runCommand(const CommandLine &command, Android::SdkToolResult cmdResult; Utils::SynchronousProcess cmdProc; cmdProc.setTimeoutS(timeoutS); - qCDebug(androidManagerLog) << "Running command: " << command.toUserOutput(); + qCDebug(androidManagerLog) << "Running command (sync):" << command.toUserOutput(); SynchronousProcessResponse response = cmdProc.run(command, writeData); cmdResult.m_stdOut = response.stdOut().trimmed(); cmdResult.m_stdErr = response.stdErr().trimmed(); cmdResult.m_success = response.result == Utils::SynchronousProcessResponse::Finished; - qCDebug(androidManagerLog) << "Running command finshed:" << command.toUserOutput() + qCDebug(androidManagerLog) << "Running command (sync) finshed:" << command.toUserOutput() << "Success:" << cmdResult.m_success << "Output:" << response.allRawOutput(); if (!cmdResult.success()) diff --git a/src/plugins/android/androidrunnerworker.cpp b/src/plugins/android/androidrunnerworker.cpp index a789f7c0125..5b9806e5bce 100644 --- a/src/plugins/android/androidrunnerworker.cpp +++ b/src/plugins/android/androidrunnerworker.cpp @@ -599,7 +599,7 @@ void AndroidRunnerWorker::handleJdbWaiting() QStringList jdbArgs("-connect"); jdbArgs << QString("com.sun.jdi.SocketAttach:hostname=localhost,port=%1") .arg(m_localJdbServerPort.toString()); - qCDebug(androidRunWorkerLog) << "Starting JDB:" << jdbPath << jdbArgs.join(' '); + qCDebug(androidRunWorkerLog) << "Starting JDB:" << CommandLine(jdbPath, jdbArgs).toUserOutput(); std::unique_ptr jdbProcess(new QProcess, &deleter); jdbProcess->setProcessChannelMode(QProcess::MergedChannels); jdbProcess->start(jdbPath.toString(), jdbArgs); From 0d76a013793ade8483dce91ece2b026432398d67 Mon Sep 17 00:00:00 2001 From: Alexander Akulich Date: Mon, 9 Dec 2019 19:18:28 +0300 Subject: [PATCH 02/27] ProjectExplorer: Update CMake target on DesktopRunConfiguration cloned Call updateTargetInformation() for all kinds of configuration to fix ExecutableAspect initialization. Change-Id: Ie568f589fd6a6570fe84353bf145f7f87d1f0448 Reviewed-by: hjk --- src/plugins/projectexplorer/desktoprunconfiguration.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/desktoprunconfiguration.cpp b/src/plugins/projectexplorer/desktoprunconfiguration.cpp index a3f1f735ac4..83d57728e32 100644 --- a/src/plugins/projectexplorer/desktoprunconfiguration.cpp +++ b/src/plugins/projectexplorer/desktoprunconfiguration.cpp @@ -154,8 +154,7 @@ bool DesktopRunConfiguration::fromMap(const QVariantMap &map) if (!RunConfiguration::fromMap(map)) return false; - if (m_kind == Qmake || m_kind == Qbs) - updateTargetInformation(); + updateTargetInformation(); return true; } From 984938a451bd854aed81e926a7203f3c68f1d875 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 4 Dec 2019 15:03:43 +0100 Subject: [PATCH 03/27] Android: Log Sdk manager calls ... helps finding reason for logged parsing errors. Change-Id: Ia544d7d042e3eb8db04c122fe9f2f8e753e8ef4a Reviewed-by: Christian Stenger --- src/plugins/android/androidsdkmanager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/android/androidsdkmanager.cpp b/src/plugins/android/androidsdkmanager.cpp index 5fefc440969..022a2c42a46 100644 --- a/src/plugins/android/androidsdkmanager.cpp +++ b/src/plugins/android/androidsdkmanager.cpp @@ -132,6 +132,8 @@ void watcherDeleter(QFutureWatcher *watcher) static bool sdkManagerCommand(const AndroidConfig &config, const QStringList &args, QString *output, int timeout = sdkManagerCmdTimeoutS) { + qCDebug(sdkManagerLog) << "Running SDK Manager command (sync):" + << CommandLine(config.sdkManagerToolPath(), args).toUserOutput(); SynchronousProcess proc; proc.setProcessEnvironment(AndroidConfigurations::toolsEnvironment(config)); proc.setTimeoutS(timeout); @@ -153,6 +155,8 @@ static void sdkManagerCommand(const AndroidConfig &config, const QStringList &ar AndroidSdkManager::OperationOutput &output, double progressQuota, bool interruptible = true, int timeout = sdkManagerOperationTimeoutS) { + qCDebug(sdkManagerLog) << "Running SDK Manager command (async):" + << CommandLine(config.sdkManagerToolPath(), args).toUserOutput(); int offset = fi.progressValue(); SynchronousProcess proc; proc.setProcessEnvironment(AndroidConfigurations::toolsEnvironment(config)); From b526d789cf19deacbc61530a76f97704f941c883 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 10 Dec 2019 10:59:20 +0100 Subject: [PATCH 04/27] RemoteLinux: Add RemoteLinuxRunConfiguration::doAdditionalSetup() This became necessary after commit b1dbd7e358, because now run configurations are created after parsing has finished, so they will not initially receive the signals that cause them to update their target information. Fixes: QTCREATORBUG-23315 Change-Id: I761e5a5bd4ed6015037f562c10792fe16147739a Reviewed-by: hjk --- src/plugins/remotelinux/remotelinuxrunconfiguration.cpp | 5 +++++ src/plugins/remotelinux/remotelinuxrunconfiguration.h | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp index 745858dd416..40c5d49b278 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp @@ -78,6 +78,11 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Core::I this, &RemoteLinuxRunConfiguration::updateTargetInformation); } +void RemoteLinuxRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &) +{ + updateTargetInformation(); +} + Runnable RemoteLinuxRunConfiguration::runnable() const { Runnable r = RunConfiguration::runnable(); diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.h b/src/plugins/remotelinux/remotelinuxrunconfiguration.h index d685d19ea88..6f26ef09c2a 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.h @@ -40,10 +40,10 @@ public: RemoteLinuxRunConfiguration(ProjectExplorer::Target *target, Core::Id id); static const char *IdPrefix; -protected: +private: + void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override; ProjectExplorer::Runnable runnable() const override; -private: void updateTargetInformation(); }; From cbdcde06032add78685d34430183679766bac009 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 10 Dec 2019 09:27:18 +0100 Subject: [PATCH 05/27] Python: Reset editor info bars when closing document Fixes crash after reopening a python document and configuring the python language server in the reopend document. Change-Id: I42eb6c5d3ccb755a836fd9071b3147d65c8c0ab6 Reviewed-by: Christian Stenger --- src/plugins/python/pythonutils.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp index dced51518b9..651510161c9 100644 --- a/src/plugins/python/pythonutils.cpp +++ b/src/plugins/python/pythonutils.cpp @@ -31,6 +31,7 @@ #include "pythonrunconfiguration.h" #include "pythonsettings.h" +#include #include #include @@ -446,7 +447,16 @@ void PyLSConfigureAssistant::resetEditorInfoBar(TextEditor::TextDocument *docume PyLSConfigureAssistant::PyLSConfigureAssistant(QObject *parent) : QObject(parent) -{} +{ + Core::EditorManager::instance(); + connect(Core::EditorManager::instance(), + &Core::EditorManager::documentClosed, + this, + [this](Core::IDocument *document) { + if (auto textDocument = qobject_cast(document)) + resetEditorInfoBar(textDocument); + }); +} } // namespace Internal } // namespace Python From d935f2fe6aeaeb0f37da5f9b0d94fa8964064293 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 10 Dec 2019 10:46:36 +0100 Subject: [PATCH 06/27] add python improvements to changes file Change-Id: I07518d60b21770554d8fc944631b907411fd4ee9 Reviewed-by: Christian Stenger --- dist/changes-4.11.0.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/changes-4.11.0.md b/dist/changes-4.11.0.md index 3b24537c3e0..fa43c4d0557 100644 --- a/dist/changes-4.11.0.md +++ b/dist/changes-4.11.0.md @@ -53,6 +53,8 @@ you can check out from the public Git repository. For example: ### Python * Simplified registration of language server +* Added python settings to configure multiple python interpreters +* Simplified switching python interpreters for python projects ## Help From 017ed74400de56b99c6fddb6f4691ba65d35695e Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 10 Dec 2019 09:41:11 +0100 Subject: [PATCH 07/27] LanguageClient: Fix crash on closing qc while restarting a server Reset the assist providers when restarting a server, so the client can be safely shutdown while closing Qt Creator. Change-Id: I4d5f18582a8c67cbe02974d72fcef9703ed64dc4 Reviewed-by: Christian Stenger --- src/plugins/languageclient/client.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/languageclient/client.cpp b/src/plugins/languageclient/client.cpp index c036646c59e..78b1ddedda1 100644 --- a/src/plugins/languageclient/client.cpp +++ b/src/plugins/languageclient/client.cpp @@ -814,6 +814,8 @@ bool Client::reset() m_project = nullptr; for (const DocumentUri &uri : m_diagnostics.keys()) removeDiagnostics(uri); + for (TextEditor::TextDocument *document : m_resetAssistProvider.keys()) + resetAssistProviders(document); return true; } From ef135cc549c4b6b5a1fba9b6119487172620bd07 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 10 Dec 2019 13:42:10 +0100 Subject: [PATCH 08/27] ProjectExplorer: Fix crash One must not call std::next() on a non-dereferenceable iterator. Change-Id: Id40341f808a3781f91f8aef1930bb76a397e8053 Reviewed-by: hjk --- src/plugins/projectexplorer/projectmacro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/projectmacro.cpp b/src/plugins/projectexplorer/projectmacro.cpp index 5d2824f01db..4a6ca945c97 100644 --- a/src/plugins/projectexplorer/projectmacro.cpp +++ b/src/plugins/projectexplorer/projectmacro.cpp @@ -166,12 +166,12 @@ QList Macro::tokenizeLine(const QByteArray &line) const auto begin = normalizedLine.begin(); auto first = std::find(normalizedLine.begin(), normalizedLine.end(), ' '); - auto second = std::find(std::next(first), normalizedLine.end(), ' '); const auto end = normalizedLine.end(); QList tokens; if (first != end) { + auto second = std::find(std::next(first), normalizedLine.end(), ' '); tokens.append(QByteArray(begin, int(std::distance(begin, first)))); std::advance(first, 1); From 16e3e44ce7b20f07d8a5e56f2937340cfcacd5a9 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 10 Dec 2019 13:57:36 +0100 Subject: [PATCH 09/27] QmlDesigner: Fix more warnings about unused parameters and functions Change-Id: I8b569fcf60a0a21c6828d612997bbba0f737c806 Reviewed-by: Tim Jenssen --- .../instances/quick3dnodeinstance.cpp | 4 +++ .../itemlibrary/itemlibraryassetimporter.cpp | 1 + .../designercore/model/qmlitemnode.cpp | 28 ------------------- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.cpp index 4c725749e2e..2d162503e98 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.cpp @@ -133,6 +133,10 @@ void Quick3DNodeInstance::setPickable(bool enable, bool checkParent, bool applyT setPropertyVariant("pickable", enable); // allow 3D objects to receive mouse clicks } } +#else + Q_UNUSED(enable) + Q_UNUSED(checkParent) + Q_UNUSED(applyToChildInstances) #endif } diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimporter.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimporter.cpp index d4f1d090baf..53cc813e0c1 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimporter.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimporter.cpp @@ -389,6 +389,7 @@ void ItemLibraryAssetImporter::parseQuick3DAsset(const QString &file, const QVar #else Q_UNUSED(file) + Q_UNUSED(options) #endif } diff --git a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp index c65a57d34f0..5e119a688ff 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp @@ -57,34 +57,6 @@ bool QmlItemNode::isItemOrWindow(const ModelNode &modelNode) return false; } -static QmlItemNode createQmlItemNodeFromSource(AbstractView *view, const QString &source, const QPointF &position) -{ - QScopedPointer inputModel(Model::create("QtQuick.Item", 1, 0, view->model())); - inputModel->setFileUrl(view->model()->fileUrl()); - QPlainTextEdit textEdit; - - textEdit.setPlainText(source); - NotIndentingTextEditModifier modifier(&textEdit); - - QScopedPointer rewriterView(new RewriterView(RewriterView::Amend, nullptr)); - rewriterView->setCheckSemanticErrors(false); - rewriterView->setTextModifier(&modifier); - inputModel->setRewriterView(rewriterView.data()); - - if (rewriterView->errors().isEmpty() && rewriterView->rootModelNode().isValid()) { - ModelNode rootModelNode = rewriterView->rootModelNode(); - inputModel->detachView(rewriterView.data()); - - rootModelNode.variantProperty("x").setValue(qRound(position.x())); - rootModelNode.variantProperty("y").setValue(qRound(position.y())); - - ModelMerger merger(view); - return merger.insertModel(rootModelNode); - } - - return QmlItemNode(); -} - QmlItemNode QmlItemNode::createQmlItemNode(AbstractView *view, const ItemLibraryEntry &itemLibraryEntry, const QPointF &position, From 116451ba1b4dc185db04709b466b76ad0957e70d Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 11 Dec 2019 05:48:10 +0100 Subject: [PATCH 10/27] CppTools: Update clang-tidy documentation URL 8.0.0 -> 8.0.1 Change-Id: Ic58777d2e97711e12e208c1b2a709bb0a9279e41 Reviewed-by: Christian Stenger --- src/plugins/cpptools/cpptoolsconstants.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cpptools/cpptoolsconstants.h b/src/plugins/cpptools/cpptoolsconstants.h index 33667b2ce8f..e4329ff84b4 100644 --- a/src/plugins/cpptools/cpptoolsconstants.h +++ b/src/plugins/cpptools/cpptoolsconstants.h @@ -100,7 +100,7 @@ const char SYMBOLS_FIND_FILTER_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("CppTools", "C // CLANG_VERSION here because it might denote a version that was not yet // released (e.g. 6.0.1, but only 6.0.0 was released). constexpr const char TIDY_DOCUMENTATION_URL_TEMPLATE[] - = "https://releases.llvm.org/8.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/%1.html"; + = "https://releases.llvm.org/8.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/%1.html"; constexpr const char CLAZY_DOCUMENTATION_URL_TEMPLATE[] = "https://github.com/KDE/clazy/blob/master/docs/checks/README-%1.md"; From f26d770322ca6b6b4575a7e2751243f9e2c09af6 Mon Sep 17 00:00:00 2001 From: Aleksei German Date: Tue, 10 Dec 2019 11:31:57 +0100 Subject: [PATCH 11/27] QmlDesigner Connection Delete Shortcut replacement Task: QDS-1320 Change-Id: I1a94d30710d58dfbd8e90a45133700af20fc2980 Reviewed-by: Tim Jenssen --- .../components/connectioneditor/connectionviewwidget.cpp | 7 +++++++ .../components/connectioneditor/connectionviewwidget.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp index 60476903baa..d0aa6bbbc7a 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include @@ -57,6 +58,7 @@ ConnectionViewWidget::ConnectionViewWidget(QWidget *parent) : ui(new Ui::ConnectionViewWidget) { m_actionEditor = new QmlDesigner::ActionEditor(this); + m_deleteShortcut = new QShortcut(this); QObject::connect(m_actionEditor, &QmlDesigner::ActionEditor::accepted, [&]() { if (m_actionEditor->hasModelIndex()) { @@ -123,6 +125,7 @@ ConnectionViewWidget::~ConnectionViewWidget() { delete m_actionEditor; delete ui; + delete m_deleteShortcut; } void ConnectionViewWidget::setBindingModel(BindingModel *model) @@ -212,6 +215,10 @@ QList ConnectionViewWidget::createToolBarWidgets() connect(buttons.constLast(), &QAbstractButton::clicked, this, &ConnectionViewWidget::removeButtonClicked); connect(this, &ConnectionViewWidget::setEnabledRemoveButton, buttons.constLast(), &QWidget::setEnabled); + m_deleteShortcut->setKey(Qt::Key_Delete); + m_deleteShortcut->setContext(Qt::WidgetWithChildrenShortcut); + connect(m_deleteShortcut, &QShortcut::activated, this, &ConnectionViewWidget::removeButtonClicked); + return buttons; } diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h index 09cc4f6c53f..4e4967bbf88 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h @@ -101,6 +101,7 @@ private: private: Ui::ConnectionViewWidget *ui; QmlDesigner::ActionEditor *m_actionEditor; + QShortcut *m_deleteShortcut; }; } // namespace Internal From 128c7a34af2fc4e8b75f06979dd810953b9e4c08 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 9 Dec 2019 15:46:46 +0200 Subject: [PATCH 12/27] QmlDesigner: Update selection box on parent change Selection box geometry update sets explicit global transform for selection box root. The transform depends on the target node parent, so if the parent changes, the box needs to be updated. Change-Id: Iccf8b7e863bcfe541bbb4f60a4094739a7513e8d Reviewed-by: Thomas Hartmann Reviewed-by: Mahmoud Badri --- .../qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp index 17b101326e9..910501a9e4f 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp @@ -98,6 +98,10 @@ void SelectionBoxGeometry::setTargetNode(QQuick3DNode *targetNode) QObject::connect(model, &QQuick3DModel::geometryChanged, this, &SelectionBoxGeometry::update, Qt::QueuedConnection); } + if (m_targetNode) { + QObject::connect(m_targetNode, &QQuick3DNode::parentChanged, + this, &SelectionBoxGeometry::update, Qt::QueuedConnection); + } emit targetNodeChanged(); update(); From 783e5d0a8de8c638f44437751618bc3bf6367caa Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 10 Dec 2019 13:14:30 +0200 Subject: [PATCH 13/27] Use separate MouseArea3D to calculate drag vector Using the MouseArea3D linked to gizmo to manage the drag leads to slight unwanted drift on the drag plane, as it moves with the gizmo. Fixed by using a helper MouseArea3D to calculate drag vector. Helper area's transform is set at mouse press time and is not changed during the drag. Change-Id: I50d3f738277bd34005c977423d114abc8dbed520 Fixes: QDS-1312 Reviewed-by: Mahmoud Badri Reviewed-by: Thomas Hartmann --- .../mockfiles/DirectionalDraggable.qml | 9 +++-- .../qml/qmlpuppet/mockfiles/EditView3D.qml | 9 +++++ .../qml/qmlpuppet/mockfiles/IconGizmo.qml | 2 +- .../qml/qmlpuppet/mockfiles/MoveGizmo.qml | 9 +++++ .../qmlpuppet/mockfiles/PlanarDraggable.qml | 11 +++--- .../qmlpuppet/mockfiles/PlanarScaleHandle.qml | 2 +- .../qml/qmlpuppet/mockfiles/RotateGizmo.qml | 7 ++++ .../qml/qmlpuppet/mockfiles/RotateRing.qml | 3 ++ .../qml/qmlpuppet/mockfiles/ScaleGizmo.qml | 15 +++++--- .../qml/qmlpuppet/mockfiles/ScaleRod.qml | 2 +- .../qml2puppet/editor3d/mousearea3d.cpp | 36 +++++++++++++++---- .../qml2puppet/editor3d/mousearea3d.h | 7 +++- 12 files changed, 92 insertions(+), 20 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/DirectionalDraggable.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/DirectionalDraggable.qml index 081936d007f..217f29d7c43 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/DirectionalDraggable.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/DirectionalDraggable.qml @@ -35,6 +35,7 @@ Model { property Node targetNode: null property bool dragging: mouseAreaYZ.dragging || mouseAreaXZ.dragging property bool active: false + property MouseArea3D dragHelper: null readonly property bool hovering: mouseAreaYZ.hovering || mouseAreaXZ.hovering @@ -57,7 +58,7 @@ Model { return; var maskedPosition = Qt.vector3d(scenePos.x, 0, 0); - _pointerPosPressed = mouseArea.mapPositionToScene(maskedPosition); + _pointerPosPressed = mouseArea.dragHelper.mapPositionToScene(maskedPosition); if (targetNode.orientation === Node.RightHanded) _pointerPosPressed.z = -_pointerPosPressed.z; var sp = targetNode.scenePosition; @@ -68,7 +69,7 @@ Model { function calcRelativeDistance(mouseArea, scenePos) { var maskedPosition = Qt.vector3d(scenePos.x, 0, 0); - var scenePointerPos = mouseArea.mapPositionToScene(maskedPosition); + var scenePointerPos = mouseArea.dragHelper.mapPositionToScene(maskedPosition); if (targetNode.orientation === Node.RightHanded) scenePointerPos.z = -scenePointerPos.z; return scenePointerPos.minus(_pointerPosPressed); @@ -100,6 +101,8 @@ Model { rotation: Qt.vector3d(0, 0, 90) grabsMouse: targetNode active: rootModel.active + dragHelper: rootModel.dragHelper + onPressed: rootModel.handlePressed(mouseAreaYZ, scenePos) onDragged: rootModel.handleDragged(mouseAreaYZ, scenePos) onReleased: rootModel.handleReleased(mouseAreaYZ, scenePos) @@ -115,6 +118,8 @@ Model { rotation: Qt.vector3d(0, 90, 90) grabsMouse: targetNode active: rootModel.active + dragHelper: rootModel.dragHelper + onPressed: rootModel.handlePressed(mouseAreaXZ, scenePos) onDragged: rootModel.handleDragged(mouseAreaXZ, scenePos) onReleased: rootModel.handleReleased(mouseAreaXZ, scenePos) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml index f4ef3301de8..cd98a23fe04 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml @@ -28,6 +28,7 @@ import QtQuick.Window 2.12 import QtQuick3D 1.0 import QtQuick.Controls 2.0 import QtGraphicalEffects 1.0 +import MouseArea3D 1.0 Window { id: viewWindow @@ -183,6 +184,11 @@ Window { scale: editOrthoCamera.scale } + MouseArea3D { + id: gizmoDragHelper + view3D: overlayView + } + MoveGizmo { id: moveGizmo scale: autoScale.getScale(Qt.vector3d(5, 5, 5)) @@ -191,6 +197,7 @@ Window { globalOrientation: btnLocalGlobal.toggled visible: selectedNode && btnMove.selected view3D: overlayView + dragHelper: gizmoDragHelper onPositionCommit: viewWindow.commitObjectProperty(selectedNode, "position") onPositionMove: viewWindow.changeObjectProperty(selectedNode, "position") @@ -204,6 +211,7 @@ Window { globalOrientation: false visible: selectedNode && btnScale.selected view3D: overlayView + dragHelper: gizmoDragHelper onScaleCommit: viewWindow.commitObjectProperty(selectedNode, "scale") onScaleChange: viewWindow.changeObjectProperty(selectedNode, "scale") @@ -217,6 +225,7 @@ Window { globalOrientation: btnLocalGlobal.toggled visible: selectedNode && btnRotate.selected view3D: overlayView + dragHelper: gizmoDragHelper onRotateCommit: viewWindow.commitObjectProperty(selectedNode, "rotation") onRotateChange: viewWindow.changeObjectProperty(selectedNode, "rotation") diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml index e84de0fbdeb..c5e7c5fc0fa 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml @@ -33,7 +33,7 @@ Node { property View3D view3D property bool highlightOnHover: true property Node targetNode: null - property var selectedNodes: null + property var selectedNodes: [] readonly property bool selected: { for (var i = 0; i < selectedNodes.length; ++i) { if (selectedNodes[i] === targetNode) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/MoveGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/MoveGizmo.qml index 37e7a17a2c4..fa6e844f0b1 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/MoveGizmo.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/MoveGizmo.qml @@ -37,6 +37,8 @@ Node { readonly property bool dragging: arrowX.dragging || arrowY.dragging || arrowZ.dragging || planeX.dragging || planeY.dragging || planeZ.dragging || centerBall.dragging + property MouseArea3D dragHelper: null + position: targetNode ? targetNode.scenePosition : Qt.vector3d(0, 0, 0) orientation: targetNode ? targetNode.orientation : Node.LeftHanded @@ -57,6 +59,7 @@ Node { : Qt.rgba(1, 0, 0, 1) view3D: moveGizmo.view3D active: moveGizmo.visible + dragHelper: moveGizmo.dragHelper onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() @@ -70,6 +73,7 @@ Node { : Qt.rgba(0, 0.6, 0, 1) view3D: moveGizmo.view3D active: moveGizmo.visible + dragHelper: moveGizmo.dragHelper onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() @@ -83,6 +87,7 @@ Node { : Qt.rgba(0, 0, 1, 1) view3D: moveGizmo.view3D active: moveGizmo.visible + dragHelper: moveGizmo.dragHelper onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() @@ -100,6 +105,7 @@ Node { : Qt.rgba(1, 0, 0, 1) view3D: moveGizmo.view3D active: moveGizmo.visible + dragHelper: moveGizmo.dragHelper onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() @@ -117,6 +123,7 @@ Node { : Qt.rgba(0, 0.6, 0, 1) view3D: moveGizmo.view3D active: moveGizmo.visible + dragHelper: moveGizmo.dragHelper onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() @@ -134,6 +141,7 @@ Node { : Qt.rgba(0, 0, 1, 1) view3D: moveGizmo.view3D active: moveGizmo.visible + dragHelper: moveGizmo.dragHelper onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() @@ -152,6 +160,7 @@ Node { view3D: moveGizmo.view3D active: moveGizmo.visible + dragHelper: moveGizmo.dragHelper onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarDraggable.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarDraggable.qml index 935175054e7..5c9ebe32700 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarDraggable.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarDraggable.qml @@ -36,11 +36,12 @@ Model { property Node targetNode: null property bool dragging: mouseArea.dragging property bool active: false + property MouseArea3D dragHelper: null readonly property bool hovering: mouseArea.hovering - property var _pointerPosPressed - property var _targetStartPos + property vector3d _pointerPosPressed + property vector3d _targetStartPos signal pressed(var mouseArea) signal dragged(var mouseArea, vector3d sceneRelativeDistance) @@ -62,7 +63,7 @@ Model { if (!targetNode) return; - _pointerPosPressed = mouseArea.mapPositionToScene(scenePos); + _pointerPosPressed = mouseArea.dragHelper.mapPositionToScene(scenePos); if (targetNode.orientation === Node.RightHanded) _pointerPosPressed.z = -_pointerPosPressed.z; var sp = targetNode.scenePosition; @@ -72,7 +73,7 @@ Model { function calcRelativeDistance(mouseArea, scenePos) { - var scenePointerPos = mouseArea.mapPositionToScene(scenePos); + var scenePointerPos = mouseArea.dragHelper.mapPositionToScene(scenePos); if (targetNode.orientation === Node.RightHanded) scenePointerPos.z = -scenePointerPos.z; return scenePointerPos.minus(_pointerPosPressed); @@ -103,6 +104,8 @@ Model { height: 120 grabsMouse: targetNode active: rootModel.active + dragHelper: rootModel.dragHelper + onPressed: rootModel.handlePressed(mouseArea, scenePos) onDragged: rootModel.handleDragged(mouseArea, scenePos) onReleased: rootModel.handleReleased(mouseArea, scenePos) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarScaleHandle.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarScaleHandle.qml index dfdfb7c1969..6a9881756f0 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarScaleHandle.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarScaleHandle.qml @@ -36,7 +36,7 @@ PlanarDraggable { signal scaleCommit() signal scaleChange() - property var _startScale + property vector3d _startScale onPressed: { // Recreate vector so we don't follow the changes in targetNode.sceneScale diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/RotateGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/RotateGizmo.qml index f481f7f4359..99e27332af8 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/RotateGizmo.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/RotateGizmo.qml @@ -36,6 +36,7 @@ Node { property bool globalOrientation: true readonly property bool dragging: cameraRing.dragging || rotRingX.dragging || rotRingY.dragging || rotRingZ.dragging + property MouseArea3D dragHelper: null property real currentAngle property point currentMousePos @@ -88,6 +89,7 @@ Node { priority: 40 view3D: rotateGizmo.view3D active: rotateGizmo.visible + dragHelper: rotateGizmo.dragHelper onRotateCommit: rotateGizmo.rotateCommit() onRotateChange: rotateGizmo.rotateChange() @@ -107,6 +109,7 @@ Node { priority: 30 view3D: rotateGizmo.view3D active: rotateGizmo.visible + dragHelper: rotateGizmo.dragHelper onRotateCommit: rotateGizmo.rotateCommit() onRotateChange: rotateGizmo.rotateChange() @@ -126,6 +129,7 @@ Node { priority: 20 view3D: rotateGizmo.view3D active: rotateGizmo.visible + dragHelper: rotateGizmo.dragHelper onRotateCommit: rotateGizmo.rotateCommit() onRotateChange: rotateGizmo.rotateChange() @@ -145,6 +149,7 @@ Node { priority: 10 view3D: rotateGizmo.view3D active: rotateGizmo.visible + dragHelper: rotateGizmo.dragHelper onRotateCommit: rotateGizmo.rotateCommit() onRotateChange: rotateGizmo.rotateChange() @@ -226,6 +231,8 @@ Node { circlePickArea: Qt.point(25, 50) grabsMouse: rotateGizmo.targetNode active: rotateGizmo.visible + dragHelper: rotateGizmo.dragHelper + onPressed: freeRotator.handlePressed(screenPos) onDragged: freeRotator.handleDragged(screenPos) onReleased: freeRotator.handleReleased(screenPos) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/RotateRing.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/RotateRing.qml index a026b49ba4c..393400c6923 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/RotateRing.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/RotateRing.qml @@ -39,6 +39,7 @@ Model { property alias priority: mouseAreaMain.priority property real currentAngle property point currentMousePos + property MouseArea3D dragHelper: null property vector3d _pointerPosPressed property vector3d _targetPosOnScreen @@ -132,6 +133,8 @@ Model { active: rotateRing.active pickNode: pickModel minAngle: 0.05 + dragHelper: rotateRing.dragHelper + onPressed: rotateRing.handlePressed(screenPos, angle) onDragged: rotateRing.handleDragged(screenPos) onReleased: rotateRing.handleReleased(screenPos) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleGizmo.qml index 5f4a6d1641f..2f2508538f4 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleGizmo.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleGizmo.qml @@ -37,6 +37,7 @@ Node { readonly property bool dragging: scaleRodX.dragging || scaleRodY.dragging || scaleRodZ.dragging || planeX.dragging || planeY.dragging || planeZ.dragging || centerMouseArea.dragging + property MouseArea3D dragHelper: null position: targetNode ? targetNode.scenePosition : Qt.vector3d(0, 0, 0) orientation: targetNode ? targetNode.orientation : Node.LeftHanded @@ -58,6 +59,7 @@ Node { view3D: scaleGizmo.view3D active: scaleGizmo.visible globalOrientation: scaleGizmo.globalOrientation + dragHelper: scaleGizmo.dragHelper onScaleCommit: scaleGizmo.scaleCommit() onScaleChange: scaleGizmo.scaleChange() @@ -72,6 +74,7 @@ Node { view3D: scaleGizmo.view3D active: scaleGizmo.visible globalOrientation: scaleGizmo.globalOrientation + dragHelper: scaleGizmo.dragHelper onScaleCommit: scaleGizmo.scaleCommit() onScaleChange: scaleGizmo.scaleChange() @@ -86,6 +89,7 @@ Node { view3D: scaleGizmo.view3D active: scaleGizmo.visible globalOrientation: scaleGizmo.globalOrientation + dragHelper: scaleGizmo.dragHelper onScaleCommit: scaleGizmo.scaleCommit() onScaleChange: scaleGizmo.scaleChange() @@ -104,6 +108,7 @@ Node { view3D: scaleGizmo.view3D active: scaleGizmo.visible globalOrientation: scaleGizmo.globalOrientation + dragHelper: scaleGizmo.dragHelper onScaleCommit: scaleGizmo.scaleCommit() onScaleChange: scaleGizmo.scaleChange() @@ -122,6 +127,7 @@ Node { view3D: scaleGizmo.view3D active: scaleGizmo.visible globalOrientation: scaleGizmo.globalOrientation + dragHelper: scaleGizmo.dragHelper onScaleCommit: scaleGizmo.scaleCommit() onScaleChange: scaleGizmo.scaleChange() @@ -140,6 +146,7 @@ Node { view3D: scaleGizmo.view3D active: scaleGizmo.visible globalOrientation: scaleGizmo.globalOrientation + dragHelper: scaleGizmo.dragHelper onScaleCommit: scaleGizmo.scaleCommit() onScaleChange: scaleGizmo.scaleChange() @@ -171,15 +178,16 @@ Node { grabsMouse: scaleGizmo.targetNode priority: 1 active: scaleGizmo.visible + dragHelper: scaleGizmo.dragHelper - property var _startScale - property var _startScreenPos + property vector3d _startScale + property point _startScreenPos function localScale(screenPos) { var yDelta = screenPos.y - _startScreenPos.y; if (yDelta === 0) - return; + return _startScale; var scaler = 1.0 + (yDelta * 0.025); if (scaler === 0) scaler = 0.0001; @@ -203,7 +211,6 @@ Node { onDragged: { if (!scaleGizmo.targetNode) return; - scaleGizmo.targetNode.scale = localScale(screenPos); scaleGizmo.scaleChange(); } diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleRod.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleRod.qml index 85fc39f900e..231a39f46f8 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleRod.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleRod.qml @@ -36,7 +36,7 @@ DirectionalDraggable { signal scaleCommit() signal scaleChange() - property var _startScale + property vector3d _startScale Model { source: "#Cube" diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp index 71a67a95772..4c855576341 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp @@ -83,6 +83,11 @@ QQuick3DNode *MouseArea3D::pickNode() const return m_pickNode; } +MouseArea3D *MouseArea3D::dragHelper() const +{ + return m_dragHelper; +} + qreal MouseArea3D::x() const { return m_x; @@ -179,6 +184,15 @@ void MouseArea3D::setPickNode(QQuick3DNode *node) emit pickNodeChanged(); } +void MouseArea3D::setDragHelper(MouseArea3D *dragHelper) +{ + if (m_dragHelper == dragHelper) + return; + + m_dragHelper = dragHelper; + emit dragHelperChanged(); +} + void MouseArea3D::setX(qreal x) { if (qFuzzyCompare(m_x, x)) @@ -433,19 +447,22 @@ void MouseArea3D::applyFreeRotation(QQuick3DNode *node, const QVector3D &startRo node->rotate(degrees, finalAxis, QQuick3DNode::SceneSpace); } -QVector3D MouseArea3D::getMousePosInPlane(const QPointF &mousePosInView) const +QVector3D MouseArea3D::getMousePosInPlane(const MouseArea3D *helper, + const QPointF &mousePosInView) const { + if (!helper) + helper = this; const QVector3D mousePos1(float(mousePosInView.x()), float(mousePosInView.y()), 0); const QVector3D mousePos2(float(mousePosInView.x()), float(mousePosInView.y()), 1); const QVector3D rayPos0 = m_view3D->mapTo3DScene(mousePos1); const QVector3D rayPos1 = m_view3D->mapTo3DScene(mousePos2); - const QVector3D globalPlanePosition = mapPositionToScene(QVector3D(0, 0, 0)); + const QVector3D globalPlanePosition = helper->mapPositionToScene(QVector3D(0, 0, 0)); const QVector3D intersectGlobalPos = rayIntersectsPlane(rayPos0, rayPos1, globalPlanePosition, forward()); if (qFuzzyCompare(intersectGlobalPos.z(), -1)) return intersectGlobalPos; - return mapPositionFromScene(intersectGlobalPos); + return helper->mapPositionFromScene(intersectGlobalPos); } bool MouseArea3D::eventFilter(QObject *, QEvent *event) @@ -505,7 +522,13 @@ bool MouseArea3D::eventFilter(QObject *, QEvent *event) case QEvent::MouseButtonPress: { auto const mouseEvent = static_cast(event); if (mouseEvent->button() == Qt::LeftButton) { - m_mousePosInPlane = getMousePosInPlane(mouseEvent->pos()); + // Reset drag helper area to global transform of this area + if (m_dragHelper) { + m_dragHelper->setPosition(scenePosition()); + m_dragHelper->setRotation(sceneRotation()); + m_dragHelper->setScale(sceneScale()); + } + m_mousePosInPlane = getMousePosInPlane(m_dragHelper, mouseEvent->pos()); if (mouseOnTopOfMouseArea(m_mousePosInPlane, mouseEvent->pos())) { setDragging(true); emit pressed(m_mousePosInPlane, mouseEvent->pos(), pickAngle); @@ -527,7 +550,7 @@ bool MouseArea3D::eventFilter(QObject *, QEvent *event) auto const mouseEvent = static_cast(event); if (mouseEvent->button() == Qt::LeftButton) { if (m_dragging) { - QVector3D mousePosInPlane = getMousePosInPlane(mouseEvent->pos()); + QVector3D mousePosInPlane = getMousePosInPlane(m_dragHelper, mouseEvent->pos()); if (qFuzzyCompare(mousePosInPlane.z(), -1)) mousePosInPlane = m_mousePosInPlane; setDragging(false); @@ -554,7 +577,8 @@ bool MouseArea3D::eventFilter(QObject *, QEvent *event) case QEvent::MouseMove: case QEvent::HoverMove: { auto const mouseEvent = static_cast(event); - const QVector3D mousePosInPlane = getMousePosInPlane(mouseEvent->pos()); + const QVector3D mousePosInPlane = getMousePosInPlane(m_dragging ? m_dragHelper : this, + mouseEvent->pos()); const bool hasMouse = mouseOnTopOfMouseArea(mousePosInPlane, mouseEvent->pos()); setHovering(hasMouse); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.h index c824b92969d..2d8dbc14416 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.h @@ -55,6 +55,7 @@ class MouseArea3D : public QQuick3DNode Q_PROPERTY(QPointF circlePickArea READ circlePickArea WRITE setCirclePickArea NOTIFY circlePickAreaChanged) Q_PROPERTY(qreal minAngle READ minAngle WRITE setMinAngle NOTIFY minAngleChanged) Q_PROPERTY(QQuick3DNode *pickNode READ pickNode WRITE setPickNode NOTIFY pickNodeChanged) + Q_PROPERTY(MouseArea3D *dragHelper READ dragHelper WRITE setDragHelper NOTIFY dragHelperChanged) Q_INTERFACES(QQmlParserStatus) @@ -76,6 +77,7 @@ public: QPointF circlePickArea() const; qreal minAngle() const; QQuick3DNode *pickNode() const; + MouseArea3D *dragHelper() const; static qreal mouseDragMultiplier() { return .02; } @@ -86,6 +88,7 @@ public slots: void setCirclePickArea(const QPointF &pickArea); void setMinAngle(qreal angle); void setPickNode(QQuick3DNode *node); + void setDragHelper(MouseArea3D *dragHelper); void setX(qreal x); void setY(qreal y); @@ -126,6 +129,7 @@ signals: void circlePickAreaChanged(); void minAngleChanged(); void pickNodeChanged(); + void dragHelperChanged(); // angle parameter is only set if circlePickArea is specified void pressed(const QVector3D &scenePos, const QPoint &screenPos, qreal angle); @@ -156,7 +160,7 @@ private: bool m_dragging = false; bool m_active = false; - QVector3D getMousePosInPlane(const QPointF &mousePosInView) const; + QVector3D getMousePosInPlane(const MouseArea3D *helper, const QPointF &mousePosInView) const; static MouseArea3D *s_mouseGrab; bool m_grabsMouse = false; @@ -164,6 +168,7 @@ private: QPointF m_circlePickArea; qreal m_minAngle = 0.; QQuick3DNode *m_pickNode = nullptr; + MouseArea3D *m_dragHelper = nullptr; }; } From 3094d5b3ae9074c22f20f068d59687f45a29af48 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 11 Dec 2019 12:52:57 +0100 Subject: [PATCH 14/27] QmlDesigner: Fix missing forward declare Amends f26d770322ca6b6b4575a7e2. Change-Id: I2ed208c54ec0f5d2e398870d9fede985d05c38b6 Reviewed-by: hjk --- .../components/connectioneditor/connectionviewwidget.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h index 4e4967bbf88..c1f1271fcac 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h @@ -29,6 +29,7 @@ #include QT_BEGIN_NAMESPACE +class QShortcut; class QToolButton; class QTableView; class QListView; From 88bbd748dd7837fcdb386f0d30094d461e8d9395 Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Wed, 11 Dec 2019 14:45:40 +0100 Subject: [PATCH 15/27] QmlDesigner: Fix material manager Task-number: QDS-1332 Change-Id: I70828c3ce584ab72115f92dda4a27341e00085e2 Reviewed-by: Thomas Hartmann --- .../imports/HelperWidgets/EditableListView.qml | 13 +++++++++---- .../propertyeditor/propertyeditorvalue.cpp | 7 +++++-- .../components/propertyeditor/propertyeditorvalue.h | 1 + .../propertyeditor/propertyeditorview.cpp | 4 +++- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/EditableListView.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/EditableListView.qml index 050f8f45ed3..5b0a61d5c0c 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/EditableListView.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/EditableListView.qml @@ -55,8 +55,6 @@ Rectangle { border.color: StudioTheme.Values.themeControlOutline border.width: StudioTheme.Values.border - property int numVisibleItems: myRepeater.count - Layout.preferredWidth: StudioTheme.Values.height * 10 Layout.preferredHeight: myColumn.height @@ -158,6 +156,13 @@ Rectangle { } } + Item { + id: dummyItem + visible: myRepeater.count === 0 + width: StudioTheme.Values.height + height: StudioTheme.Values.height + } + Row { id: row spacing: -StudioTheme.Values.border @@ -175,7 +180,7 @@ Rectangle { StudioControls.AbstractButton { buttonIcon: "+" iconFont: StudioTheme.Constants.font - enabled: !myRepeater.dirty + enabled: !myRepeater.dirty && !(editableListView.backendValue.isInModel && !editableListView.backendValue.isIdList) onClicked: { var idx = myRepeater.localModel.push("") - 1 myRepeater.model = myRepeater.localModel // trigger on change handler @@ -187,7 +192,7 @@ Rectangle { StudioControls.AbstractButton { buttonIcon: "-" iconFont: StudioTheme.Constants.font - enabled: myRepeater.model.length + enabled: myRepeater.model.length && !(editableListView.backendValue.isInModel && !editableListView.backendValue.isIdList) onClicked: { var lastItem = myColumn.currentIndex === myRepeater.localModel.length - 1 if (myColumn.currentItem.initialModelData === "") { diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp index 8c4bc832977..b1efd1af0e2 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp @@ -375,7 +375,9 @@ QStringList PropertyEditorValue::getExpressionAsList() const bool PropertyEditorValue::idListAdd(const QString &value) { - QTC_ASSERT(isIdList(), return false); + const QmlDesigner::QmlObjectNode objectNode(modelNode()); + if (!isIdList() && (objectNode.isValid() && objectNode.hasProperty(name()))) + return false; static const QRegExp rx("^[a-z_]\\w*|^[A-Z]\\w*\\.{1}([a-z_]\\w*\\.?)+"); if (!rx.exactMatch(value)) @@ -393,7 +395,6 @@ bool PropertyEditorValue::idListRemove(int idx) QTC_ASSERT(isIdList(), return false); auto stringList = generateStringList(expression()); - if (idx < 0 || idx >= stringList.size()) return false; @@ -438,6 +439,8 @@ QString PropertyEditorValue::generateString(const QStringList &stringList) const { if (stringList.size() > 1) return "[" + stringList.join(",") + "]"; + else if (stringList.isEmpty()) + return QString(); else return stringList.first(); } diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h index 481fbb3458f..a69bca8a739 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h @@ -83,6 +83,7 @@ class PropertyEditorValue : public QObject Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged FINAL) Q_PROPERTY(bool isTranslated READ isTranslated NOTIFY expressionChanged FINAL) + Q_PROPERTY(bool isIdList READ isIdList NOTIFY expressionChanged FINAL) Q_PROPERTY(QStringList expressionAsList READ getExpressionAsList NOTIFY expressionChanged FINAL) Q_PROPERTY(QString name READ nameAsQString FINAL) diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp index 1d0c165bdaf..d97d090f198 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp @@ -280,8 +280,10 @@ void PropertyEditorView::changeExpression(const QString &propertyName) } } - if (value->expression().isEmpty()) + if (value->expression().isEmpty()) { + value->resetValue(); return; + } if (qmlObjectNode.expression(name) != value->expression() || !qmlObjectNode.propertyAffectedByCurrentState(name)) qmlObjectNode.setBindingProperty(name, value->expression()); From 864e79980bb24f0f58ff2294efda7c2bc0ab33a1 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 12 Dec 2019 14:27:30 +0100 Subject: [PATCH 16/27] Boot2Qt: Add QdbRunConfiguration::doAdditionalSetup() This amends b526d789cf. I had forgotten that Boot2Qt no longer inherits from RemoteLinux. Fixes: QTCREATORBUG-23315 Change-Id: Ic0fa4d54df4b7957916be67ec515df57f2fb2ce1 Reviewed-by: hjk --- src/plugins/boot2qt/qdbrunconfiguration.cpp | 5 +++++ src/plugins/boot2qt/qdbrunconfiguration.h | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/boot2qt/qdbrunconfiguration.cpp b/src/plugins/boot2qt/qdbrunconfiguration.cpp index d1abe582290..8fc375d06b8 100644 --- a/src/plugins/boot2qt/qdbrunconfiguration.cpp +++ b/src/plugins/boot2qt/qdbrunconfiguration.cpp @@ -110,6 +110,11 @@ ProjectExplorer::RunConfiguration::ConfigurationState QdbRunConfiguration::ensur return Configured; } +void QdbRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &) +{ + updateTargetInformation(); +} + void QdbRunConfiguration::updateTargetInformation() { const BuildTargetInfo bti = buildTargetInfo(); diff --git a/src/plugins/boot2qt/qdbrunconfiguration.h b/src/plugins/boot2qt/qdbrunconfiguration.h index 0099c63b5ea..123e94fbbdc 100644 --- a/src/plugins/boot2qt/qdbrunconfiguration.h +++ b/src/plugins/boot2qt/qdbrunconfiguration.h @@ -45,9 +45,10 @@ class QdbRunConfiguration : public ProjectExplorer::RunConfiguration public: QdbRunConfiguration(ProjectExplorer::Target *target, Core::Id id); - ConfigurationState ensureConfigured(QString *errorMessage) override; - private: + ConfigurationState ensureConfigured(QString *errorMessage) override; + void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override; + void updateTargetInformation(); QString defaultDisplayName() const; }; From f29a4440fe44b858a4c52ada3480303e90faebb6 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 12 Dec 2019 14:40:46 +0100 Subject: [PATCH 17/27] Qnx: Add QnxRunConfiguration::doAdditionalSetup() Same principle as in b526d789cf. Change-Id: I79b69f709ab401b46d2edef3b5a6b0672e30eaff Reviewed-by: hjk --- src/plugins/qnx/qnxrunconfiguration.cpp | 40 +++++++++++++++---------- src/plugins/qnx/qnxrunconfiguration.h | 3 ++ 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/plugins/qnx/qnxrunconfiguration.cpp b/src/plugins/qnx/qnxrunconfiguration.cpp index d9b35222077..733f80fa2d1 100644 --- a/src/plugins/qnx/qnxrunconfiguration.cpp +++ b/src/plugins/qnx/qnxrunconfiguration.cpp @@ -68,22 +68,14 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Core::Id id) libAspect->setLabelText(tr("Path to Qt libraries on device")); libAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay); - auto updateTargetInformation = [this, target, exeAspect, symbolsAspect] { - - const BuildTargetInfo bti = buildTargetInfo(); - const FilePath localExecutable = bti.targetFilePath; - const DeployableFile depFile = target->deploymentData().deployableForLocalFile(localExecutable); - - exeAspect->setExecutable(FilePath::fromString(depFile.remoteFilePath())); - symbolsAspect->setFilePath(localExecutable); - - emit enabledChanged(); - }; - - connect(target, &Target::deploymentDataChanged, this, updateTargetInformation); - connect(target, &Target::applicationTargetsChanged, this, updateTargetInformation); - connect(target->project(), &Project::parsingFinished, this, updateTargetInformation); - connect(target, &Target::kitChanged, this, updateTargetInformation); + connect(target, &Target::deploymentDataChanged, + this, &QnxRunConfiguration::updateTargetInformation); + connect(target, &Target::applicationTargetsChanged, + this, &QnxRunConfiguration::updateTargetInformation); + connect(target->project(), &Project::parsingFinished, + this, &QnxRunConfiguration::updateTargetInformation); + connect(target, &Target::kitChanged, + this, &QnxRunConfiguration::updateTargetInformation); } Runnable QnxRunConfiguration::runnable() const @@ -100,6 +92,22 @@ Runnable QnxRunConfiguration::runnable() const return r; } +void QnxRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &) +{ + updateTargetInformation(); +} + +void QnxRunConfiguration::updateTargetInformation() +{ + const BuildTargetInfo bti = buildTargetInfo(); + const FilePath localExecutable = bti.targetFilePath; + const DeployableFile depFile = target()->deploymentData() + .deployableForLocalFile(localExecutable); + aspect()->setExecutable(FilePath::fromString(depFile.remoteFilePath())); + aspect()->setFilePath(localExecutable); + emit enabledChanged(); +} + // QnxRunConfigurationFactory QnxRunConfigurationFactory::QnxRunConfigurationFactory() diff --git a/src/plugins/qnx/qnxrunconfiguration.h b/src/plugins/qnx/qnxrunconfiguration.h index 75ec72a66c0..eaa0980d50c 100644 --- a/src/plugins/qnx/qnxrunconfiguration.h +++ b/src/plugins/qnx/qnxrunconfiguration.h @@ -48,6 +48,9 @@ public: private: ProjectExplorer::Runnable runnable() const override; + void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override; + + void updateTargetInformation(); }; class QnxRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory From eb09e814db4e76227c8034692cb0f162536faee8 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 11 Dec 2019 16:00:28 +0200 Subject: [PATCH 18/27] QmlDesigner: Properly update 3D edit view cameras and lights Now edit view will create and remove cameras and light gizmos properly when cameras and lights are added or deleted. Change-Id: I858752c1410f3a40ea2adaf538c281aaee94ec58 Fixes: QDS-1267 Reviewed-by: Thomas Hartmann Reviewed-by: Mahmoud Badri Reviewed-by: Tim Jenssen --- .../qml/qmlpuppet/mockfiles/EditView3D.qml | 17 ++++++++ .../qml2puppet/editor3d/camerageometry.cpp | 19 +++++---- .../qml2puppet/instances/nodeinstanceserver.h | 2 +- .../qt5informationnodeinstanceserver.cpp | 41 ++++++++++++------- .../qt5informationnodeinstanceserver.h | 4 +- 5 files changed, 57 insertions(+), 26 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml index cd98a23fe04..9cdb74fc12c 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml @@ -127,6 +127,15 @@ Window { function addLightGizmo(obj) { + // Insert into first available gizmo + for (var i = 0; i < lightGizmos.length; ++i) { + if (!lightGizmos[i].targetNode) { + lightGizmos[i].targetNode = obj; + return; + } + } + + // No free gizmos available, create a new one var component = Qt.createComponent("LightGizmo.qml"); if (component.status === Component.Ready) { var gizmo = component.createObject(overlayScene, @@ -140,6 +149,14 @@ Window { function addCameraGizmo(obj) { + // Insert into first available gizmo + for (var i = 0; i < cameraGizmos.length; ++i) { + if (!cameraGizmos[i].targetNode) { + cameraGizmos[i].targetNode = obj; + return; + } + } + // No free gizmos available, create a new one var component = Qt.createComponent("CameraGizmo.qml"); if (component.status === Component.Ready) { var geometryName = _generalHelper.generateUniqueName("CameraGeometry"); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp index 605a3dd08f6..0ffebc72463 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp @@ -148,16 +148,19 @@ void CameraGeometry::fillVertexData(QByteArray &vertexData, QByteArray &indexDat auto dataPtr = reinterpret_cast(vertexData.data()); auto indexPtr = reinterpret_cast(indexData.data()); + QMatrix4x4 m; QSSGRenderCamera *camera = m_camera->cameraNode(); - if (qobject_cast(m_camera)) { - // For some reason ortho cameras show double what projection suggests, - // so give them doubled viewport to match visualization to actual camera view - camera->calculateProjection(QRectF(0, 0, m_viewPortRect.width() * 2.0, - m_viewPortRect.height() * 2.0)); - } else { - camera->calculateProjection(m_viewPortRect); + if (camera) { + if (qobject_cast(m_camera)) { + // For some reason ortho cameras show double what projection suggests, + // so give them doubled viewport to match visualization to actual camera view + camera->calculateProjection(QRectF(0, 0, m_viewPortRect.width() * 2.0, + m_viewPortRect.height() * 2.0)); + } else { + camera->calculateProjection(m_viewPortRect); + } + m = camera->projection.inverted(); } - const QMatrix4x4 m = camera->projection.inverted(); const QVector3D farTopLeft = m * QVector3D(1.f, -1.f, 1.f); const QVector3D farBottomRight = m * QVector3D(-1.f, 1.f, 1.f); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h index c369882b419..ba74636733a 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h @@ -155,7 +155,7 @@ public slots: void emitParentChanged(QObject *child); protected: - QList createInstances(const QVector &container); + virtual QList createInstances(const QVector &container); void reparentInstances(const QVector &containerVector); Internal::ChildrenChangeEventFilter *childrenChangeEventFilter(); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index 6cdd9357951..dcaf9a73451 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -409,6 +409,17 @@ void Qt5InformationNodeInstanceServer::modifyProperties( nodeInstanceClient()->valuesModified(createValuesModifiedCommand(properties)); } +QList Qt5InformationNodeInstanceServer::createInstances( + const QVector &container) +{ + const auto createdInstances = NodeInstanceServer::createInstances(container); + + if (m_editView3D) + createCameraAndLightGizmos(createdInstances); + + return createdInstances; +} + void Qt5InformationNodeInstanceServer::handleObjectPropertyChangeTimeout() { modifyVariantValue(m_changedNode, m_changedProperty, @@ -448,16 +459,27 @@ QObject *Qt5InformationNodeInstanceServer::findRootNodeOf3DViewport( return nullptr; } -void Qt5InformationNodeInstanceServer::findCamerasAndLights( - const QList &instanceList, - QObjectList &cameras, QObjectList &lights) const +void Qt5InformationNodeInstanceServer::createCameraAndLightGizmos( + const QList &instanceList) const { + QObjectList cameras; + QObjectList lights; + for (const ServerNodeInstance &instance : instanceList) { if (instance.isSubclassOf("QQuick3DCamera")) cameras << instance.internalObject(); else if (instance.isSubclassOf("QQuick3DAbstractLight")) lights << instance.internalObject(); } + + for (auto &obj : qAsConst(cameras)) { + QMetaObject::invokeMethod(m_editView3D, "addCameraGizmo", + Q_ARG(QVariant, objectToVariant(obj))); + } + for (auto &obj : qAsConst(lights)) { + QMetaObject::invokeMethod(m_editView3D, "addLightGizmo", + Q_ARG(QVariant, objectToVariant(obj))); + } } ServerNodeInstance Qt5InformationNodeInstanceServer::findViewPort( @@ -506,18 +528,7 @@ void Qt5InformationNodeInstanceServer::setup3DEditView(const QList &instanceList); void modifyProperties(const QVector &properties); + QList createInstances(const QVector &container) override; private: void handleObjectPropertyChangeTimeout(); @@ -74,8 +75,7 @@ private: QObject *createEditView3D(QQmlEngine *engine); void setup3DEditView(const QList &instanceList); QObject *findRootNodeOf3DViewport(const QList &instanceList) const; - void findCamerasAndLights( const QList &instanceList, - QObjectList &cameras, QObjectList &lights) const; + void createCameraAndLightGizmos(const QList &instanceList) const; ServerNodeInstance findViewPort(const QList &instanceList); QVector vectorToPropertyValue(const ServerNodeInstance &instance, const PropertyName &propertyName, From 49da199b10a87d0698e9f6ac3f8eafdc3c05bdc2 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 12 Dec 2019 15:46:22 +0200 Subject: [PATCH 19/27] Fix rotation resulting in NaN angle sometimes Change-Id: I88f866c6649f7ec25bc96a7393d0930685e5382b Fixes: QDS-1341 Reviewed-by: Mahmoud Badri Reviewed-by: Thomas Hartmann --- .../qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp index 4c855576341..a0f54d1cc0f 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp @@ -358,6 +358,11 @@ qreal QmlDesigner::Internal::MouseArea3D::getNewRotationAngle( QQuick3DNode *node, const QVector3D &pressPos, const QVector3D ¤tPos, const QVector3D &nodePos, qreal prevAngle, bool trackBall) { + const QVector3D dragVector = currentPos - pressPos; + + if (dragVector.length() < 0.001f) + return prevAngle; + // Get camera to node direction in node orientation QVector3D cameraToNodeDir = getCameraToNodeDir(node); if (trackBall) { From c2bfdff70b4d539e719d7eb78a59ed4214b683f4 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 12 Dec 2019 17:47:33 +0100 Subject: [PATCH 20/27] WebAssembly: Ensure that the device is created after the kits are loaded That way, the device of the WebAssembly Kit is correctly set if device type and device of the kit were previously wrong. Task-number: QTCREATORBUG-23360 Change-Id: I40b6650ede2e632fe5cc7cb27b576de8d1bfd066 Reviewed-by: Alessandro Portale --- src/plugins/webassembly/webassemblyplugin.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/webassembly/webassemblyplugin.cpp b/src/plugins/webassembly/webassemblyplugin.cpp index 97b4ca4ebcb..497efeb7222 100644 --- a/src/plugins/webassembly/webassemblyplugin.cpp +++ b/src/plugins/webassembly/webassemblyplugin.cpp @@ -35,6 +35,7 @@ #include #include +#include using namespace ProjectExplorer; @@ -80,7 +81,9 @@ bool WebAssemblyPlugin::initialize(const QStringList& arguments, QString* errorS void WebAssemblyPlugin::extensionsInitialized() { - ProjectExplorer::DeviceManager::instance()->addDevice(WebAssemblyDevice::create()); + connect(KitManager::instance(), &KitManager::kitsLoaded, this, [] { + DeviceManager::instance()->addDevice(WebAssemblyDevice::create()); + }); } } // namespace Internal From f97de35dd4af80fa5f3d4229ac4aa8519d9e1d38 Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Wed, 11 Dec 2019 21:29:10 +0200 Subject: [PATCH 21/27] Improve edit view 3D "on top" logic - Proxy dialog removed - When the QDS window is minimized/maximized, the edit view 3D follows. The opposite is not true (edit view 3D can be minimized separately). - Edit view 3D is always on top of QDS window. Only exception is when a popup is shown (so that the user can handle the popup). - External apps go normally on top of the edit view 3D. Known (non critical) issues: - Activating the edit view 3D doesn't raise() the QDS window, so if an external app is on top of the edit view 3D then the view is clicked, the external app will be in between the view and the QDS window. - Closing the edit view 3D from the x button doesnt work (causes a restart). This is not in the scope of this commit. Task-number: QDS-1179 Change-Id: I1dd72590037be295b94735de96772307ba14c59c Reviewed-by: Mahmoud Badri Reviewed-by: Thomas Hartmann Reviewed-by: Tim Jenssen --- .../qml/qmlpuppet/commands/commands.pri | 6 +- ...iewcommand.cpp => enable3dviewcommand.cpp} | 28 +-- ...e3dviewcommand.h => enable3dviewcommand.h} | 25 ++- .../commands/update3dviewstatecommand.cpp | 106 +++++++++++ .../commands/update3dviewstatecommand.h | 52 +++--- .../instances/nodeinstanceclientproxy.cpp | 21 ++- .../instances/nodeinstanceclientproxy.h | 6 +- .../nodeinstanceserverinterface.cpp | 10 +- .../interfaces/nodeinstanceserverinterface.h | 6 +- .../qml/qmlpuppet/mockfiles/EditView3D.qml | 12 +- .../instances/nodeinstanceserver.cpp | 6 +- .../qml2puppet/instances/nodeinstanceserver.h | 3 +- .../qt5informationnodeinstanceserver.cpp | 117 ++++-------- .../qt5informationnodeinstanceserver.h | 12 +- src/plugins/coreplugin/icore.h | 2 + src/plugins/coreplugin/mainwindow.cpp | 13 ++ src/plugins/coreplugin/mainwindow.h | 2 + src/plugins/qmldesigner/CMakeLists.txt | 4 +- .../formeditor/editview3dproxydialog.cpp | 168 ------------------ .../components/formeditor/formeditor.pri | 2 - .../components/formeditor/formeditorview.cpp | 5 +- .../formeditor/formeditorwidget.cpp | 15 -- .../components/formeditor/formeditorwidget.h | 5 - .../designercore/include/nodeinstanceview.h | 9 +- .../instances/nodeinstanceserverproxy.cpp | 10 +- .../instances/nodeinstanceserverproxy.h | 3 +- .../instances/nodeinstanceview.cpp | 34 ++-- src/plugins/qmldesigner/qmldesignerplugin.cpp | 11 ++ src/plugins/qmldesigner/qmldesignerplugin.qbs | 8 +- src/tools/qml2puppet/CMakeLists.txt | 3 +- src/tools/qml2puppet/qml2puppet.qbs | 6 +- 31 files changed, 307 insertions(+), 403 deletions(-) rename share/qtcreator/qml/qmlpuppet/commands/{change3dviewcommand.cpp => enable3dviewcommand.cpp} (64%) rename share/qtcreator/qml/qmlpuppet/commands/{change3dviewcommand.h => enable3dviewcommand.h} (65%) create mode 100644 share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp rename src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.h => share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h (51%) delete mode 100644 src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.cpp diff --git a/share/qtcreator/qml/qmlpuppet/commands/commands.pri b/share/qtcreator/qml/qmlpuppet/commands/commands.pri index ffd1ce6dea5..7985b259758 100644 --- a/share/qtcreator/qml/qmlpuppet/commands/commands.pri +++ b/share/qtcreator/qml/qmlpuppet/commands/commands.pri @@ -28,7 +28,8 @@ HEADERS += $$PWD/removesharedmemorycommand.h HEADERS += $$PWD/puppetalivecommand.h HEADERS += $$PWD/changeselectioncommand.h HEADERS += $$PWD/drop3dlibraryitemcommand.h -HEADERS += $$PWD/change3dviewcommand.h +HEADERS += $$PWD/update3dviewstatecommand.h +HEADERS += $$PWD/enable3dviewcommand.h SOURCES += $$PWD/synchronizecommand.cpp SOURCES += $$PWD/debugoutputcommand.cpp @@ -58,4 +59,5 @@ SOURCES += $$PWD/removesharedmemorycommand.cpp SOURCES += $$PWD/puppetalivecommand.cpp SOURCES += $$PWD/changeselectioncommand.cpp SOURCES += $$PWD/drop3dlibraryitemcommand.cpp -SOURCES += $$PWD/change3dviewcommand.cpp +SOURCES += $$PWD/update3dviewstatecommand.cpp +SOURCES += $$PWD/enable3dviewcommand.cpp diff --git a/share/qtcreator/qml/qmlpuppet/commands/change3dviewcommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.cpp similarity index 64% rename from share/qtcreator/qml/qmlpuppet/commands/change3dviewcommand.cpp rename to share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.cpp index ad4832d86b8..7fd3b3f350a 100644 --- a/share/qtcreator/qml/qmlpuppet/commands/change3dviewcommand.cpp +++ b/share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.cpp @@ -23,41 +23,43 @@ ** ****************************************************************************/ -#include "change3dviewcommand.h" +#include "enable3dviewcommand.h" #include +#include namespace QmlDesigner { -Change3DViewCommand::Change3DViewCommand() = default; - -Change3DViewCommand::Change3DViewCommand(const QVector &informationVector) - : m_informationVector(informationVector) +// open / close edit view 3D command +Enable3DViewCommand::Enable3DViewCommand(bool enable) + : m_enable(enable) { } -QVector Change3DViewCommand::informationVector() const +bool Enable3DViewCommand::isEnable() const { - return m_informationVector; + return m_enable; } -QDataStream &operator<<(QDataStream &out, const Change3DViewCommand &command) +QDataStream &operator<<(QDataStream &out, const Enable3DViewCommand &command) { - out << command.informationVector(); + out << qint32(command.isEnable()); return out; } -QDataStream &operator>>(QDataStream &in, Change3DViewCommand &command) +QDataStream &operator>>(QDataStream &in, Enable3DViewCommand &command) { - in >> command.m_informationVector; + qint32 enable; + in >> enable; + command.m_enable = enable; return in; } -QDebug operator <<(QDebug debug, const Change3DViewCommand &command) +QDebug operator<<(QDebug debug, const Enable3DViewCommand &command) { - return debug.nospace() << "Change3DViewCommand(auxiliaryChanges: " << command.m_informationVector << ")"; + return debug.nospace() << "Enable3DViewCommand(enable: " << command.m_enable << ")"; } } // namespace QmlDesigner diff --git a/share/qtcreator/qml/qmlpuppet/commands/change3dviewcommand.h b/share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.h similarity index 65% rename from share/qtcreator/qml/qmlpuppet/commands/change3dviewcommand.h rename to share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.h index 6b1b062da07..cd9529fbb5a 100644 --- a/share/qtcreator/qml/qmlpuppet/commands/change3dviewcommand.h +++ b/share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.h @@ -26,32 +26,29 @@ #pragma once #include -#include - -#include "informationcontainer.h" namespace QmlDesigner { -class Change3DViewCommand +class Enable3DViewCommand { - friend QDataStream &operator>>(QDataStream &in, Change3DViewCommand &command); - friend QDebug operator <<(QDebug debug, const Change3DViewCommand &command); + friend QDataStream &operator>>(QDataStream &in, Enable3DViewCommand &command); + friend QDebug operator<<(QDebug debug, const Enable3DViewCommand &command); public: - Change3DViewCommand(); - explicit Change3DViewCommand(const QVector &auxiliaryChangeVector); + explicit Enable3DViewCommand(bool enable); + Enable3DViewCommand() = default; - QVector informationVector() const; + bool isEnable() const; private: - QVector m_informationVector; + bool m_enable = true; }; -QDataStream &operator<<(QDataStream &out, const Change3DViewCommand &command); -QDataStream &operator>>(QDataStream &in, Change3DViewCommand &command); +QDataStream &operator<<(QDataStream &out, const Enable3DViewCommand &command); +QDataStream &operator>>(QDataStream &in, Enable3DViewCommand &command); -QDebug operator <<(QDebug debug, const Change3DViewCommand &command); +QDebug operator<<(QDebug debug, const Enable3DViewCommand &command); } // namespace QmlDesigner -Q_DECLARE_METATYPE(QmlDesigner::Change3DViewCommand) +Q_DECLARE_METATYPE(QmlDesigner::Enable3DViewCommand) diff --git a/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp new file mode 100644 index 00000000000..b387cf09f3d --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "update3dviewstatecommand.h" + +#include +#include + +namespace QmlDesigner { + +Update3dViewStateCommand::Update3dViewStateCommand(Qt::WindowStates previousStates, + Qt::WindowStates currentStates) + : m_previousStates(previousStates) + , m_currentStates(currentStates) + , m_type(Update3dViewStateCommand::StateChange) +{ +} + +Update3dViewStateCommand::Update3dViewStateCommand(bool active, bool hasPopup) + : m_active(active) + , m_hasPopup(hasPopup) + , m_type(Update3dViewStateCommand::ActiveChange) +{ +} + +Qt::WindowStates Update3dViewStateCommand::previousStates() const +{ + return m_previousStates; +} + +Qt::WindowStates Update3dViewStateCommand::currentStates() const +{ + return m_currentStates; +} + +bool Update3dViewStateCommand::isActive() const +{ + return m_active; +} + +bool Update3dViewStateCommand::hasPopup() const +{ + return m_hasPopup; +} + +Update3dViewStateCommand::Type Update3dViewStateCommand::type() const +{ + return m_type; +} + +QDataStream &operator<<(QDataStream &out, const Update3dViewStateCommand &command) +{ + out << command.previousStates(); + out << command.currentStates(); + out << qint32(command.isActive()); + out << qint32(command.hasPopup()); + out << qint32(command.type()); + + return out; +} + +QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command) +{ + in >> command.m_previousStates; + in >> command.m_currentStates; + qint32 active; + qint32 hasPopup; + qint32 type; + in >> active; + in >> hasPopup; + in >> type; + command.m_active = active; + command.m_hasPopup = hasPopup; + command.m_type = Update3dViewStateCommand::Type(type); + + return in; +} + +QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command) +{ + return debug.nospace() << "Update3dViewStateCommand(type: " << command.m_type << ")"; +} + +} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.h b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h similarity index 51% rename from src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.h rename to share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h index 717deca7f9e..de8511255d5 100644 --- a/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.h +++ b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h @@ -25,43 +25,45 @@ #pragma once -#include "abstractcustomtool.h" - -#include -#include +#include namespace QmlDesigner { -class FormEditorView; -class NodeInstanceView; - -class EditView3DProxyDialog : public QDialog +class Update3dViewStateCommand { - Q_OBJECT + friend QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command); + friend QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command); public: - explicit EditView3DProxyDialog(FormEditorView *view); + enum Type { StateChange, ActiveChange, Empty }; - void invalidate(); + explicit Update3dViewStateCommand(Qt::WindowStates previousStates, Qt::WindowStates currentStates); + explicit Update3dViewStateCommand(bool active, bool hasPopup); + Update3dViewStateCommand() = default; -protected: - void moveEvent(QMoveEvent *event) override; - void closeEvent(QCloseEvent *event) override; - void hideEvent(QHideEvent *event) override; - void focusOutEvent(QFocusEvent *event) override; - void focusInEvent(QFocusEvent *event) override; - void resizeEvent(QResizeEvent *event) override; - bool event(QEvent *event) override; + Qt::WindowStates previousStates() const; + Qt::WindowStates currentStates() const; + + bool isActive() const; + bool hasPopup() const; + + Type type() const; private: - QRect adjustedRect() const; - NodeInstanceView *nodeInstanceView() const; - void showView(); - void hideView(); + Qt::WindowStates m_previousStates = Qt::WindowNoState; + Qt::WindowStates m_currentStates = Qt::WindowNoState; - QPointer m_formEditorView; + bool m_active = false; + bool m_hasPopup = false; + Type m_type = Empty; }; -} //QmlDesigner +QDataStream &operator<<(QDataStream &out, const Update3dViewStateCommand &command); +QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command); +QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command); + +} // namespace QmlDesigner + +Q_DECLARE_METATYPE(QmlDesigner::Update3dViewStateCommand) diff --git a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp index 93520c2f7de..d12cfe327fd 100644 --- a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp +++ b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp @@ -41,7 +41,8 @@ #include "instancecontainer.h" #include "createinstancescommand.h" #include "createscenecommand.h" -#include "change3dviewcommand.h" +#include "update3dviewstatecommand.h" +#include "enable3dviewcommand.h" #include "changevaluescommand.h" #include "changebindingscommand.h" #include "changeauxiliarycommand.h" @@ -361,9 +362,14 @@ void NodeInstanceClientProxy::createScene(const CreateSceneCommand &command) nodeInstanceServer()->createScene(command); } -void NodeInstanceClientProxy::change3DView(const Change3DViewCommand &command) +void NodeInstanceClientProxy::update3DViewState(const Update3dViewStateCommand &command) { - nodeInstanceServer()->change3DView(command); + nodeInstanceServer()->update3DViewState(command); +} + +void NodeInstanceClientProxy::enable3DView(const Enable3DViewCommand &command) +{ + nodeInstanceServer()->enable3DView(command); } void NodeInstanceClientProxy::clearScene(const ClearSceneCommand &command) @@ -453,7 +459,8 @@ void NodeInstanceClientProxy::changeSelection(const ChangeSelectionCommand &comm void NodeInstanceClientProxy::dispatchCommand(const QVariant &command) { static const int createInstancesCommandType = QMetaType::type("CreateInstancesCommand"); - static const int change3DViewCommandType = QMetaType::type("Change3DViewCommand"); + static const int update3dViewStateCommand = QMetaType::type("Update3dViewStateCommand"); + static const int enable3DViewCommandType = QMetaType::type("Enable3DViewCommand"); static const int changeFileUrlCommandType = QMetaType::type("ChangeFileUrlCommand"); static const int createSceneCommandType = QMetaType::type("CreateSceneCommand"); static const int clearSceneCommandType = QMetaType::type("ClearSceneCommand"); @@ -477,8 +484,10 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command) if (commandType == createInstancesCommandType) createInstances(command.value()); - else if (commandType == change3DViewCommandType) - change3DView(command.value()); + else if (commandType == update3dViewStateCommand) + update3DViewState(command.value()); + else if (commandType == enable3DViewCommandType) + enable3DView(command.value()); else if (commandType == changeFileUrlCommandType) changeFileUrl(command.value()); else if (commandType == createSceneCommandType) diff --git a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h index e9044b63efd..5a742947d2d 100644 --- a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h +++ b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h @@ -45,7 +45,8 @@ class CreateSceneCommand; class CreateInstancesCommand; class ClearSceneCommand; class ReparentInstancesCommand; -class Change3DViewCommand; +class Update3dViewStateCommand; +class Enable3DViewCommand; class ChangeFileUrlCommand; class ChangeValuesCommand; class ChangeAuxiliaryCommand; @@ -96,7 +97,8 @@ protected: void changeFileUrl(const ChangeFileUrlCommand &command); void createScene(const CreateSceneCommand &command); void clearScene(const ClearSceneCommand &command); - void change3DView(const Change3DViewCommand &command); + void update3DViewState(const Update3dViewStateCommand &command); + void enable3DView(const Enable3DViewCommand &command); void removeInstances(const RemoveInstancesCommand &command); void removeProperties(const RemovePropertiesCommand &command); void changePropertyBindings(const ChangeBindingsCommand &command); diff --git a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp index 83c8c67ef72..bbd73e63caf 100644 --- a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp +++ b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp @@ -32,7 +32,8 @@ #include "instancecontainer.h" #include "createinstancescommand.h" #include "createscenecommand.h" -#include "change3dviewcommand.h" +#include "update3dviewstatecommand.h" +#include "enable3dviewcommand.h" #include "changevaluescommand.h" #include "changebindingscommand.h" #include "changeauxiliarycommand.h" @@ -91,8 +92,11 @@ void NodeInstanceServerInterface::registerCommands() qRegisterMetaType("CreateSceneCommand"); qRegisterMetaTypeStreamOperators("CreateSceneCommand"); - qRegisterMetaType("Change3DViewCommand"); - qRegisterMetaTypeStreamOperators("Change3DViewCommand"); + qRegisterMetaType("Update3dViewStateCommand"); + qRegisterMetaTypeStreamOperators("Update3dViewStateCommand"); + + qRegisterMetaType("Enable3DViewCommand"); + qRegisterMetaTypeStreamOperators("Enable3DViewCommand"); qRegisterMetaType("ChangeBindingsCommand"); qRegisterMetaTypeStreamOperators("ChangeBindingsCommand"); diff --git a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h index 3dc651ef2f3..e60d99b1e19 100644 --- a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h +++ b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h @@ -33,7 +33,8 @@ class PropertyAbstractContainer; class PropertyBindingContainer; class PropertyValueContainer; -class Change3DViewCommand; +class Update3dViewStateCommand; +class Enable3DViewCommand; class ChangeFileUrlCommand; class ChangeValuesCommand; class ChangeBindingsCommand; @@ -67,7 +68,8 @@ public: virtual void changeFileUrl(const ChangeFileUrlCommand &command) = 0; virtual void createScene(const CreateSceneCommand &command) = 0; virtual void clearScene(const ClearSceneCommand &command) = 0; - virtual void change3DView(const Change3DViewCommand &command) = 0; + virtual void update3DViewState(const Update3dViewStateCommand &command) = 0; + virtual void enable3DView(const Enable3DViewCommand &command) = 0; virtual void removeInstances(const RemoveInstancesCommand &command) = 0; virtual void removeProperties(const RemovePropertiesCommand &command) = 0; virtual void changePropertyBindings(const ChangeBindingsCommand &command) = 0; diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml index 9cdb74fc12c..1e471d73f18 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml @@ -34,14 +34,10 @@ Window { id: viewWindow width: 1024 height: 768 - visible: false - title: "3D" - flags: Qt.Widget | Qt.SplashScreen - - onActiveChanged: { - if (viewWindow.active) - cameraControl.forceActiveFocus() - } + visible: true + title: "3D Edit View" + // need all those flags otherwise the title bar disappears after setting WindowStaysOnTopHint flag later + flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint property alias scene: editView.importScene property alias showEditLight: btnEditViewLight.toggled diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp index d19c0faea46..5f277bf6bb6 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp @@ -332,7 +332,11 @@ void NodeInstanceServer::clearScene(const ClearSceneCommand &/*command*/) m_fileUrl.clear(); } -void NodeInstanceServer::change3DView(const Change3DViewCommand &/*command*/) +void NodeInstanceServer::update3DViewState(const Update3dViewStateCommand &/*command*/) +{ +} + +void NodeInstanceServer::enable3DView(const Enable3DViewCommand &/*command*/) { } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h index ba74636733a..861b674af9f 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h @@ -101,7 +101,8 @@ public: void changeIds(const ChangeIdsCommand &command) override; void createScene(const CreateSceneCommand &command) override; void clearScene(const ClearSceneCommand &command) override; - void change3DView(const Change3DViewCommand &command) override; + void update3DViewState(const Update3dViewStateCommand &command) override; + void enable3DView(const Enable3DViewCommand &command) override; void removeInstances(const RemoveInstancesCommand &command) override; void removeProperties(const RemovePropertiesCommand &command) override; void reparentInstances(const ReparentInstancesCommand &command) override; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index dcaf9a73451..e65b1b4b2da 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -40,7 +40,8 @@ #include "changefileurlcommand.h" #include "clearscenecommand.h" #include "reparentinstancescommand.h" -#include "change3dviewcommand.h" +#include "update3dviewstatecommand.h" +#include "enable3dviewcommand.h" #include "changevaluescommand.h" #include "changebindingscommand.h" #include "changeidscommand.h" @@ -59,7 +60,7 @@ #include "tokencommand.h" #include "removesharedmemorycommand.h" #include "objectnodeinstance.h" -#include +#include "drop3dlibraryitemcommand.h" #include "dummycontextobject.h" #include "../editor3d/generalhelper.h" @@ -119,7 +120,7 @@ QObject *Qt5InformationNodeInstanceServer::createEditView3D(QQmlEngine *engine) QWindow *window = qobject_cast(component.create()); if (!window) { - qWarning() << "Could not create edit view" << component.errors(); + qWarning() << "Could not create edit view 3D: " << component.errors(); return nullptr; } @@ -130,8 +131,6 @@ QObject *Qt5InformationNodeInstanceServer::createEditView3D(QQmlEngine *engine) this, SLOT(handleObjectPropertyCommit(QVariant, QVariant))); QObject::connect(window, SIGNAL(changeObjectProperty(QVariant, QVariant)), this, SLOT(handleObjectPropertyChange(QVariant, QVariant))); - QObject::connect(window, SIGNAL(activeChanged()), - this, SLOT(handleActiveChanged())); QObject::connect(&m_propertyChangeTimer, &QTimer::timeout, this, &Qt5InformationNodeInstanceServer::handleObjectPropertyChangeTimeout); QObject::connect(&m_selectionChangeTimer, &QTimer::timeout, @@ -150,7 +149,7 @@ QObject *Qt5InformationNodeInstanceServer::createEditView3D(QQmlEngine *engine) return window; } -// The selection has changed in the 3D edit view. Empty list indicates selection is cleared. +// The selection has changed in the edit view 3D. Empty list indicates selection is cleared. void Qt5InformationNodeInstanceServer::handleSelectionChanged(const QVariant &objs) { QList instanceList; @@ -231,65 +230,6 @@ void Qt5InformationNodeInstanceServer::modifyVariantValue( } } -void Qt5InformationNodeInstanceServer::showEditView(const QPoint &pos, const QSize &size) -{ - m_blockViewActivate = false; - auto window = qobject_cast(m_editView3D); - if (window) { - activateEditView(); - window->setPosition(pos); - window->resize(size); - } -} - -void Qt5InformationNodeInstanceServer::hideEditView() -{ - m_blockViewActivate = true; - auto window = qobject_cast(m_editView3D); - if (window) - window->hide(); -} - -void Qt5InformationNodeInstanceServer::activateEditView() -{ - auto window = qobject_cast(m_editView3D); - if (window) { - Qt::WindowFlags flags = window->flags(); - -#ifdef Q_OS_MACOS - window->setFlags(Qt::Popup); - window->show(); - window->setFlags(flags); -#else - window->raise(); - window->setFlags(flags | Qt::WindowStaysOnTopHint); - window->show(); - - window->requestActivate(); - window->raise(); - window->setFlags(flags); -#endif - } -} - -void Qt5InformationNodeInstanceServer::moveEditView(const QPoint &pos) -{ - auto window = qobject_cast(m_editView3D); - if (window) { - activateEditView(); - window->setPosition(pos); - } -} - -void Qt5InformationNodeInstanceServer::resizeEditView(const QSize &size) -{ - auto window = qobject_cast(m_editView3D); - if (window) { - activateEditView(); - window->resize(size); - } -} - void Qt5InformationNodeInstanceServer::handleObjectPropertyCommit(const QVariant &object, const QVariant &propName) { @@ -324,14 +264,6 @@ void Qt5InformationNodeInstanceServer::updateViewPortRect() viewPortProperty.write(viewPortrect); } -void Qt5InformationNodeInstanceServer::handleActiveChanged() -{ - if (m_blockViewActivate) - return; - - activateEditView(); -} - Qt5InformationNodeInstanceServer::Qt5InformationNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) : Qt5NodeInstanceServer(nodeInstanceClient) { @@ -759,17 +691,36 @@ void Qt5InformationNodeInstanceServer::changePropertyValues(const ChangeValuesCo startRenderTimer(); } -void Qt5InformationNodeInstanceServer::change3DView(const Change3DViewCommand &command) +// update 3D view window state when the main app window state change +void Qt5InformationNodeInstanceServer::update3DViewState(const Update3dViewStateCommand &command) { - for (const InformationContainer &container : command.informationVector()) { - if (container.name() == InformationName::ShowView) - showEditView(container.information().toPoint(), container.secondInformation().toSize()); - else if (container.name() == InformationName::HideView) - hideEditView(); - else if (container.name() == InformationName::MoveView) - moveEditView(container.information().toPoint()); - else if (container.name() == InformationName::ResizeView) - resizeEditView(container.secondInformation().toSize()); + auto window = qobject_cast(m_editView3D); + if (window) { + if (command.type() == Update3dViewStateCommand::StateChange) { + if (command.previousStates() & Qt::WindowMinimized) // main window expanded from minimize state + window->show(); + else if (command.currentStates() & Qt::WindowMinimized) // main window minimized + window->hide(); + } else if (command.type() == Update3dViewStateCommand::ActiveChange) { + window->setFlag(Qt::WindowStaysOnTopHint, command.isActive()); + + // main window has a popup open, lower the edit view 3D so that the pop up is visible + if (command.hasPopup()) + window->lower(); + } + } +} + +void Qt5InformationNodeInstanceServer::enable3DView(const Enable3DViewCommand &command) +{ + // TODO: this method is not currently in use as the 3D view is currently enabled by resetting the puppet. + // It should however be implemented here. + + auto window = qobject_cast(m_editView3D); + if (window && !command.isEnable()) { + // TODO: remove the 3D view + } else if (!window && command.isEnable()) { + // TODO: create the 3D view } } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h index 0ac073655b6..079b811c054 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h @@ -38,12 +38,14 @@ namespace QmlDesigner { class Qt5InformationNodeInstanceServer : public Qt5NodeInstanceServer { Q_OBJECT + public: explicit Qt5InformationNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient); void reparentInstances(const ReparentInstancesCommand &command) override; void clearScene(const ClearSceneCommand &command) override; - void change3DView(const Change3DViewCommand &command) override; + void update3DViewState(const Update3dViewStateCommand &command) override; + void enable3DView(const Enable3DViewCommand &command) override; void createScene(const CreateSceneCommand &command) override; void completeComponent(const CompleteComponentCommand &command) override; void token(const TokenCommand &command) override; @@ -56,7 +58,6 @@ private slots: void handleObjectPropertyCommit(const QVariant &object, const QVariant &propName); void handleObjectPropertyChange(const QVariant &object, const QVariant &propName); void updateViewPortRect(); - void handleActiveChanged(); protected: void collectItemChangesAndSendChangeCommands() override; @@ -84,12 +85,6 @@ private: const PropertyName &propertyName, ValuesModifiedCommand::TransactionOption option); - void showEditView(const QPoint &pos, const QSize &size); - void hideEditView(); - void activateEditView(); - void moveEditView(const QPoint &pos); - void resizeEditView(const QSize &size); - QObject *m_editView3D = nullptr; QSet m_parentChangedSet; QList m_completedComponentList; @@ -99,7 +94,6 @@ private: QVariant m_changedNode; PropertyName m_changedProperty; ServerNodeInstance m_viewPortInstance; - bool m_blockViewActivate = false; QObject *m_rootNode = nullptr; ChangeSelectionCommand m_pendingSelectionChangeCommand; }; diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index b338839110d..783f890599c 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -164,6 +164,8 @@ signals: void coreAboutToClose(); void contextAboutToChange(const QList &context); void contextChanged(const Core::Context &context); + void windowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates); + void windowActivationChanged(bool isActive, bool hasPopup); public: /* internal use */ diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 94e5aa78fea..da53dd75287 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -201,6 +201,19 @@ MainWindow::MainWindow() this, &MainWindow::openDroppedFiles); } +// Edit View 3D needs to know when the main windows's state or activation change +void MainWindow::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::WindowStateChange) { + emit m_coreImpl->windowStateChanged(m_previousWindowStates, windowState()); + m_previousWindowStates = windowState(); + } else if (event->type() == QEvent::ActivationChange) { + auto lastChild = qobject_cast(children().last()); + bool hasPopup = lastChild && lastChild->isActiveWindow(); + emit m_coreImpl->windowActivationChanged(isActiveWindow(), hasPopup); + } +} + NavigationWidget *MainWindow::navigationWidget(Side side) const { return side == Side::Left ? m_leftNavigationWidget : m_rightNavigationWidget; diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index 26dc607cbed..a3a537b231a 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -114,6 +114,7 @@ public slots: protected: void closeEvent(QCloseEvent *event) override; + void changeEvent(QEvent *event) override; private: void openFile(); @@ -192,6 +193,7 @@ private: QToolButton *m_toggleRightSideBarButton = nullptr; QColor m_overrideColor; QList> m_preCloseListeners; + Qt::WindowStates m_previousWindowStates = Qt::WindowNoState; }; } // namespace Internal diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt index 1685aeaa792..6d3bca379c0 100644 --- a/src/plugins/qmldesigner/CMakeLists.txt +++ b/src/plugins/qmldesigner/CMakeLists.txt @@ -140,7 +140,8 @@ extend_qtc_plugin(QmlDesigner valueschangedcommand.cpp valueschangedcommand.h changeselectioncommand.cpp changeselectioncommand.h drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h - change3dviewcommand.cpp change3dviewcommand.h + update3dviewstatecommand.cpp update3dviewstatecommand.h + enable3dviewcommand.cpp enable3dviewcommand.h ) extend_qtc_plugin(QmlDesigner @@ -235,7 +236,6 @@ extend_qtc_plugin(QmlDesigner snappinglinecreator.cpp snappinglinecreator.h toolbox.cpp toolbox.h option3daction.cpp option3daction.h - editview3dproxydialog.cpp editview3dproxydialog.h ) extend_qtc_plugin(QmlDesigner diff --git a/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.cpp b/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.cpp deleted file mode 100644 index 505eeacd1ff..00000000000 --- a/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "editview3dproxydialog.h" -#include "formeditorview.h" - -#include - -#include - -#include - -#include -#include -#include -#include - -namespace QmlDesigner { - -const int borderOffset = 8; - -static int titleBarHeight() { - return QApplication::style()->pixelMetric(QStyle::PM_TitleBarHeight); -} - -EditView3DProxyDialog::EditView3DProxyDialog(FormEditorView *view) : - QDialog(Core::ICore::dialogParent()) - ,m_formEditorView(view) -{ - setFocusPolicy(Qt::ClickFocus); - setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - - if (Utils::HostOsInfo::isMacHost()) { - setWindowFlag(Qt::Tool); - setAttribute(Qt::WA_MacAlwaysShowToolWindow); - } - - resize(1024, 768); -} - -void EditView3DProxyDialog::invalidate() -{ - if (nodeInstanceView() && isVisible()) - nodeInstanceView()->show3DView(adjustedRect()); -} - -void EditView3DProxyDialog::moveEvent(QMoveEvent *event) -{ - if (nodeInstanceView()) - nodeInstanceView()->move3DView(pos() + QPoint(borderOffset, titleBarHeight() + 2 * borderOffset)); - - QDialog::moveEvent(event); -} - -void EditView3DProxyDialog::closeEvent(QCloseEvent *event) -{ - if (m_formEditorView) { - m_formEditorView->toggle3DViewEnabled(false); - m_formEditorView->setupOption3DAction(); - } - - nodeInstanceView()->hide3DView(); - - QDialog::closeEvent(event); -} - -void EditView3DProxyDialog::hideEvent(QHideEvent *event) -{ - if (m_formEditorView) { - m_formEditorView->toggle3DViewEnabled(false); - m_formEditorView->setupOption3DAction(); - } - - nodeInstanceView()->hide3DView(); - - QDialog::hideEvent(event); -} - -void EditView3DProxyDialog::focusOutEvent(QFocusEvent *event) -{ - if (isVisible()) - showView(); - - QDialog::focusOutEvent(event); -} - -void EditView3DProxyDialog::focusInEvent(QFocusEvent *event) -{ - showView(); - - QDialog::focusInEvent(event); -} - -void EditView3DProxyDialog::resizeEvent(QResizeEvent *event) -{ - if (nodeInstanceView()) - nodeInstanceView()->show3DView(adjustedRect()); - - QDialog::resizeEvent(event); -} - -bool EditView3DProxyDialog::event(QEvent *event) -{ - if (event->type() == QEvent::WindowActivate) { - showView(); - } else if (event->type() == QEvent::NonClientAreaMouseButtonPress) { - auto mouseMoveEvent = static_cast(event); - if (mouseMoveEvent->buttons() & Qt::LeftButton) - hideView(); - } else if (event->type() == QEvent::NonClientAreaMouseButtonRelease) { - auto mouseMoveEvent = static_cast(event); - if (mouseMoveEvent->buttons() & Qt::LeftButton) - showView(); - } - - return QDialog::event(event); -} - -QRect EditView3DProxyDialog::adjustedRect() const -{ - return QRect(pos(), size()).adjusted(borderOffset, - titleBarHeight() + 2 * borderOffset, - -borderOffset, titleBarHeight()); -} - -NodeInstanceView *EditView3DProxyDialog::nodeInstanceView() const -{ - if (m_formEditorView) - return m_formEditorView->nodeInstanceView(); - - return nullptr; -} - -void EditView3DProxyDialog::showView() -{ - if (nodeInstanceView()) - nodeInstanceView()->show3DView(adjustedRect()); -} - -void EditView3DProxyDialog::hideView() -{ - if (nodeInstanceView()) - nodeInstanceView()->hide3DView(); -} - -} //QmlDesigner diff --git a/src/plugins/qmldesigner/components/formeditor/formeditor.pri b/src/plugins/qmldesigner/components/formeditor/formeditor.pri index 15de28f5041..5bff19e664c 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditor.pri +++ b/src/plugins/qmldesigner/components/formeditor/formeditor.pri @@ -1,6 +1,5 @@ VPATH += $$PWD SOURCES += formeditoritem.cpp \ - editview3dproxydialog.cpp \ formeditorview.cpp \ formeditorscene.cpp \ formeditorwidget.cpp \ @@ -41,7 +40,6 @@ SOURCES += formeditoritem.cpp \ option3daction.cpp HEADERS += formeditorscene.h \ - editview3dproxydialog.h \ formeditorwidget.h \ formeditoritem.h \ formeditorview.h \ diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp index 90707a58876..ee7b3f18a9a 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp @@ -24,6 +24,7 @@ ****************************************************************************/ #include "formeditorview.h" +#include "nodeinstanceview.h" #include "selectiontool.h" #include "movetool.h" #include "option3daction.h" @@ -475,8 +476,6 @@ void FormEditorView::instancesCompleted(const QVector &completedNodeL itemNodeList.append(item); } } - if (node.isRootNode()) - formEditorWidget()->invalidate3DEditor(); } currentTool()->instancesCompleted(itemNodeList); } @@ -598,7 +597,7 @@ void FormEditorView::toggle3DViewEnabled(bool enabled) else rootModelNode().setAuxiliaryData("3d-view", false); - formEditorWidget()->set3dEditorVisibility(enabled); + nodeInstanceView()->enable3DView(enabled); } QmlItemNode findRecursiveQmlItemNode(const QmlObjectNode &firstQmlObjectNode) diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp index fdad23a8802..f5970dc0e06 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp @@ -24,7 +24,6 @@ ****************************************************************************/ #include "designeractionmanager.h" -#include "editview3dproxydialog.h" #include "formeditorwidget.h" #include "formeditorscene.h" #include "qmldesignerplugin.h" @@ -174,14 +173,11 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) : fillLayout->addWidget(m_graphicsView.data()); m_graphicsView.data()->setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))))); - - m_editView3DProxyDialog = new EditView3DProxyDialog(view); } void FormEditorWidget::changeTransformTool(bool checked) { if (checked) - m_formEditorView->changeToTransformTools(); } @@ -397,17 +393,6 @@ FormEditorGraphicsView *FormEditorWidget::graphicsView() const return m_graphicsView; } -void FormEditorWidget::set3dEditorVisibility(bool b) -{ - m_editView3DProxyDialog->setVisible(b); -} - -void FormEditorWidget::invalidate3DEditor() -{ - if (m_editView3DProxyDialog) - m_editView3DProxyDialog->invalidate(); -} - DocumentWarningWidget *FormEditorWidget::errorWidget() { if (m_documentErrorWidget.isNull()) { diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h index d1c55885288..f7e0d8a92d2 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h +++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h @@ -37,7 +37,6 @@ QT_END_NAMESPACE namespace QmlDesigner { -class EditView3DProxyDialog; class ZoomAction; class LineEditAction; class BackgroundAction; @@ -87,9 +86,6 @@ public: FormEditorGraphicsView *graphicsView() const; - void set3dEditorVisibility(bool b); - void invalidate3DEditor(); - protected: void wheelEvent(QWheelEvent *event) override; QActionGroup *toolActionGroup() const; @@ -120,7 +116,6 @@ private: QPointer m_option3DAction; QPointer m_resetAction; QPointer m_documentErrorWidget; - QPointer m_editView3DProxyDialog; }; } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h index a6de5fd6c66..f6b705acc3f 100644 --- a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h +++ b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h @@ -59,7 +59,6 @@ class CreateSceneCommand; class CreateInstancesCommand; class ClearSceneCommand; class ReparentInstancesCommand; -class Change3DViewCommand; class ChangeFileUrlCommand; class ChangeValuesCommand; class ChangeBindingsCommand; @@ -143,15 +142,14 @@ public: void selectedNodesChanged(const QList &selectedNodeList, const QList &lastSelectedNodeList) override; - void show3DView(const QRect &rect); - void move3DView(const QPoint &position); - void hide3DView(); + void mainWindowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates); + void mainWindowActiveChanged(bool active, bool hasPopup); + void enable3DView(bool enable); protected: void timerEvent(QTimerEvent *event) override; private: // functions - enum ViewAction { Show, Move, Hide }; void activateState(const NodeInstance &instance); void activateBaseState(); @@ -176,7 +174,6 @@ private: // functions CreateSceneCommand createCreateSceneCommand(); - Change3DViewCommand createChange3DViewCommand(ViewAction action, const QPoint &pos = {}, const QSize &size = {}) const; ClearSceneCommand createClearSceneCommand() const; CreateInstancesCommand createCreateInstancesCommand(const QList &instanceList) const; CompleteComponentCommand createComponentCompleteCommand(const QList &instanceList) const; diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp index 39de64f9ae7..d979e3dd325 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp @@ -29,7 +29,8 @@ #include #include -#include +#include +#include #include #include #include @@ -652,7 +653,12 @@ void NodeInstanceServerProxy::clearScene(const ClearSceneCommand &command) writeCommand(QVariant::fromValue(command)); } -void NodeInstanceServerProxy::change3DView(const Change3DViewCommand &command) +void NodeInstanceServerProxy::update3DViewState(const Update3dViewStateCommand &command) +{ + writeCommand(QVariant::fromValue(command)); +} + +void NodeInstanceServerProxy::enable3DView(const Enable3DViewCommand &command) { writeCommand(QVariant::fromValue(command)); } diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h index 62c361dbd1a..25dd7bec1f7 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h @@ -69,7 +69,8 @@ public: void createInstances(const CreateInstancesCommand &command) override; void changeFileUrl(const ChangeFileUrlCommand &command) override; void createScene(const CreateSceneCommand &command) override; - void change3DView(const Change3DViewCommand &command) override; + void update3DViewState(const Update3dViewStateCommand &command) override; + void enable3DView(const Enable3DViewCommand &command) override; void clearScene(const ClearSceneCommand &command) override; void removeInstances(const RemoveInstancesCommand &command) override; void changeSelection(const ChangeSelectionCommand &command) override; diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp index 9aa8d2f41ca..95283287540 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp @@ -48,7 +48,8 @@ #include "clearscenecommand.h" #include "changefileurlcommand.h" #include "reparentinstancescommand.h" -#include "change3dviewcommand.h" +#include "update3dviewstatecommand.h" +#include "enable3dviewcommand.h" #include "changevaluescommand.h" #include "changeauxiliarycommand.h" #include "changebindingscommand.h" @@ -979,20 +980,6 @@ ClearSceneCommand NodeInstanceView::createClearSceneCommand() const return {}; } -Change3DViewCommand NodeInstanceView::createChange3DViewCommand(ViewAction action, const QPoint &pos, const QSize &size) const -{ - InformationName informationName = InformationName::ShowView; - - if (action == ViewAction::Move) - informationName = InformationName::MoveView; - else if (action == ViewAction::Hide) - informationName = InformationName::HideView; - - const qint32 instanceId = 0; - - return Change3DViewCommand({ InformationContainer(instanceId, informationName, pos, size) }); -} - CompleteComponentCommand NodeInstanceView::createComponentCompleteCommand(const QList &instanceList) const { QVector containerList; @@ -1473,21 +1460,22 @@ void NodeInstanceView::selectedNodesChanged(const QList &selectedNode nodeInstanceServer()->changeSelection(createChangeSelectionCommand(selectedNodeList)); } -void NodeInstanceView::move3DView(const QPoint &position) +void NodeInstanceView::mainWindowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates) { - nodeInstanceServer()->change3DView(createChange3DViewCommand(ViewAction::Move, position)); + if (nodeInstanceServer()) + nodeInstanceServer()->update3DViewState(Update3dViewStateCommand(previousStates, currentStates)); } -void NodeInstanceView::hide3DView() +void NodeInstanceView::mainWindowActiveChanged(bool active, bool hasPopup) { - nodeInstanceServer()->change3DView(createChange3DViewCommand(ViewAction::Hide)); + if (nodeInstanceServer()) + nodeInstanceServer()->update3DViewState(Update3dViewStateCommand(active, hasPopup)); } -void NodeInstanceView::show3DView(const QRect &rect) +// enable / disable 3D edit View +void NodeInstanceView::enable3DView(bool enable) { - nodeInstanceServer()->change3DView(createChange3DViewCommand(ViewAction::Show, - rect.topLeft(), - rect.size())); + nodeInstanceServer()->enable3DView(Enable3DViewCommand(enable)); } void NodeInstanceView::timerEvent(QTimerEvent *event) diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp index 928c19b02c0..0fb5f19f2b5 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.cpp +++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp @@ -31,6 +31,7 @@ #include "designmodecontext.h" #include "openuiqmlfiledialog.h" #include "generateresource.h" +#include "nodeinstanceview.h" #include #include @@ -249,6 +250,16 @@ void QmlDesignerPlugin::extensionsInitialized() connect(Core::ICore::instance(), &Core::ICore::coreAboutToOpen, this, [this] { integrateIntoQtCreator(&d->mainWidget); }); + + connect(Core::ICore::instance(), &Core::ICore::windowStateChanged, this, + [this] (Qt::WindowStates previousStates, Qt::WindowStates currentStates) { + d->viewManager.nodeInstanceView()->mainWindowStateChanged(previousStates, currentStates); + }); + + connect(Core::ICore::instance(), &Core::ICore::windowActivationChanged, this, + [this] (bool isActive, bool hasPopup) { + d->viewManager.nodeInstanceView()->mainWindowActiveChanged(isActive, hasPopup); + }); } static QStringList allUiQmlFilesforCurrentProject(const Utils::FilePath &fileName) diff --git a/src/plugins/qmldesigner/qmldesignerplugin.qbs b/src/plugins/qmldesigner/qmldesignerplugin.qbs index 7047ffa1b88..1ef8407d8e7 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.qbs +++ b/src/plugins/qmldesigner/qmldesignerplugin.qbs @@ -171,8 +171,10 @@ Project { "commands/changeselectioncommand.h", "commands/drop3dlibraryitemcommand.cpp", "commands/drop3dlibraryitemcommand.h", - "commands/change3dviewcommand.cpp", - "commands/change3dviewcommand.h", + "commands/update3dviewstatecommand.cpp", + "commands/update3dviewstatecommand.h", + "commands/enable3dviewcommand.cpp", + "commands/enable3dviewcommand.h", "container/addimportcontainer.cpp", "container/addimportcontainer.h", "container/idcontainer.cpp", @@ -454,8 +456,6 @@ Project { "formeditor/controlelement.h", "formeditor/dragtool.cpp", "formeditor/dragtool.h", - "formeditor/editview3dproxydialog.cpp", - "formeditor/editview3dproxydialog.h", "formeditor/formeditor.qrc", "formeditor/formeditorgraphicsview.cpp", "formeditor/formeditorgraphicsview.h", diff --git a/src/tools/qml2puppet/CMakeLists.txt b/src/tools/qml2puppet/CMakeLists.txt index ea449b4010a..eb9abeda162 100644 --- a/src/tools/qml2puppet/CMakeLists.txt +++ b/src/tools/qml2puppet/CMakeLists.txt @@ -46,7 +46,8 @@ extend_qtc_executable(qml2puppet tokencommand.cpp tokencommand.h changeselectioncommand.cpp changeselectioncommand.h drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h - change3dviewcommand.cpp change3dviewcommand.h + update3dviewstatecommand.cpp update3dviewstatecommand.h + enable3dviewcommand.cpp enable3dviewcommand.h valueschangedcommand.cpp ) diff --git a/src/tools/qml2puppet/qml2puppet.qbs b/src/tools/qml2puppet/qml2puppet.qbs index 40719787498..fb73413038f 100644 --- a/src/tools/qml2puppet/qml2puppet.qbs +++ b/src/tools/qml2puppet/qml2puppet.qbs @@ -97,8 +97,10 @@ QtcTool { "commands/changeselectioncommand.h", "commands/drop3dlibraryitemcommand.cpp", "commands/drop3dlibraryitemcommand.h", - "commands/change3dviewcommand.cpp", - "commands/change3dviewcommand.h", + "commands/update3dviewstatecommand.cpp", + "commands/update3dviewstatecommand.h", + "commands/enable3dviewcommand.cpp", + "commands/enable3dviewcommand.h", "container/addimportcontainer.cpp", "container/addimportcontainer.h", "container/idcontainer.cpp", From 82f2667ab390bab7785d6f62d12824701195bb35 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 13 Dec 2019 15:28:15 +0200 Subject: [PATCH 22/27] QmlDesigner: Fix minor edit 3D view ui issues in mac Change-Id: Ia86b5f828d147ca0c3593da7f7dcb77696fdeead Reviewed-by: Mahmoud Badri Reviewed-by: Thomas Hartmann --- .../qml/qmlpuppet/mockfiles/EditView3D.qml | 60 +++++++++---------- .../qml2puppet/editor3d/generalhelper.cpp | 9 +++ .../qml2puppet/editor3d/generalhelper.h | 3 + 3 files changed, 42 insertions(+), 30 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml index 1e471d73f18..a30eb002227 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml @@ -479,48 +479,48 @@ Window { Rectangle { // top controls bar color: "#aa000000" - width: 265 + width: 290 height: btnPerspective.height + 10 anchors.top: parent.top anchors.right: parent.right anchors.rightMargin: 100 - ToggleButton { - id: btnPerspective - anchors.top: parent.top - anchors.topMargin: 5 - anchors.left: parent.left - anchors.leftMargin: 5 - tooltip: qsTr("Toggle Perspective / Orthographic Projection") - states: [{iconId: "ortho", text: qsTr("Orthographic")}, {iconId: "persp", text: qsTr("Perspective")}] + Row { + padding: 5 + anchors.fill: parent + ToggleButton { + id: btnPerspective + width: 105 + tooltip: qsTr("Toggle Perspective / Orthographic Projection") + states: [{iconId: "ortho", text: qsTr("Orthographic")}, {iconId: "persp", text: qsTr("Perspective")}] + } + + ToggleButton { + id: btnLocalGlobal + width: 65 + tooltip: qsTr("Toggle Global / Local Orientation") + states: [{iconId: "local", text: qsTr("Local")}, {iconId: "global", text: qsTr("Global")}] + } + + ToggleButton { + id: btnEditViewLight + width: 110 + toggleBackground: true + tooltip: qsTr("Toggle Edit Light") + states: [{iconId: "edit_light_off", text: qsTr("Edit Light Off")}, {iconId: "edit_light_on", text: qsTr("Edit Light On")}] + } } - ToggleButton { - id: btnLocalGlobal - anchors.top: parent.top - anchors.topMargin: 5 - anchors.left: parent.left - anchors.leftMargin: 100 - tooltip: qsTr("Toggle Global / Local Orientation") - states: [{iconId: "local", text: qsTr("Local")}, {iconId: "global", text: qsTr("Global")}] - } - - ToggleButton { - id: btnEditViewLight - anchors.top: parent.top - anchors.topMargin: 5 - anchors.left: parent.left - anchors.leftMargin: 165 - toggleBackground: true - tooltip: qsTr("Toggle Edit Light") - states: [{iconId: "edit_light_off", text: qsTr("Edit Light Off")}, {iconId: "edit_light_on", text: qsTr("Edit Light On")}] - } } Text { id: helpText + + property string modKey: _generalHelper.isMacOS ? qsTr("Option") : qsTr("Alt") + color: "white" - text: qsTr("Camera controls: ALT + mouse press and drag. Left: Rotate, Middle: Pan, Right/Wheel: Zoom.") + text: qsTr("Camera controls: ") + modKey + + qsTr(" + mouse press and drag. Left: Rotate, Middle: Pan, Right/Wheel: Zoom.") anchors.bottom: parent.bottom } } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp index 84e28ac4ece..74a74d4ba6e 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp @@ -222,6 +222,15 @@ QQuick3DNode *GeneralHelper::resolvePick(QQuick3DNode *pickNode) return pickNode; } +bool GeneralHelper::isMacOS() const +{ +#ifdef Q_OS_MACOS + return true; +#else + return false; +#endif +} + } } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h index 890b824aa69..92dc30e1828 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h @@ -45,6 +45,7 @@ namespace Internal { class GeneralHelper : public QObject { Q_OBJECT + Q_PROPERTY(bool isMacOS READ isMacOS CONSTANT) public: GeneralHelper(); @@ -70,6 +71,8 @@ public: Q_INVOKABLE QQuick3DNode *resolvePick(QQuick3DNode *pickNode); + bool isMacOS() const; + signals: void overlayUpdateNeeded(); From 5675169e564a1af0d4b47d4f1ee872e404cc2d17 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Fri, 13 Dec 2019 13:27:00 +0100 Subject: [PATCH 23/27] CppTools: Suppress the c++98-compatibility warnings Fixes: QTCREATORBUG-23118 Change-Id: I3c29faa05cb77841b22201dce01b341e565ca32d Reviewed-by: Alessandro Portale --- src/plugins/cpptools/cpptoolsreuse.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/cpptools/cpptoolsreuse.cpp b/src/plugins/cpptools/cpptoolsreuse.cpp index b8677256916..3e448533743 100644 --- a/src/plugins/cpptools/cpptoolsreuse.cpp +++ b/src/plugins/cpptools/cpptoolsreuse.cpp @@ -366,6 +366,7 @@ static void addBuiltinConfigs(ClangDiagnosticConfigsModel &model) config.setClangOptions({ "-Wall", "-Wextra", + "-Wno-c++98-compat" }); model.appendOrUpdate(config); From f265257d556a3cd8c973751a0dffcba5c8bd578c Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Sun, 8 Dec 2019 05:58:27 +0100 Subject: [PATCH 24/27] QmlProject: use qobject_cast instead of static_cast Change-Id: I0a75c18eec64404b8689ad27ad35a8d65d69711f Reviewed-by: hjk --- src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp index 066c28f4557..01b946a47b4 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp @@ -382,7 +382,7 @@ QString QmlProjectRunConfiguration::commandLineArguments() const const Utils::OsType osType = device ? device->osType() : Utils::HostOsInfo::hostOs(); // arguments from .qmlproject file - const QmlProject *project = static_cast(currentTarget->project()); + const QmlProject *project = qobject_cast(currentTarget->project()); foreach (const QString &importPath, QmlProject::makeAbsolute(project->targetDirectory(currentTarget), project->customImportPaths())) { Utils::QtcProcess::addArg(&args, QLatin1String("-I"), osType); From ec43ac04812629b2e76f181a3378cdc382d431cd Mon Sep 17 00:00:00 2001 From: Aleksei German Date: Wed, 11 Dec 2019 11:25:13 +0100 Subject: [PATCH 25/27] QmlDesigner Connection View signals fixes Bug: QDS-1333 Change-Id: Ic0d4206888bd8c5bd3d5cef29225441f19efa59d Reviewed-by: Christian Stenger Reviewed-by: Thomas Hartmann --- .../components/bindingeditor/actioneditor.cpp | 2 +- .../connectioneditor/connectionmodel.cpp | 23 ++++++++++++++++++- .../connectioneditor/connectionmodel.h | 1 + .../connectioneditor/connectionview.cpp | 7 ++++++ .../connectioneditor/connectionview.h | 1 + .../connectioneditor/connectionviewwidget.cpp | 5 ++-- .../designercore/include/modelnode.h | 1 + .../designercore/model/modelnode.cpp | 10 ++++++++ 8 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/components/bindingeditor/actioneditor.cpp b/src/plugins/qmldesigner/components/bindingeditor/actioneditor.cpp index e21000a1715..65866ad324a 100644 --- a/src/plugins/qmldesigner/components/bindingeditor/actioneditor.cpp +++ b/src/plugins/qmldesigner/components/bindingeditor/actioneditor.cpp @@ -123,7 +123,7 @@ void ActionEditor::updateWindowName() { if (!m_dialog.isNull()) { - m_dialog->setWindowTitle(tr("Action Editor")); + m_dialog->setWindowTitle(tr("Connection Editor")); m_dialog->raise(); } } diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp index 87de1e5074f..1347c76045b 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp @@ -290,7 +290,28 @@ void ConnectionModel::abstractPropertyChanged(const AbstractProperty &abstractPr void ConnectionModel::deleteConnectionByRow(int currentRow) { - signalHandlerPropertyForRow(currentRow).parentModelNode().destroy(); + SignalHandlerProperty targetSignal = signalHandlerPropertyForRow(currentRow); + QmlDesigner::ModelNode node = targetSignal.parentModelNode(); + QList allSignals = node.signalProperties(); + if (allSignals.size() > 1) { + if (allSignals.contains(targetSignal)) + node.removeProperty(targetSignal.name()); + } + else { + node.destroy(); + } +} + +void ConnectionModel::removeRowFromTable(const SignalHandlerProperty &property) +{ + for (int currentRow = 0; currentRow < rowCount(); currentRow++) { + SignalHandlerProperty targetSignal = signalHandlerPropertyForRow(currentRow); + + if (targetSignal == property) { + removeRow(currentRow); + break; + } + } } void ConnectionModel::handleException() diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.h b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.h index 1ae3aa2a255..b60275f6da0 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.h +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.h @@ -63,6 +63,7 @@ public: void abstractPropertyChanged(const AbstractProperty &abstractProperty); void deleteConnectionByRow(int currentRow); + void removeRowFromTable(const SignalHandlerProperty &property); protected: void addModelNode(const ModelNode &modelNode); diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp index 08be13d7d54..0410ccf9089 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp @@ -108,6 +108,8 @@ void ConnectionView::propertiesAboutToBeRemoved(const QList & dynamicPropertiesModel()->bindingRemoved(property.toBindingProperty()); } else if (property.isVariantProperty()) { //### dynamicPropertiesModel->bindingRemoved(property.toVariantProperty()); + } else if (property.isSignalHandlerProperty()) { + connectionModel()->removeRowFromTable(property.toSignalHandlerProperty()); } } } @@ -180,6 +182,11 @@ bool ConnectionView::hasWidget() const return true; } +bool ConnectionView::isWidgetEnabled() +{ + return widgetInfo().widget->isEnabled(); +} + QTableView *ConnectionView::connectionTableView() const { return connectionViewWidget()->connectionTableView(); diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionview.h b/src/plugins/qmldesigner/components/connectioneditor/connectionview.h index 09b653072e3..905fa02a587 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionview.h +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionview.h @@ -74,6 +74,7 @@ public: WidgetInfo widgetInfo() override; bool hasWidget() const override; + bool isWidgetEnabled(); QTableView *connectionTableView() const; QTableView *bindingTableView() const; diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp index d0aa6bbbc7a..3777de72910 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp @@ -63,7 +63,8 @@ ConnectionViewWidget::ConnectionViewWidget(QWidget *parent) : [&]() { if (m_actionEditor->hasModelIndex()) { ConnectionModel *connectionModel = qobject_cast(ui->connectionView->model()); - if (connectionModel->rowCount() > m_actionEditor->modelIndex().row()) + if (connectionModel->connectionView()->isWidgetEnabled() + && (connectionModel->rowCount() > m_actionEditor->modelIndex().row())) { SignalHandlerProperty signalHandler = connectionModel->signalHandlerPropertyForRow(m_actionEditor->modelIndex().row()); @@ -166,7 +167,7 @@ void ConnectionViewWidget::contextMenuEvent(QContextMenuEvent *event) QMenu menu(this); - menu.addAction(tr("Open Action Editor"), [&]() { + menu.addAction(tr("Open Connection Editor"), [&]() { if (index.isValid()) { m_actionEditor->showWidget(mapToGlobal(event->pos()).x(), mapToGlobal(event->pos()).y()); m_actionEditor->setBindingValue(index.data().toString()); diff --git a/src/plugins/qmldesigner/designercore/include/modelnode.h b/src/plugins/qmldesigner/designercore/include/modelnode.h index 7f943dddd1c..1399e13e2d6 100644 --- a/src/plugins/qmldesigner/designercore/include/modelnode.h +++ b/src/plugins/qmldesigner/designercore/include/modelnode.h @@ -133,6 +133,7 @@ public: QList nodeProperties() const; QList nodeListProperties() const; QList bindingProperties() const; + QList signalProperties() const; PropertyNameList propertyNames() const; bool hasProperties() const; diff --git a/src/plugins/qmldesigner/designercore/model/modelnode.cpp b/src/plugins/qmldesigner/designercore/model/modelnode.cpp index 1fdc29aaa03..ab4bf9cca02 100644 --- a/src/plugins/qmldesigner/designercore/model/modelnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelnode.cpp @@ -644,6 +644,16 @@ QList ModelNode::bindingProperties() const return propertyList; } +QList ModelNode::signalProperties() const +{ + QList propertyList; + + foreach (const AbstractProperty &property, properties()) + if (property.isSignalHandlerProperty()) + propertyList.append(property.toSignalHandlerProperty()); + return propertyList; +} + /*! \brief removes a property from this node \param name name of the property From 78a5b42942588a815069eb714de8bdbb99b886c1 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 12 Dec 2019 16:14:51 +0100 Subject: [PATCH 26/27] FakeVim: Fix goto next/previous split Fixes: QTCREATORBUG-22397 Change-Id: Ibdae1d53d9d77dd982b871aa22585bdf0354d84f Reviewed-by: Christian Stenger --- src/plugins/coreplugin/coreconstants.h | 2 -- src/plugins/fakevim/fakevimplugin.cpp | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/plugins/coreplugin/coreconstants.h b/src/plugins/coreplugin/coreconstants.h index 8d2e66d915b..1f22df37f7e 100644 --- a/src/plugins/coreplugin/coreconstants.h +++ b/src/plugins/coreplugin/coreconstants.h @@ -125,8 +125,6 @@ const char CLOSE_ALTERNATIVE[] = "QtCreator.Close_Alternative"; // temporary const char CLOSEALL[] = "QtCreator.CloseAll"; const char CLOSEOTHERS[] = "QtCreator.CloseOthers"; const char CLOSEALLEXCEPTVISIBLE[] = "QtCreator.CloseAllExceptVisible"; -const char GOTONEXT[] = "QtCreator.GotoNext"; -const char GOTOPREV[] = "QtCreator.GotoPrevious"; const char GOTONEXTINHISTORY[] = "QtCreator.GotoNextInHistory"; const char GOTOPREVINHISTORY[] = "QtCreator.GotoPreviousInHistory"; const char GO_BACK[] = "QtCreator.GoBack"; diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 29defad5739..211ccb67de2 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -1675,11 +1675,11 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor) if (key == "C" || key == "") triggerAction(Core::Constants::REMOVE_CURRENT_SPLIT); else if (key == "N" || key == "") - triggerAction(Core::Constants::GOTONEXT); + triggerAction(Core::Constants::GOTO_NEXT_SPLIT); else if (key == "O" || key == "") keepOnlyWindow(); else if (key == "P" || key == "") - triggerAction(Core::Constants::GOTOPREV); + triggerAction(Core::Constants::GOTO_PREV_SPLIT); else if (key == "S" || key == "") triggerAction(Core::Constants::SPLIT); else if (key == "V" || key == "") From 0d005b7057bad62797ac9f5a9afe81db683a42b0 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 16 Dec 2019 13:20:05 +0100 Subject: [PATCH 27/27] Version bump to 4.11.1 Change-Id: I31c53f92acd02c380e44ecea534b178a3fb5458c Reviewed-by: Eike Ziller --- cmake/QtCreatorIDEBranding.cmake | 4 ++-- qbs/modules/qtc/qtc.qbs | 4 ++-- qtcreator_ide_branding.pri | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/QtCreatorIDEBranding.cmake b/cmake/QtCreatorIDEBranding.cmake index 98e03e99768..c5a2c1b9e70 100644 --- a/cmake/QtCreatorIDEBranding.cmake +++ b/cmake/QtCreatorIDEBranding.cmake @@ -1,9 +1,9 @@ #BINARY_ARTIFACTS_BRANCH = master #PROJECT_USER_FILE_EXTENSION = .user -set(IDE_VERSION "4.11.0") # The IDE version. +set(IDE_VERSION "4.11.1") # The IDE version. set(IDE_VERSION_COMPAT "4.11.0") # The IDE Compatibility version. -set(IDE_VERSION_DISPLAY "4.11.0") # The IDE display version. +set(IDE_VERSION_DISPLAY "4.11.1") # The IDE display version. set(IDE_COPYRIGHT_YEAR "2019") # The IDE current copyright year. set(IDE_SETTINGSVARIANT "QtProject") # The IDE settings variation. diff --git a/qbs/modules/qtc/qtc.qbs b/qbs/modules/qtc/qtc.qbs index 4bc792960d4..7fddce99d9a 100644 --- a/qbs/modules/qtc/qtc.qbs +++ b/qbs/modules/qtc/qtc.qbs @@ -4,10 +4,10 @@ import qbs.FileInfo import "qtc.js" as HelperFunctions Module { - property string qtcreator_display_version: '4.11.0' + property string qtcreator_display_version: '4.11.1' property string ide_version_major: '4' property string ide_version_minor: '11' - property string ide_version_release: '0' + property string ide_version_release: '1' property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release diff --git a/qtcreator_ide_branding.pri b/qtcreator_ide_branding.pri index 86022e56208..8cd55ff7701 100644 --- a/qtcreator_ide_branding.pri +++ b/qtcreator_ide_branding.pri @@ -1,6 +1,6 @@ -QTCREATOR_VERSION = 4.11.0 +QTCREATOR_VERSION = 4.11.1 QTCREATOR_COMPAT_VERSION = 4.11.0 -QTCREATOR_DISPLAY_VERSION = 4.11.0 +QTCREATOR_DISPLAY_VERSION = 4.11.1 QTCREATOR_COPYRIGHT_YEAR = 2019 BINARY_ARTIFACTS_BRANCH = 4.11