From e9f53752ee29ff7d52622251b291a1f4e299925d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Wed, 11 Aug 2021 22:28:35 +0200 Subject: [PATCH 01/20] Squish: Update tst_codepasting Change-Id: I7929a97dea0a362f07eff46a37d84b65fa546bbc Reviewed-by: Christian Stenger --- tests/system/suite_tools/tst_codepasting/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/suite_tools/tst_codepasting/test.py b/tests/system/suite_tools/tst_codepasting/test.py index 37b9832c3a1..76dbb7ca092 100644 --- a/tests/system/suite_tools/tst_codepasting/test.py +++ b/tests/system/suite_tools/tst_codepasting/test.py @@ -239,7 +239,7 @@ def main(): clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) continue test.compare(filenameCombo.currentText, "%s: %s" % (protocol, pasteId), "Verify title of editor") - if protocol in (NAME_DPCOM) and pastedText.endswith("\n"): + if protocol in (NAME_DPCOM, NAME_PBCOM) and pastedText.endswith("\n"): pastedText = pastedText[:-1] test.compare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same") From 0408b4a757645f10927763cb4befceff0f75e855 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 11 Aug 2021 13:40:30 +0200 Subject: [PATCH 02/20] Squish: Improve Python2/Python3 compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I49dc9ee2f4ef52900b403ed94f0c6cd5925239b6 Reviewed-by: Robert Löhning --- tests/system/shared/classes.py | 5 ++++- tests/system/shared/qtcreator.py | 9 ++++++--- tests/system/shared/suites_qtta.py | 2 -- tests/system/shared/workarounds.py | 17 +++++++++++------ .../suite_editors/tst_revert_changes/test.py | 1 - 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/tests/system/shared/classes.py b/tests/system/shared/classes.py index 3a675c61e5e..a96a7e2d6e0 100644 --- a/tests/system/shared/classes.py +++ b/tests/system/shared/classes.py @@ -23,7 +23,10 @@ # ############################################################################ -import __builtin__ +try: + import __builtin__ # Python 2 +except ImportError: + import builtins as __builtin__ # Python 3 # for easier re-usage (because Python hasn't an enum type) class Targets: diff --git a/tests/system/shared/qtcreator.py b/tests/system/shared/qtcreator.py index 8959e3669dc..0618ce273da 100644 --- a/tests/system/shared/qtcreator.py +++ b/tests/system/shared/qtcreator.py @@ -34,7 +34,10 @@ import subprocess; import sys import errno; from datetime import datetime,timedelta; -import __builtin__ +try: + import __builtin__ # Python 2 +except ImportError: + import builtins as __builtin__ # Python 3 srcPath = '' SettingsPath = [] @@ -120,7 +123,7 @@ def waitForCleanShutdown(timeOut=10): while not shutdownDone: try: os.kill(appCtxt.pid,0) - except OSError, err: + except OSError as err: if err.errno == errno.EPERM or err.errno == errno.ESRCH: shutdownDone=True if not shutdownDone and datetime.utcnow() > endtime: @@ -208,7 +211,7 @@ def substituteCdb(settingsDir): try: serverIni = readFile(os.path.join(os.getenv("APPDATA"), "froglogic", "Squish", "ver1", "server.ini")) - autLine = filter(lambda line: "AUT/qtcreator" in line, serverIni.splitlines())[0] + autLine = list(filter(lambda line: "AUT/qtcreator" in line, serverIni.splitlines()))[0] autPath = autLine.split("\"")[1] return os.path.exists(os.path.join(autPath, "..", "lib", "qtcreatorcdbext64")) except: diff --git a/tests/system/shared/suites_qtta.py b/tests/system/shared/suites_qtta.py index f70b3cb1036..64a31e6a9a4 100755 --- a/tests/system/shared/suites_qtta.py +++ b/tests/system/shared/suites_qtta.py @@ -23,8 +23,6 @@ # ############################################################################ -import __builtin__ - # appends to line, by typing after text into widget def appendToLine(codeArea, insertAfterLine, typeWhat): if not placeCursorToLine(codeArea, insertAfterLine): diff --git a/tests/system/shared/workarounds.py b/tests/system/shared/workarounds.py index ab8e338ad7f..f0421220fbc 100644 --- a/tests/system/shared/workarounds.py +++ b/tests/system/shared/workarounds.py @@ -23,7 +23,10 @@ # ############################################################################ -import urllib2 +try: + from urllib2 import ProxyHandler, build_opener, install_opener, urlopen # Python 2 +except ImportError: + from urllib.request import ProxyHandler, build_opener, install_opener, urlopen # Python 3 ################ workarounds for issues tracked inside jira ################# @@ -43,7 +46,7 @@ class JIRA: def __init__(self, number, bugType=Bug.CREATOR): if JIRA.__instance__ == None: JIRA.__instance__ = JIRA.__impl(number, bugType) - JIRA.__dict__['_JIRA__instance__'] = JIRA.__instance__ + setattr(JIRA, '__instance__', JIRA.__instance__) else: JIRA.__instance__._bugType = bugType JIRA.__instance__._number = number @@ -102,10 +105,10 @@ class JIRA: proxy = os.getenv("SYSTEST_PROXY", None) try: if proxy: - proxy = urllib2.ProxyHandler({'https': proxy}) - opener = urllib2.build_opener(proxy) - urllib2.install_opener(opener) - bugReport = urllib2.urlopen('%s/%s' % (JIRA_URL, bug)) + proxy = ProxyHandler({'https': proxy}) + opener = build_opener(proxy) + install_opener(opener) + bugReport = urlopen('%s/%s' % (JIRA_URL, bug)) data = bugReport.read() except: data = self.__tryExternalTools__(proxy) @@ -118,6 +121,8 @@ class JIRA: test.fatal("No resolution info for %s" % bug) self._resolution = 'Done' else: + if isinstance(data, (bytes)): + data = str(data) data = data.replace("\r", "").replace("\n", "") resPattern = re.compile('(?P.*?)') resolution = resPattern.search(data) diff --git a/tests/system/suite_editors/tst_revert_changes/test.py b/tests/system/suite_editors/tst_revert_changes/test.py index d6e65b482cd..c4a7ade71fb 100644 --- a/tests/system/suite_editors/tst_revert_changes/test.py +++ b/tests/system/suite_editors/tst_revert_changes/test.py @@ -24,7 +24,6 @@ ############################################################################ source("../../shared/qtcreator.py") -import __builtin__ cppEditorStr = ":Qt Creator_CppEditor::Internal::CPPEditorWidget" originalSources = os.path.abspath(os.path.join(os.getcwd(), "..", "shared", "simplePlainCPP")) From d3b6777d124d8e6c44bfed109ba79752beeecc2c Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Wed, 11 Aug 2021 17:33:20 +0200 Subject: [PATCH 03/20] QmlDesigner: Fix button tooltip blocking event Fix HelperWidgets AbstractButton nested TooplTipArea blocking hover events from the actual control. Task-number: QDS-4828 Change-Id: Ibd390c98805a49f903663b6c38091f727c2b7ec9 Reviewed-by: Thomas Hartmann --- .../imports/HelperWidgets/AbstractButton.qml | 2 ++ .../imports/StudioControls/AbstractButton.qml | 11 ++++++----- .../imports/StudioControls/ButtonRow.qml | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/AbstractButton.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/AbstractButton.qml index 53f62be453b..8abaf6cecff 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/AbstractButton.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/AbstractButton.qml @@ -32,6 +32,8 @@ StudioControls.AbstractButton { property alias tooltip: toolTipArea.tooltip + hover: toolTipArea.containsMouse + ToolTipArea { id: toolTipArea anchors.fill: parent diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/AbstractButton.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/AbstractButton.qml index 8be58b7904a..c1ecf1dc7f1 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/AbstractButton.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/AbstractButton.qml @@ -31,6 +31,7 @@ T.AbstractButton { id: myButton property bool globalHover: false + property bool hover: myButton.hovered property alias buttonIcon: buttonIcon.text property alias iconColor: buttonIcon.color @@ -51,7 +52,7 @@ T.AbstractButton { z: myButton.checked ? 10 : 3 activeFocusOnTab: false - onHoveredChanged: { + onHoverChanged: { if (parent !== undefined && parent.hoverCallback !== undefined && myButton.enabled) parent.hoverCallback() } @@ -119,7 +120,7 @@ T.AbstractButton { states: [ State { name: "default" - when: myButton.enabled && !myButton.globalHover && !myButton.hovered + when: myButton.enabled && !myButton.globalHover && !myButton.hover && !myButton.pressed && !myButton.checked PropertyChanges { target: buttonBackground @@ -132,7 +133,7 @@ T.AbstractButton { }, State { name: "globalHover" - when: myButton.globalHover && !myButton.hovered && !myButton.pressed && myButton.enabled + when: myButton.globalHover && !myButton.hover && !myButton.pressed && myButton.enabled PropertyChanges { target: buttonBackground color: StudioTheme.Values.themeControlBackgroundGlobalHover @@ -140,7 +141,7 @@ T.AbstractButton { }, State { name: "hover" - when: myButton.hovered && !myButton.pressed && myButton.enabled + when: myButton.hover && !myButton.pressed && myButton.enabled PropertyChanges { target: buttonBackground color: StudioTheme.Values.themeControlBackgroundHover @@ -148,7 +149,7 @@ T.AbstractButton { }, State { name: "press" - when: myButton.hovered && myButton.pressed + when: myButton.hover && myButton.pressed PropertyChanges { target: buttonBackground color: StudioTheme.Values.themeControlBackgroundInteraction diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ButtonRow.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ButtonRow.qml index 77f43cb6975..1b9c483c89b 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ButtonRow.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ButtonRow.qml @@ -56,8 +56,8 @@ Row { var hover = false for (var i = 0; i < children.length; ++i) { - if (children[i].hovered !== undefined) - hover = hover || children[i].hovered + if (children[i].hover !== undefined) + hover = hover || children[i].hover } myButtonRow.childHover = hover From eb54c77ebb07f345823053498698723374f7961f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alp=20=C3=96z?= Date: Thu, 29 Jul 2021 16:40:17 +0200 Subject: [PATCH 04/20] Locator: Space character in file name index For the tools es and locate, interpret space as AND operator. Change-Id: I62692ee0d3afed096173bbb789ea1c6b93ce543c Fixes: QTCREATORBUG-26064 Reviewed-by: Eike Ziller --- .../locator/spotlightlocatorfilter.cpp | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/plugins/coreplugin/locator/spotlightlocatorfilter.cpp b/src/plugins/coreplugin/locator/spotlightlocatorfilter.cpp index 84ecaa762f7..4d5366f1a26 100644 --- a/src/plugins/coreplugin/locator/spotlightlocatorfilter.cpp +++ b/src/plugins/coreplugin/locator/spotlightlocatorfilter.cpp @@ -186,22 +186,25 @@ static QString defaultCommand() return "locate"; } -static QString defaultArguments() -{ - if (HostOsInfo::isMacHost()) - return "\"kMDItemFSName = '*%{Query:Escaped}*'c\""; - if (HostOsInfo::isWindowsHost()) - return "-n 10000 -r \"%{Query:Regex}\""; - return "-i -l 10000 -r \"%{Query:Regex}\""; -} +/*! + For the tools es [1] and locate [2], interpret space as AND operator. -static QString defaultCaseSensitiveArguments() + Currently doesn't support fine picking a file with a space in the path by escaped space. + + [1]: https://www.voidtools.com/support/everything/command_line_interface/ + [2]: https://www.gnu.org/software/findutils/manual/html_node/find_html/Invoking-locate.html + */ + +static QString defaultArguments(Qt::CaseSensitivity sens = Qt::CaseInsensitive) { if (HostOsInfo::isMacHost()) - return "\"kMDItemFSName = '*%{Query:Escaped}*'\""; + return QString("\"kMDItemFSName = '*%{Query:Escaped}*'%1\"") + .arg(sens == Qt::CaseInsensitive ? QString("c") : ""); if (HostOsInfo::isWindowsHost()) - return "-i -n 10000 -r \"%{Query:Regex}\""; - return "-l 10000 -r \"%{Query:Regex}\""; + return QString("%1 -n 10000 %{Query:Escaped}") + .arg(sens == Qt::CaseInsensitive ? QString() : "-i "); + return QString("%1 -A -l 10000 %{Query:Escaped}") + .arg(sens == Qt::CaseInsensitive ? QString() : "-i "); } const char kCommandKey[] = "command"; @@ -230,6 +233,7 @@ static MacroExpander *createMacroExpander(const QString &query) [query] { QString regex = query; regex = regex.replace('*', ".*"); + regex = regex.replace(' ', ".*"); return regex; }); return expander; @@ -306,7 +310,7 @@ void SpotlightLocatorFilter::saveState(QJsonObject &obj) const obj.insert(kCommandKey, m_command); if (m_arguments != defaultArguments()) obj.insert(kArgumentsKey, m_arguments); - if (m_caseSensitiveArguments != defaultCaseSensitiveArguments()) + if (m_caseSensitiveArguments != defaultArguments(Qt::CaseSensitive)) obj.insert(kCaseSensitiveKey, m_caseSensitiveArguments); } @@ -314,14 +318,14 @@ void SpotlightLocatorFilter::restoreState(const QJsonObject &obj) { m_command = obj.value(kCommandKey).toString(defaultCommand()); m_arguments = obj.value(kArgumentsKey).toString(defaultArguments()); - m_caseSensitiveArguments = obj.value(kCaseSensitiveKey).toString(defaultCaseSensitiveArguments()); + m_caseSensitiveArguments = obj.value(kCaseSensitiveKey).toString(defaultArguments(Qt::CaseSensitive)); } void SpotlightLocatorFilter::reset() { m_command = defaultCommand(); m_arguments = defaultArguments(); - m_caseSensitiveArguments = defaultCaseSensitiveArguments(); + m_caseSensitiveArguments = defaultArguments(Qt::CaseSensitive); } } // Internal From 48e0ae7bd6941559cacd1eae14f87882e2780797 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 11 Aug 2021 08:33:19 +0200 Subject: [PATCH 05/20] QmlDesigner: Remove SplitView from library MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was done for controls 1. SplitView in controls 2 requires proper test and support. Change-Id: I749ee072abb50256ad87002605e3064e0a066f29 Reviewed-by: Henning Gründl --- .../componentsplugin/components.metainfo | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/plugins/qmldesigner/componentsplugin/components.metainfo b/src/plugins/qmldesigner/componentsplugin/components.metainfo index 8ae33b65333..8a1e365266e 100644 --- a/src/plugins/qmldesigner/componentsplugin/components.metainfo +++ b/src/plugins/qmldesigner/componentsplugin/components.metainfo @@ -47,22 +47,6 @@ MetaInfo { } } - Type { - name: "QtQuick.Controls.SplitView" - icon: ":/componentsplugin/images/splitview-layouts-icon-16px.png" - - ItemLibraryEntry { - name: "SplitView" - category: "Qt Quick - Layouts" - libraryIcon: ":/componentsplugin/images/splitview-layouts-icon.png" - version: "1.0" - requiredImport: "QtQuick.Controls" - - Property { name: "width"; type: "int"; value: 100; } - Property { name: "height"; type: "int"; value: 100; } - } - } - Type { name: "QtQuick.Layouts.StackLayout" icon: ":/componentsplugin/images/stack-layouts-icon-16px.png" From 1dd0511b4976026b8fedc54de8a9be9e87fab65d Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 13 Aug 2021 09:24:49 +0200 Subject: [PATCH 06/20] Bump version to 5.0.0 Change-Id: I1203dd71cc2f1e6d1f435dbfdc07376130fbb61f Reviewed-by: Eike Ziller --- cmake/QtCreatorIDEBranding.cmake | 6 +++--- qbs/modules/qtc/qtc.qbs | 10 +++++----- qtcreator_ide_branding.pri | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cmake/QtCreatorIDEBranding.cmake b/cmake/QtCreatorIDEBranding.cmake index e36186c12d4..90c1c453045 100644 --- a/cmake/QtCreatorIDEBranding.cmake +++ b/cmake/QtCreatorIDEBranding.cmake @@ -1,6 +1,6 @@ -set(IDE_VERSION "4.84.0") # The IDE version. -set(IDE_VERSION_COMPAT "4.84.0") # The IDE Compatibility version. -set(IDE_VERSION_DISPLAY "5.0.0-rc1") # The IDE display version. +set(IDE_VERSION "5.0.0") # The IDE version. +set(IDE_VERSION_COMPAT "5.0.0") # The IDE Compatibility version. +set(IDE_VERSION_DISPLAY "5.0.0") # The IDE display version. set(IDE_COPYRIGHT_YEAR "2021") # 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 14355e7f56e..c187227a575 100644 --- a/qbs/modules/qtc/qtc.qbs +++ b/qbs/modules/qtc/qtc.qbs @@ -3,15 +3,15 @@ import qbs.Environment import qbs.FileInfo Module { - property string qtcreator_display_version: '5.0.0-rc1' - property string ide_version_major: '4' - property string ide_version_minor: '84' + property string qtcreator_display_version: '5.0.0' + property string ide_version_major: '5' + property string ide_version_minor: '5' property string ide_version_release: '0' property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release - property string ide_compat_version_major: '4' - property string ide_compat_version_minor: '84' + property string ide_compat_version_major: '5' + property string ide_compat_version_minor: '5' property string ide_compat_version_release: '0' property string qtcreator_compat_version: ide_compat_version_major + '.' + ide_compat_version_minor + '.' + ide_compat_version_release diff --git a/qtcreator_ide_branding.pri b/qtcreator_ide_branding.pri index f5805a46a02..a85546ef53d 100644 --- a/qtcreator_ide_branding.pri +++ b/qtcreator_ide_branding.pri @@ -1,6 +1,6 @@ -QTCREATOR_VERSION = 4.84.0 -QTCREATOR_COMPAT_VERSION = 4.84.0 -QTCREATOR_DISPLAY_VERSION = 5.0.0-rc1 +QTCREATOR_VERSION = 5.0.0 +QTCREATOR_COMPAT_VERSION = 5.0.0 +QTCREATOR_DISPLAY_VERSION = 5.0.0 QTCREATOR_COPYRIGHT_YEAR = 2021 IDE_DISPLAY_NAME = Qt Creator From aec25d293b2d6bf2b612b5bf2ec3cdd54696727b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Thu, 12 Aug 2021 20:19:47 +0200 Subject: [PATCH 07/20] Squish: Use regex instead of wildcard to find objects Squish 6.7.1 for Qt 6.1.x can't find the objects when using wildcards. The same version of Squish for Qt 5.15.x works fine. Change-Id: Ia378934af51cab2894a9df01e2391dbdb9cf32f9 Reviewed-by: Christian Stenger --- tests/system/shared/project.py | 2 +- tests/system/suite_HELP/tst_HELP02/test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index 6952db9f9e4..b304b4966c7 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -99,7 +99,7 @@ def __createProjectOrFileSelectType__(category, template, fromWelcome = False, i def __createProjectSetNameAndPath__(path, projectName = None, checks = True): directoryEdit = waitForObject("{type='Utils::FancyLineEdit' unnamed='1' visible='1' " - "toolTip?='Full path: *'}") + "toolTip~='Full path: .*'}") replaceEditorContent(directoryEdit, path) projectNameEdit = waitForObject("{name='nameLineEdit' visible='1' " "type='Utils::FancyLineEdit'}") diff --git a/tests/system/suite_HELP/tst_HELP02/test.py b/tests/system/suite_HELP/tst_HELP02/test.py index 2492be950fa..921a1c701b9 100755 --- a/tests/system/suite_HELP/tst_HELP02/test.py +++ b/tests/system/suite_HELP/tst_HELP02/test.py @@ -28,7 +28,7 @@ source("../../shared/qtcreator.py") # test Qt Creator version information from file and dialog def getQtCreatorVersionFromDialog(): chk = re.search("(?<=Qt Creator)\s\d+.\d+.\d+[-\w]*", - str(waitForObject("{text?='*Qt Creator*' type='QLabel' unnamed='1' visible='1' " + str(waitForObject("{text~='.*Qt Creator.*' type='QLabel' unnamed='1' visible='1' " "window=':About Qt Creator_Core::Internal::VersionDialog'}").text)) try: ver = chk.group(0).strip() From 765e6d285660ccd68d9a0c61d08f98852d38031e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Thu, 12 Aug 2021 23:33:04 +0200 Subject: [PATCH 08/20] Squish: Remove redundant search criteria for named object Change-Id: I8d6432f479381c7a517b8aeaeb29f76da03f4ae2 Reviewed-by: Christian Stenger --- tests/system/shared/project.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index b304b4966c7..ecc1ae98756 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -177,8 +177,7 @@ def __selectQtVersionDesktop__(checks, available=None, withoutQt4=False): def __createProjectHandleLastPage__(expectedFiles=[], addToVersionControl="", addToProject=None): if len(expectedFiles): - summary = waitForObject("{name='filesLabel' text?='Files to be added in
*
' " - "type='QLabel' visible='1'}").text + summary = waitForObject("{name='filesLabel' type='QLabel'}").text verifyItemOrder(expectedFiles, summary) if addToProject: selectFromCombo(":projectComboBox_QComboBox", addToProject) From 00a2dd0747baee52dab106ce02d551227212058a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Thu, 12 Aug 2021 23:03:27 +0200 Subject: [PATCH 09/20] Squish: Explicitly convert analyzer data to str With Creator built on Qt 6.2, Squish considers the data different although the contents look the same. Change-Id: I281b7425d5b3f9a977456253e0299f452d75c1e2 Reviewed-by: Christian Stenger --- tests/system/suite_debugger/tst_simple_analyze/test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/system/suite_debugger/tst_simple_analyze/test.py b/tests/system/suite_debugger/tst_simple_analyze/test.py index a56680086c7..fc7bfb6e41f 100644 --- a/tests/system/suite_debugger/tst_simple_analyze/test.py +++ b/tests/system/suite_debugger/tst_simple_analyze/test.py @@ -117,10 +117,12 @@ def performTest(workingDir, projectName, availableConfigs): % (selfPercent, totalPercent)) if str(model.index(row, colCalls).data()) == "1": for col in [colMedian, colLongest, colShortest]: - test.compare(model.index(row, colMean).data(), model.index(row, col).data(), + test.compare(str(model.index(row, colMean).data()), + str(model.index(row, col).data()), "For just one call, no differences in execution time may be shown.") elif str(model.index(row, colCalls).data()) == "2": - test.compare(model.index(row, colMedian).data(), model.index(row, colMean).data(), + test.compare(str(model.index(row, colMedian).data()), + str(model.index(row, colMean).data()), "For two calls, median and mean time must be the same.") progressBarWait(15000, False) # wait for "Build" progressbar to disappear clickButton(waitForObject(":Analyzer Toolbar.Clear_QToolButton")) From b8b6af0dbb6c077daf2ef4f26f773e2af58846f3 Mon Sep 17 00:00:00 2001 From: Janne Koskinen Date: Thu, 29 Jul 2021 13:11:53 +0300 Subject: [PATCH 10/20] Add 3D editor Gizmo for Quick3DParticles Adds an icon for Particle System Component making the component visible in the editor allowing picking. Task-number: QDS-4784 Change-Id: Ie6cffa9cfe3bb6a693372d7a7b4341e17f89911f Reviewed-by: Miikka Heikkinen Reviewed-by: Mahmoud Badri Reviewed-by: Qt CI Bot Reviewed-by: Thomas Hartmann --- .../qtcreator/qml/qmlpuppet/editor3d_qt6.qrc | 3 + .../images/editor_particlesystem.png | Bin 0 -> 1785 bytes .../images/editor_particlesystem@2x.png | Bin 0 -> 3970 bytes .../qmlpuppet/mockfiles/qt6/EditView3D.qml | 75 ++++++++++++++++++ .../mockfiles/qt6/ParticleSystemGizmo.qml | 32 ++++++++ .../qml2puppet/instances/instances.pri | 4 + .../qt5informationnodeinstanceserver.cpp | 32 ++++++++ src/tools/qml2puppet/CMakeLists.txt | 8 ++ src/tools/qml2puppet/qml2puppet.qbs | 4 + 9 files changed, 158 insertions(+) create mode 100644 share/qtcreator/qml/qmlpuppet/mockfiles/images/editor_particlesystem.png create mode 100644 share/qtcreator/qml/qmlpuppet/mockfiles/images/editor_particlesystem@2x.png create mode 100644 share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ParticleSystemGizmo.qml diff --git a/share/qtcreator/qml/qmlpuppet/editor3d_qt6.qrc b/share/qtcreator/qml/qmlpuppet/editor3d_qt6.qrc index c89e2806f6c..065f9e32cf3 100644 --- a/share/qtcreator/qml/qmlpuppet/editor3d_qt6.qrc +++ b/share/qtcreator/qml/qmlpuppet/editor3d_qt6.qrc @@ -7,6 +7,8 @@ mockfiles/meshes/axishelper.mesh mockfiles/images/editor_camera.png mockfiles/images/editor_camera@2x.png + mockfiles/images/editor_particlesystem.png + mockfiles/images/editor_particlesystem@2x.png mockfiles/images/area.png mockfiles/images/area@2x.png mockfiles/images/directional.png @@ -33,6 +35,7 @@ mockfiles/qt6/LightGizmo.qml mockfiles/qt6/LightIconGizmo.qml mockfiles/qt6/LightModel.qml + mockfiles/qt6/ParticleSystemGizmo.qml mockfiles/qt6/Line3D.qml mockfiles/qt6/MaterialNodeView.qml mockfiles/qt6/ModelNode2DImageView.qml diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/editor_particlesystem.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/editor_particlesystem.png new file mode 100644 index 0000000000000000000000000000000000000000..55d35bc58421d78b7368ce1c04bd50c16dfc1ad3 GIT binary patch literal 1785 zcmeAS@N?(olHy`uVBq!ia0y~yU@!n-4rT@hhJ-tuTNxM_R|WWlxH2#>Ffua!`0?ZC z&!4}3{la9RiIc>In}$^vL=YDV*Zbqgk6*ujL6jjg;B1H#8i~w>8-*;0pG}e$tcu}+ z$f1hgQv9+N-7B^-FfjC#1o;IsFtD(&aBy(&@bCx-h=_@C@83?sAy>D=;#<2 z7?_w?SXkKDI5@btczF2u1O$YHghWKd#3ZDoWaJbSl$2Cd)YQ~BG&DE2x3_n9_xDep zJbn7?+4JWwUc7wy^3|)?uiw0R`}W(_7JzJLGm1e~ zFWBqZpu(86<$mtuM7A^LyI5azUD$7)epq?MvIrx;wjF#kYNtAdcjTO$;ri!#=Y~zI zS=6RAH=j1F6UtsRL)*?^>WyReWh*a;ti5|$-FZ^(*2#`b`2#}}o}F9QvFg?D%=s;~ zQ9DoW-)btnv0Fj#{qL2lZdKiSzkRQ%%#0cNE2bTL5L0xnz%AsTb>7OdV>)i%4t2M! z^7#4fWW0%l^}*d)F;~}`Fg$wk&XmEW z=Fj;>tGYVamRc{4yP~y7-*Q9rd0~ZR&DU+O-I=&))rxigDK#}oA`Ty_UUPZQyK^l; zkFDXwj%xv-v9C+bZoInIc<)la2ao>rkgZ#*mbE{)E-HBO*N)FOR0SMlI@a3x=v|Fk zrM2kn^TQS;+f_G7@A0%0daHc)VdjMA^M9Y**d7`=17}^1AslgOD7f-is6PT@o{vO=?PB>A>^GM#7l*PACIbMIo&~a|6!j7kpbI$oF9KOhW z@?P%LXRfQe&-`L>`<9}7`pDzW*8&b7JHTU;xzg+7?i0E)yQFJoyh>PCqwLhla^q%s z<>Hl#R!#l+Z$_wF&zska&o>(PZq-ZfIVw4;a@%#0t?iqBT|cvcz2QT6QmQN@Lj^O>{9>DZH~;I^moJY$UAE%Y!Og3cU(P5MVVDsi6dE{jt>W#o zHG4zXY;&2rqyPOgA+tt?3DxPLYkskK{4aZb_Q8)kr)PQItgQMPq9!+qsbjvYeOE`_ z90rDE+n?-WFXI(=Sz4wk+@9U~`s>Q7&%bH~r`lU_8r)way_u~`$me%QOH`7r^wh=f z^HyY(PEinR-mcl?@Md1la=~B8v-}wDIUP*jrl6#)u>1O#W$D}0zpj)&CdJak^6R+A zv+pk3`X|IslYV~IGrhjnEKTXn`Vxxlz+W$*H3n93I5948%|7is0vn|zT(B}yl}HcM}9Fp3R1{YKfu#ya^A9_B{28$ zqt$|TNk{H*K3+WK4d=->I}Y_te095}c#H0#LjpI&-`~rBD^lKdG-+kX$|>4Uiz;o! zuVyF5p1*K+u1$?asm0`zOU^3KK3!pUB<4SJ$ZWqU$9f+;VPIfj@O1TaS?83{1OV^6 BIZ*%r literal 0 HcmV?d00001 diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/editor_particlesystem@2x.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/editor_particlesystem@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..e66db81479c2de59443eecce9976a89f31b3c347 GIT binary patch literal 3970 zcmeAS@N?(olHy`uVBq!ia0y~yU`POA4rT@hhO2JvTnr41?*n{7Tp1V`7#SIV{P^+n z=g(iiev!u@LoY-NCW-8TU%!4q6d()Y68ZV_CtMjs4TOXX!Wj^8TqIl>oPntlE`^7I zsS6?k*8<@}NUVZrQfO-6TsQ-w9+`wo!5MBw3+^y5Ff1ww@(X5QU}0h5;Nall;SmrJ z5D^iPkdTm(kx@`kQBl#*(9qG*F)%PNF)^{Qu(5G)aB=bQ@bK{o2nY!YiHL}ZiHS)_ zNJz=Z$jHelC@3i@si>%^sj07TXlQP3Z}0Bz?(grPJbC)`*|X=*pTBtV;^oViuU@@+ z{rb(Dw{PFQd;k9ZhYue=e){z3^XD&LzJC4o?c4Y7-+%o0`Sa(mU%!6;{`2SW-+%x9 z{rI!=GX@5p1)eUBAsP2tqxzkLkIU{~U#a3di%05M|Dgo|k_ugZ%YD?FJ3ps;cV};D!PvC9~C|F_IlW|MHaN4#9x|ZgPECc)_#TfFvOjdebVsv(!md0O@A;=>l z=f=D?BI~SLoB4(QsK%yPnKiFuB0o<&VOqbKyRcJ^HA&q3$!gdBB^#x5g&SoXL`9Z} zMgE*4cU?aEG{+C8=&sw##HWAkii%{+Z75-VQqZ{ZWyDg>gxn}qwnNsh^;I@*T64)D z@ROOXyX0MKSDnAdjyX6>@&4|UHK>e@`JZe zCq>LLI`+S4yZ`nomI>UEM+$B*Op1E&`Fo!=8}qy1np+!vCI&g~jfl?+j{AFOv%v$4 zHsx50I01hjNqNprwHZ?_>dLpSxfUk%+c;kbS4b zIo#M4CdwU^kvbue4v7Wx?Bd(CO;QOnf zd&_UBF=-aYo{!CGpRnG#VD60M>dli{jTvq{JMJ}Kx#A0(`6;JKlPb>% z=kMR?Pkfay?`icxCbq_m?=KdeH{eeC`rCP~Vaq-bKdJuY$GR+fg(aH*1#cF-$)3Nl zkm-nH&o1Se4nMkPwtkKcOv&(ju{}`hpzNEu?|&M{E1K=T_ESo`SE7e?>fQBACtOkc zdC{#`BWznj{@j31vt!+!KR&iSXmYCKtLF>$`fQxDCv;i9i9_C;4$EuFpLJ(*O1xJv zozoirK661|`ScjZ!d&CaziA71OYm3)7y{L^3g zN7#N&w)i(Q=lCumi=@Z-;TbPYI_Jgf{E#}3$-udD<>E;X-|2+L>9EUt zz1UR5*!1P~5$_nMUe0bEz7WlYx6EERonqN>*;R4D+r@%)Z})C(*)(m{(}^`IdtXW) za9D9gWOw|&7cV!qr7leTKP$lDONoq(joVWP*WPQ}Rc%YR?)2&{D_b0U+OlY=4oBr2 zG3)p7@9L|2)4G&Q744pSCw$bmux$Lb)>`o5=G$SdZQJ?XkFckEB{ww59NZePgG1)l z#1+mjz0UiKHcp(~)c0w6V4?8bMfM^3Oojm~UNdK_HP2eN-8Ix>3B&$-B21@DPCCY2 z-kYW3_bpd>!{SLdR`$p*VXK+^e%8IH)OWK*Brm>;wDFz7CdrW0M_VROI5+z? zV~kc#U8T}9iwUAx<$eY~7lchTKNS1ls4!Z}&qz=1`z*HiIa4&4QtLuzSzdk@s+p`D z-^H<|*uo<{@8iyL=T<|l^py!?vyXSf2Jz`Y+cBr zb)?;8?T%k{2hLxdGiS@S=7RYRljpfapYuyUedfygEbhr~?SB{N3w@qjbHM%)&x+ma zSmS5j^;x`?O?~+U^NZ6aRYO@0}JC-cE2XZI(Q1JKI)lC0jY$ z>g3$TuiZ{I?wz(?m1owg58^W)tmK;AF`?q~fghJAo$LPb<*oH$*+7Qv`j4-ip8Gvi zQqDr^|Nr^>y26|ea|d4G=k2kNy8U_LD-~Dk&*uIsA02qK`K{qczl)*H`?P+(%(-Q? ztm;8Zr4jroL{xF_B}qlbh@?O=1qq6UE=oT zyBX7aIWAcgt_GowfN)2-2Sp-oL!GZ|3)5l%JM6SIu&&H=0g7aj(4YhFRu9! zc}vK2gJ?(kPJ1_x)a|U_O|Sf&vEbR$g~zS*0?swPwVeN9s_>17ij69k_w2-0X5@rt zKJT~^((ri6^-o7;oV34h$m&uOv}I!7qcXoo`$7))&d|*eI4;nX7x=?2eT@ajlf%!W z-2PkV{CN=jF4g4ngB0#`7TH$0rr;Q#q80Hh6ZI>)v>R6IOIt|qO)a^qoptJD$7TIj z0#Ok@LRUVrOwnJIW5;mgu&SA=?Z+ea%=PE$799O)czod_0gHQQCvzQBvthZI5M6#% zD(LI!qlu-TJGn~s6pB3X(2J$KYu38e_L_#;yI?+ zj>!dTS($vUR(F22-+$}1|KG-c*xl{giZCRXu^z8dewu$cxZaXYIBq4gdZ^0d5`R5Kx z-cG&oApYgEZ|gV(&ty&PUwG<}t?7~0$f@fVFJ4-EXhKG&c3u-wW&?PFj~&j$~}N3 zlv%(^PEp`n4!dpN+35v(>wiCZ`jUCw3FjpBsqMS`?uTp^l8xk-s#AM=k+bfbiDRhY zxqEl^Wv)nkAlK;X-tA{5v*df$?nA6w_Pq_BF`+Fqey^c-(sXY>GoOiaKknbNtU1Tl z=Ws{Z`M}xWk~u|L$J1_InP$DLeZFnp>7?l3-GaW!^MTCs*NOSI)iWgiFt1|)iL`P8^dA`(H>hr0ikvAvdT>t3a9u^ z`}O&Zp^VqX$_asI!}^Qgbt&FTVa?C%i~lOPR_Bh)^_-v2b!C!E_+)E^wl}NT`JXck z-fhsOaOk7?v1JR4CJ2}W?EQVNKB{QjuT9^QcfXhVJx|4R#qp +#endif + #ifdef IMPORT_QUICK3D_ASSETS #include #endif @@ -618,6 +622,11 @@ void Qt5InformationNodeInstanceServer::handleNode3DDestroyed(QObject *obj) } else if (qobject_cast(obj)) { QMetaObject::invokeMethod(m_editView3DData.rootItem, "releaseLightGizmo", Q_ARG(QVariant, objectToVariant(obj))); +#ifdef QUICK3D_PARTICLES_MODULE + } else if (qobject_cast(obj)) { + QMetaObject::invokeMethod(m_editView3DData.rootItem, "releaseParticleSystemGizmo", + Q_ARG(QVariant, objectToVariant(obj))); +#endif } removeNode3D(obj); #else @@ -720,6 +729,12 @@ void Qt5InformationNodeInstanceServer::resolveSceneRoots() QMetaObject::invokeMethod(m_editView3DData.rootItem, "updateLightGizmoScene", Q_ARG(QVariant, objectToVariant(newRoot)), Q_ARG(QVariant, objectToVariant(node))); +#ifdef QUICK3D_PARTICLES_MODULE + } else if (qobject_cast(node)) { + QMetaObject::invokeMethod(m_editView3DData.rootItem, "updateParticleSystemGizmoScene", + Q_ARG(QVariant, objectToVariant(newRoot)), + Q_ARG(QVariant, objectToVariant(node))); +#endif } } ++it; @@ -1231,12 +1246,16 @@ void Qt5InformationNodeInstanceServer::createCameraAndLightGizmos( { QHash cameras; QHash lights; + QHash particleSystems; for (const ServerNodeInstance &instance : instanceList) { if (instance.isSubclassOf("QQuick3DCamera")) cameras[find3DSceneRoot(instance)] << instance.internalObject(); else if (instance.isSubclassOf("QQuick3DAbstractLight")) lights[find3DSceneRoot(instance)] << instance.internalObject(); + else if (instance.isSubclassOf("QQuick3DParticleSystem")) + particleSystems[find3DSceneRoot(instance)] << instance.internalObject(); + } auto cameraIt = cameras.constBegin(); @@ -1259,6 +1278,16 @@ void Qt5InformationNodeInstanceServer::createCameraAndLightGizmos( } ++lightIt; } + auto particleIt = particleSystems.constBegin(); + while (particleIt != particleSystems.constEnd()) { + const auto particleObjs = particleIt.value(); + for (auto &obj : particleObjs) { + QMetaObject::invokeMethod(m_editView3DData.rootItem, "addParticleSystemGizmo", + Q_ARG(QVariant, objectToVariant(particleIt.key())), + Q_ARG(QVariant, objectToVariant(obj))); + } + ++particleIt; + } } void Qt5InformationNodeInstanceServer::add3DViewPorts(const QList &instanceList) @@ -1740,6 +1769,9 @@ void Qt5InformationNodeInstanceServer::changeSelection(const ChangeSelectionComm #ifdef QUICK3D_MODULE if (qobject_cast(object) || qobject_cast(object) +#ifdef QUICK3D_PARTICLES_MODULE + || qobject_cast(object) +#endif || qobject_cast(object)) { return true; } diff --git a/src/tools/qml2puppet/CMakeLists.txt b/src/tools/qml2puppet/CMakeLists.txt index 3dbb875ce41..924e3a838c1 100644 --- a/src/tools/qml2puppet/CMakeLists.txt +++ b/src/tools/qml2puppet/CMakeLists.txt @@ -160,6 +160,14 @@ extend_qtc_executable(qml2puppet DEFINES IMPORT_QUICK3D_ASSETS ) +find_package(Qt5 5.15.0 COMPONENTS Quick3DParticles QUIET) +extend_qtc_executable(qml2puppet + CONDITION TARGET Qt5::Quick3DParticles + FEATURE_INFO "Qt Quick 3D particles" + DEPENDS Qt5::Quick3DParticles Qt5::Quick3DParticlesPrivate + DEFINES QUICK3D_PARTICLES_MODULE +) + extend_qtc_executable(qml2puppet CONDITION Qt5_VERSION VERSION_GREATER_EQUAL 6.0.0 diff --git a/src/tools/qml2puppet/qml2puppet.qbs b/src/tools/qml2puppet/qml2puppet.qbs index c2b57579563..7eff7ba02b7 100644 --- a/src/tools/qml2puppet/qml2puppet.qbs +++ b/src/tools/qml2puppet/qml2puppet.qbs @@ -18,11 +18,15 @@ QtcTool { Depends { name: "Qt.quick3d-private"; required: false } property bool useQuick3d: Utilities.versionCompare(Qt.core.version, "5.15") >= 0 && Qt["quick3d-private"].present + property bool useParticle3d: Utilities.versionCompare(Qt.core.version, "6.2") >= 0 + && Qt["quick3dparticles-private"].present cpp.defines: { var defines = base.filter(function(d) { return d != "QT_CREATOR"; }); if (useQuick3d) defines.push("QUICK3D_MODULE"); + if (useParticle3d) + defines.push("QUICK3D_PARTICLES_MODULE"); return defines; } Properties { From c69ef181abe5b4c59ccd2d7fd38dfaf1f1368358 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 9 Aug 2021 10:55:39 +0200 Subject: [PATCH 11/20] OutputWindow: Update auto-scroll flag when "Find" changes position In this case, the text edit's scroll bar does not emit a signal, nor is scrollContentsBy() called (Qt bug?). Therefore, we now check the scroll bar position also on a selection change. Note that this will still misbehave for the edge case where you search for something, then scroll back to the bottom, then search for the same string again and find the same result, because in that case the selection does not change. We live with that. Fixes: QTCREATORBUG-26100 Change-Id: Ib5555d9119117dd95c68175c4094bb0fd904f6e5 Reviewed-by: Orgad Shaneh --- src/plugins/coreplugin/outputwindow.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/outputwindow.cpp b/src/plugins/coreplugin/outputwindow.cpp index e04c3cd71d6..138001c104d 100644 --- a/src/plugins/coreplugin/outputwindow.cpp +++ b/src/plugins/coreplugin/outputwindow.cpp @@ -155,6 +155,10 @@ OutputWindow::OutputWindow(Context context, const QString &settingsKey, QWidget connect(verticalScrollBar(), &QAbstractSlider::actionTriggered, this, &OutputWindow::updateAutoScroll); + // For when "Find" changes the position; see QTCREATORBUG-26100. + connect(this, &QPlainTextEdit::selectionChanged, this, &OutputWindow::updateAutoScroll, + Qt::QueuedConnection); + undoAction->setEnabled(false); redoAction->setEnabled(false); cutAction->setEnabled(false); @@ -252,7 +256,7 @@ void OutputWindow::showEvent(QShowEvent *e) { QPlainTextEdit::showEvent(e); if (d->scrollToBottom) - verticalScrollBar()->setValue(verticalScrollBar()->maximum()); + scrollToBottom(); } void OutputWindow::wheelEvent(QWheelEvent *e) From 1afea827bb9360b682990f8aefe94a241bce6c4a Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 13 Aug 2021 11:41:52 +0200 Subject: [PATCH 12/20] Don't try to add absolute paths with FilePath::pathAppended() Change-Id: Ib4cc5cacb33679e4ed8d7aec24b6392c2e000b60 Reviewed-by: Alessandro Portale Reviewed-by: Eike Ziller --- src/plugins/android/androidmanager.cpp | 4 ++-- src/plugins/android/createandroidmanifestwizard.cpp | 2 +- src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index 53bc79cd1f7..f2e75a5fd4d 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -213,13 +213,13 @@ QJsonObject AndroidManager::deploymentSettings(const Target *target) const QStringList abis = applicationAbis(target); QTC_ASSERT(abis.size() == 1, return {}); settings["stdcpp-path"] = (AndroidConfigurations::currentConfig().toolchainPath(qt) - / "sysroot/usr/lib/" + / "sysroot/usr/lib" / archTriplet(abis.first()) / "libc++_shared.so").toString(); } else { settings["stdcpp-path"] = AndroidConfigurations::currentConfig() .toolchainPath(qt) - .pathAppended("sysroot/usr/lib/") + .pathAppended("sysroot/usr/lib") .toString(); } settings["toolchain-prefix"] = "llvm"; diff --git a/src/plugins/android/createandroidmanifestwizard.cpp b/src/plugins/android/createandroidmanifestwizard.cpp index 54e77173406..a277f7d541f 100644 --- a/src/plugins/android/createandroidmanifestwizard.cpp +++ b/src/plugins/android/createandroidmanifestwizard.cpp @@ -319,7 +319,7 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles() if (m_copyGradle) { FilePath gradlePath = version->prefix().pathAppended("src/3rdparty/gradle"); if (!gradlePath.exists()) - gradlePath = AndroidConfigurations::currentConfig().sdkLocation().pathAppended("/tools/templates/gradle/wrapper"); + gradlePath = AndroidConfigurations::currentConfig().sdkLocation().pathAppended("tools/templates/gradle/wrapper"); FileUtils::copyRecursively(gradlePath, FilePath::fromString(m_directory), nullptr, copy); } diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 463ebc4cb41..e42732c4b51 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -668,7 +668,7 @@ void CMakeBuildSystem::updateProjectData() QList moduleMappings; for (const RawProjectPart &rpp : qAsConst(rpps)) { FilePath moduleMapFile = cmakeBuildConfiguration()->buildDirectory() - .pathAppended("/qml_module_mappings/" + rpp.buildSystemTarget); + .pathAppended("qml_module_mappings/" + rpp.buildSystemTarget); if (moduleMapFile.exists()) { QFile mmf(moduleMapFile.toString()); if (mmf.open(QFile::ReadOnly)) { From 20eaf0bbeb6674d69d5a32eee0428418ea51923f Mon Sep 17 00:00:00 2001 From: Aleksei German Date: Mon, 9 Aug 2021 18:58:14 +0200 Subject: [PATCH 13/20] QmlDesigner: Fix for Annotation images crash - removed direct usage of SessionManager - replaced it with DesignDocument usage - deactivated add image button for files without projects - add hasProject method to DesignDocument Task-number: QDS-4810 Change-Id: I77c74f3c6e9b5b9dcbda68f7937cfeda531d0309 Reviewed-by: Tapani Mattila Reviewed-by: Qt CI Bot Reviewed-by: Thomas Hartmann --- .../annotationeditor/annotationcommenttab.cpp | 63 +++++++++++++++---- .../annotationeditor/annotationcommenttab.h | 13 ++-- .../components/integration/designdocument.cpp | 5 ++ .../components/integration/designdocument.h | 1 + 4 files changed, 63 insertions(+), 19 deletions(-) diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.cpp b/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.cpp index 9a930747215..17d3cdd957f 100644 --- a/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.cpp +++ b/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. @@ -24,18 +24,17 @@ ****************************************************************************/ #include "annotationcommenttab.h" -#include "defaultannotations.h" #include "ui_annotationcommenttab.h" -#include "richtexteditor/richtexteditor.h" +#include "defaultannotations.h" + +#include +#include +#include +#include #include -#include "projectexplorer/session.h" -#include "projectexplorer/target.h" -#include "qmldesignerplugin.h" -#include "qmlprojectmanager/qmlproject.h" - namespace QmlDesigner { AnnotationCommentTab::AnnotationCommentTab(QWidget *parent) @@ -50,10 +49,27 @@ AnnotationCommentTab::AnnotationCommentTab(QWidget *parent) filePath = backupFile(filePath); }); - Utils::FilePath projPath = ProjectExplorer::SessionManager::startupProject()->projectFilePath(); + m_editor->setImageActionVisible(false); - m_editor->setDocumentBaseUrl(QUrl::fromLocalFile(projPath.toString())); - m_editor->setImageActionVisible(true); + const QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance() + ->documentManager().currentDesignDocument(); + Utils::FilePath projectPath; + + Q_ASSERT(designDocument); + + if (designDocument) { + if (designDocument->currentTarget() && designDocument->currentTarget()->project()) { + projectPath = designDocument->currentTarget()->project()->projectFilePath(); + m_editor->setImageActionVisible(true); + } + + if (projectPath.isEmpty()) { + projectPath = designDocument->fileName(); + m_editor->setImageActionVisible(false); + } + + m_editor->setDocumentBaseUrl(QUrl::fromLocalFile(projectPath.toString())); + } ui->formLayout->setWidget(3, QFormLayout::FieldRole, m_editor); @@ -124,14 +140,35 @@ void AnnotationCommentTab::setDefaultAnnotations(DefaultAnnotationsModel *defaul QString AnnotationCommentTab::backupFile(const QString &filePath) { - const QDir projDir( - ProjectExplorer::SessionManager::startupProject()->projectDirectory().toString()); + const QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance() + ->documentManager().currentDesignDocument(); + Utils::FilePath projectFolderPath; + + Q_ASSERT(designDocument); + + if (designDocument) { + if (designDocument->hasProject()) + projectFolderPath = designDocument->projectFolder(); + if (projectFolderPath.isEmpty()) + projectFolderPath = designDocument->fileName().parentDir(); + } + else + return {}; + + const QDir projDir(projectFolderPath.toDir()); + + if (!projDir.exists()) + return {}; const QString imageSubDir(".AnnotationImages"); const QDir imgDir(projDir.absolutePath() + QDir::separator() + imageSubDir); ensureDir(imgDir); + Q_ASSERT(imgDir.exists()); + if (!imgDir.exists()) + return {}; + const QFileInfo oldFile(filePath); QFileInfo newFile(imgDir, oldFile.fileName()); diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.h b/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.h index beb2e4c3774..a1e2509590d 100644 --- a/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.h +++ b/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. @@ -25,7 +25,7 @@ #pragma once -#include "annotation.h" +#include #include #include @@ -67,16 +67,17 @@ public: signals: void titleChanged(const QString &text, QWidget *widget); +private: + QString backupFile(const QString &filePath); + void ensureDir(const QDir &dir); + int compareFileChecksum(const QString &firstFile, const QString &secondFile); + private: std::unique_ptr ui; RichTextEditor *m_editor; Comment m_comment; QPointer m_defaults; - - QString backupFile(const QString &filePath); - void ensureDir(const QDir &dir); - int compareFileChecksum(const QString &firstFile, const QString &secondFile); }; } //namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index d5e5757f9e7..9374e61776b 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -288,6 +288,11 @@ Utils::FilePath DesignDocument::projectFolder() const return {}; } +bool DesignDocument::hasProject() const +{ + return ProjectExplorer::SessionManager::projectForFile(fileName()); +} + void DesignDocument::changeToInFileComponentModel(ComponentTextModifier *textModifer) { m_inFileComponentTextModifier.reset(textModifer); diff --git a/src/plugins/qmldesigner/components/integration/designdocument.h b/src/plugins/qmldesigner/components/integration/designdocument.h index 3b0ed8c9edb..0e73c13e31c 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.h +++ b/src/plugins/qmldesigner/components/integration/designdocument.h @@ -101,6 +101,7 @@ public: bool isQtForMCUsProject() const; Utils::FilePath projectFolder() const; + bool hasProject() const; signals: void displayNameChanged(const QString &newFileName); From 341234f3cfe7bde31b00a7459af852ba19172114 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 13 Aug 2021 14:40:41 +0200 Subject: [PATCH 14/20] LanguageClient: always connect client to manager The client will be either freshly created or if it was restarted disconnected in LanguageClientManager::clientFinished Change-Id: I647d0aaa918419c328013b2dc978d345f7e09c32 Reviewed-by: Eike Ziller --- .../languageclient/languageclientmanager.cpp | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/plugins/languageclient/languageclientmanager.cpp b/src/plugins/languageclient/languageclientmanager.cpp index a2ae95a1fad..025240755c4 100644 --- a/src/plugins/languageclient/languageclientmanager.cpp +++ b/src/plugins/languageclient/languageclientmanager.cpp @@ -110,23 +110,23 @@ void LanguageClientManager::clientStarted(Client *client) clientFinished(client); return; } - if (!managerInstance->m_clients.contains(client)) { + if (!managerInstance->m_clients.contains(client)) managerInstance->m_clients << client; - connect(client, &Client::finished, managerInstance, [client]() { clientFinished(client); }); - connect(client, - &Client::initialized, - managerInstance, - [client](const LanguageServerProtocol::ServerCapabilities &capabilities) { - managerInstance->m_currentDocumentLocatorFilter.updateCurrentClient(); - managerInstance->m_inspector.clientInitialized(client->name(), capabilities); - }); - connect(client, - &Client::capabilitiesChanged, - managerInstance, - [client](const DynamicCapabilities &capabilities) { - managerInstance->m_inspector.updateCapabilities(client->name(), capabilities); - }); - } + + connect(client, &Client::finished, managerInstance, [client]() { clientFinished(client); }); + connect(client, + &Client::initialized, + managerInstance, + [client](const LanguageServerProtocol::ServerCapabilities &capabilities) { + managerInstance->m_currentDocumentLocatorFilter.updateCurrentClient(); + managerInstance->m_inspector.clientInitialized(client->name(), capabilities); + }); + connect(client, + &Client::capabilitiesChanged, + managerInstance, + [client](const DynamicCapabilities &capabilities) { + managerInstance->m_inspector.updateCapabilities(client->name(), capabilities); + }); client->initialize(); } From 14d1726c95ce01d3dc3699e2f05158de5cfa6635 Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Fri, 13 Aug 2021 17:04:58 +0200 Subject: [PATCH 15/20] QmlDesigner: Fix crash with ColorEditorSingleton Fix a crash that was caused by ColorPaletteSingleton being shared among multiple QQnlEngines. Each engine requires a unique instance of ColorEditorSingleton. * Rewrite ColorEditorSingleton to not be a singleton anymore * Rename ColorEditorSingleton to ColorEditorBackend * Add meaningful warnings Task-number: QDS-4728 Change-Id: I1ed3315add33754b41870ad6f43c1365a899102b Reviewed-by: Qt CI Bot Reviewed-by: Thomas Hartmann --- .../imports/HelperWidgets/ColorEditor.qml | 4 +- .../imports/HelperWidgets/ColorPalette.qml | 20 ++--- src/plugins/qmldesigner/CMakeLists.txt | 2 +- ...esingleton.cpp => colorpalettebackend.cpp} | 82 +++++++++---------- ...lettesingleton.h => colorpalettebackend.h} | 30 +++---- .../propertyeditor/propertyeditor.pri | 4 +- .../quick2propertyeditorview.cpp | 4 +- src/plugins/qmldesigner/qmldesignerplugin.qbs | 4 +- 8 files changed, 72 insertions(+), 78 deletions(-) rename src/plugins/qmldesigner/components/propertyeditor/{colorpalettesingleton.cpp => colorpalettebackend.cpp} (80%) rename src/plugins/qmldesigner/components/propertyeditor/{colorpalettesingleton.h => colorpalettebackend.h} (87%) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml index 2a292d4ab44..2ed45ea3e12 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml @@ -478,7 +478,7 @@ SecondColumnLayout { icon: StudioTheme.Constants.eyeDropper pixelSize: StudioTheme.Values.myIconFontSize * 1.4 tooltip: qsTr("Eye Dropper") - onClicked: ColorPaletteSingleton.eyeDropper() + onClicked: ColorPaletteBackend.eyeDropper() } IconIndicator { @@ -700,7 +700,7 @@ SecondColumnLayout { StudioControls.MenuItem { text: qsTr("Add to Favorites") - onTriggered: ColorPaletteSingleton.addFavoriteColor( + onTriggered: ColorPaletteBackend.addFavoriteColor( contextMenuFavorite.currentColor) } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorPalette.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorPalette.qml index 4ff74c7aa73..cc007f14636 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorPalette.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorPalette.qml @@ -41,12 +41,12 @@ Column { spacing: 10 function addColorToPalette(colorStr) { - ColorPaletteSingleton.addRecentColor(colorStr) + ColorPaletteBackend.addRecentColor(colorStr) } function showColorDialog(color) { root.oldColor = color - ColorPaletteSingleton.showDialog(color) + ColorPaletteBackend.showDialog(color) } signal dialogColorChanged @@ -92,14 +92,14 @@ Column { StudioControls.MenuItem { visible: colorMode.currentText === "Favorite" text: qsTr("Remove from Favorites") - onTriggered: ColorPaletteSingleton.removeFavoriteColor(index) + onTriggered: ColorPaletteBackend.removeFavoriteColor(index) height: visible ? implicitHeight : 0 } StudioControls.MenuItem { visible: colorMode.currentText !== "Favorite" text: qsTr("Add to Favorites") - onTriggered: ColorPaletteSingleton.addFavoriteColor(modelData) + onTriggered: ColorPaletteBackend.addFavoriteColor(modelData) height: visible ? implicitHeight : 0 } } @@ -108,7 +108,7 @@ Column { Connections { id: singletonConnection - target: ColorPaletteSingleton + target: ColorPaletteBackend function onCurrentColorChanged(color) { root.selectedColor = color @@ -132,18 +132,18 @@ Column { + 4 * StudioTheme.Values.colorEditorPopupSpinBoxWidth width: implicitWidth actionIndicatorVisible: false - model: ColorPaletteSingleton.palettes - currentIndex: colorMode.find(ColorPaletteSingleton.currentPalette) + model: ColorPaletteBackend.palettes + currentIndex: colorMode.find(ColorPaletteBackend.currentPalette) - onActivated: ColorPaletteSingleton.currentPalette = colorMode.currentText + onActivated: ColorPaletteBackend.currentPalette = colorMode.currentText - Component.onCompleted: colorMode.currentIndex = colorMode.find(ColorPaletteSingleton.currentPalette) + Component.onCompleted: colorMode.currentIndex = colorMode.find(ColorPaletteBackend.currentPalette) } } GridView { id: colorPaletteView - model: ColorPaletteSingleton.currentPaletteColors + model: ColorPaletteBackend.currentPaletteColors delegate: colorItemDelegate cellWidth: StudioTheme.Values.colorEditorPopupSpinBoxWidth + StudioTheme.Values.controlGap diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt index 109368c0e5e..e578445ac49 100644 --- a/src/plugins/qmldesigner/CMakeLists.txt +++ b/src/plugins/qmldesigner/CMakeLists.txt @@ -353,7 +353,7 @@ extend_qtc_plugin(QmlDesigner SOURCES_PREFIX components/propertyeditor SOURCES aligndistribute.cpp aligndistribute.h - colorpalettesingleton.cpp colorpalettesingleton.h + colorpalettebackend.cpp colorpalettebackend.h designerpropertymap.cpp designerpropertymap.h fileresourcesmodel.cpp fileresourcesmodel.h itemfiltermodel.cpp itemfiltermodel.h diff --git a/src/plugins/qmldesigner/components/propertyeditor/colorpalettesingleton.cpp b/src/plugins/qmldesigner/components/propertyeditor/colorpalettebackend.cpp similarity index 80% rename from src/plugins/qmldesigner/components/propertyeditor/colorpalettesingleton.cpp rename to src/plugins/qmldesigner/components/propertyeditor/colorpalettebackend.cpp index 65d78aa1d4f..c848eed2db5 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/colorpalettesingleton.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/colorpalettebackend.cpp @@ -23,7 +23,7 @@ ** ****************************************************************************/ -#include "colorpalettesingleton.h" +#include "colorpalettebackend.h" #include #include @@ -36,9 +36,9 @@ namespace QmlDesigner { -QPointer ColorPaletteSingleton::m_instance = nullptr; +QPointer ColorPaletteBackend::m_instance = nullptr; -ColorPaletteSingleton::ColorPaletteSingleton() +ColorPaletteBackend::ColorPaletteBackend() : m_currentPalette() , m_data() , m_colorPickingEventFilter(nullptr) @@ -58,24 +58,16 @@ ColorPaletteSingleton::ColorPaletteSingleton() dummyTransparentWindow.resize(1, 1); dummyTransparentWindow.setFlags(Qt::Tool | Qt::FramelessWindowHint); updateTimer = new QTimer(this); - connect(updateTimer, &QTimer::timeout, this, &ColorPaletteSingleton::updateEyeDropper); + connect(updateTimer, &QTimer::timeout, this, &ColorPaletteBackend::updateEyeDropper); #endif } -ColorPaletteSingleton::~ColorPaletteSingleton() +ColorPaletteBackend::~ColorPaletteBackend() { //writePalettes(); // TODO crash on QtDS close } -ColorPaletteSingleton *ColorPaletteSingleton::instance() -{ - if (m_instance == nullptr) - m_instance = new ColorPaletteSingleton(); - - return m_instance; -} - -void ColorPaletteSingleton::readPalettes() +void ColorPaletteBackend::readPalettes() { QHash::iterator i = m_data.begin(); while (i != m_data.end()) { @@ -84,7 +76,7 @@ void ColorPaletteSingleton::readPalettes() } } -void ColorPaletteSingleton::writePalettes() +void ColorPaletteBackend::writePalettes() { QHash::iterator i = m_data.begin(); while (i != m_data.end()) { @@ -93,10 +85,10 @@ void ColorPaletteSingleton::writePalettes() } } -void ColorPaletteSingleton::addColor(const QString &color, const QString &palette) +void ColorPaletteBackend::addColor(const QString &color, const QString &palette) { if (!m_data.contains(palette)) { - qWarning() << "TODO"; + qWarning() << Q_FUNC_INFO << "Unknown palette: " << palette; return; } @@ -116,15 +108,15 @@ void ColorPaletteSingleton::addColor(const QString &color, const QString &palett m_data[palette].write(); } -void ColorPaletteSingleton::removeColor(int id, const QString &palette) +void ColorPaletteBackend::removeColor(int id, const QString &palette) { if (!m_data.contains(palette)) { - qWarning() << "TODO"; + qWarning() << Q_FUNC_INFO << "Unknown palette: " << palette; return; } if (id >= m_data[palette].m_colors.size()) { - qWarning() << "TODO"; + qWarning() << Q_FUNC_INFO << "Id(" << id << ") is out of bounds for palette " << palette; return; } @@ -143,7 +135,7 @@ void ColorPaletteSingleton::removeColor(int id, const QString &palette) m_data[palette].write(); } -void ColorPaletteSingleton::addRecentColor(const QString &item) +void ColorPaletteBackend::addRecentColor(const QString &item) { if (m_data[g_recent].m_colors.isEmpty()) { addColor(item, g_recent); @@ -155,30 +147,30 @@ void ColorPaletteSingleton::addRecentColor(const QString &item) addColor(item, g_recent); } -void ColorPaletteSingleton::addFavoriteColor(const QString &item) +void ColorPaletteBackend::addFavoriteColor(const QString &item) { addColor(item, g_favorite); } -void ColorPaletteSingleton::removeFavoriteColor(int id) +void ColorPaletteBackend::removeFavoriteColor(int id) { removeColor(id, g_favorite); } -QStringList ColorPaletteSingleton::palettes() const +QStringList ColorPaletteBackend::palettes() const { return m_data.keys(); } -const QString &ColorPaletteSingleton::currentPalette() const +const QString &ColorPaletteBackend::currentPalette() const { return m_currentPalette; } -void ColorPaletteSingleton::setCurrentPalette(const QString &palette) +void ColorPaletteBackend::setCurrentPalette(const QString &palette) { if (!m_data.contains(palette)) { - qWarning() << "TODO"; + qWarning() << Q_FUNC_INFO << "Unknown palette: " << palette; return; } @@ -207,35 +199,35 @@ void ColorPaletteSingleton::setCurrentPalette(const QString &palette) emit currentPaletteColorsChanged(); } -const QStringList &ColorPaletteSingleton::currentPaletteColors() const +const QStringList &ColorPaletteBackend::currentPaletteColors() const { return m_currentPaletteColors; } -void ColorPaletteSingleton::registerDeclarativeType() +void ColorPaletteBackend::registerDeclarativeType() { - static const int typeIndex = qmlRegisterSingletonType( - "QtQuickDesignerColorPalette", 1, 0, "ColorPaletteSingleton", [](QQmlEngine *, QJSEngine *) { - return ColorPaletteSingleton::instance(); + static const int typeIndex = qmlRegisterSingletonType( + "QtQuickDesignerColorPalette", 1, 0, "ColorPaletteBackend", [](QQmlEngine *, QJSEngine *) { + return new ColorPaletteBackend(); }); Q_UNUSED(typeIndex) } -void ColorPaletteSingleton::showDialog(QColor color) +void ColorPaletteBackend::showDialog(QColor color) { auto colorDialog = new QColorDialog(Core::ICore::dialogParent()); colorDialog->setCurrentColor(color); colorDialog->setAttribute(Qt::WA_DeleteOnClose); connect(colorDialog, &QDialog::rejected, - this, &ColorPaletteSingleton::colorDialogRejected); + this, &ColorPaletteBackend::colorDialogRejected); connect(colorDialog, &QColorDialog::currentColorChanged, - this, &ColorPaletteSingleton::currentColorChanged); + this, &ColorPaletteBackend::currentColorChanged); QTimer::singleShot(0, [colorDialog](){ colorDialog->exec(); }); } -void ColorPaletteSingleton::eyeDropper() +void ColorPaletteBackend::eyeDropper() { QWidget *widget = QApplication::activeWindow(); if (!widget) @@ -274,12 +266,12 @@ const int g_screenGrabHeight = 7; const int g_pixelX = 3; const int g_pixelY = 3; -QColor ColorPaletteSingleton::grabScreenColor(const QPoint &p) +QColor ColorPaletteBackend::grabScreenColor(const QPoint &p) { return grabScreenRect(p).pixel(g_pixelX, g_pixelY); } -QImage ColorPaletteSingleton::grabScreenRect(const QPoint &p) +QImage ColorPaletteBackend::grabScreenRect(const QPoint &p) { QScreen *screen = QGuiApplication::screenAt(p); if (!screen) @@ -289,7 +281,7 @@ QImage ColorPaletteSingleton::grabScreenRect(const QPoint &p) return pixmap.toImage(); } -void ColorPaletteSingleton::updateEyeDropper() +void ColorPaletteBackend::updateEyeDropper() { #ifndef QT_NO_CURSOR static QPoint lastGlobalPos; @@ -306,12 +298,12 @@ void ColorPaletteSingleton::updateEyeDropper() #endif // ! QT_NO_CURSOR } -void ColorPaletteSingleton::updateEyeDropperPosition(const QPoint &globalPos) +void ColorPaletteBackend::updateEyeDropperPosition(const QPoint &globalPos) { updateCursor(grabScreenRect(globalPos)); } -void ColorPaletteSingleton::updateCursor(const QImage &image) +void ColorPaletteBackend::updateCursor(const QImage &image) { QWidget *widget = QApplication::activeWindow(); if (!widget) @@ -351,7 +343,7 @@ void ColorPaletteSingleton::updateCursor(const QImage &image) widget->setCursor(cursor); } -void ColorPaletteSingleton::releaseEyeDropper() +void ColorPaletteBackend::releaseEyeDropper() { QWidget *widget = QApplication::activeWindow(); if (!widget) @@ -369,13 +361,13 @@ void ColorPaletteSingleton::releaseEyeDropper() widget->unsetCursor(); } -bool ColorPaletteSingleton::handleEyeDropperMouseMove(QMouseEvent *e) +bool ColorPaletteBackend::handleEyeDropperMouseMove(QMouseEvent *e) { updateEyeDropperPosition(e->globalPos()); return true; } -bool ColorPaletteSingleton::handleEyeDropperMouseButtonRelease(QMouseEvent *e) +bool ColorPaletteBackend::handleEyeDropperMouseButtonRelease(QMouseEvent *e) { if (e->button() == Qt::LeftButton) emit currentColorChanged(grabScreenColor(e->globalPos())); @@ -386,7 +378,7 @@ bool ColorPaletteSingleton::handleEyeDropperMouseButtonRelease(QMouseEvent *e) return true; } -bool ColorPaletteSingleton::handleEyeDropperKeyPress(QKeyEvent *e) +bool ColorPaletteBackend::handleEyeDropperKeyPress(QKeyEvent *e) { #if QT_CONFIG(shortcut) if (e->matches(QKeySequence::Cancel)) { diff --git a/src/plugins/qmldesigner/components/propertyeditor/colorpalettesingleton.h b/src/plugins/qmldesigner/components/propertyeditor/colorpalettebackend.h similarity index 87% rename from src/plugins/qmldesigner/components/propertyeditor/colorpalettesingleton.h rename to src/plugins/qmldesigner/components/propertyeditor/colorpalettebackend.h index 153cc52f9ef..2042b30802f 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/colorpalettesingleton.h +++ b/src/plugins/qmldesigner/components/propertyeditor/colorpalettebackend.h @@ -78,7 +78,7 @@ struct Palette QStringList m_colors; }; -class ColorPaletteSingleton : public QObject +class ColorPaletteBackend : public QObject { Q_OBJECT @@ -94,9 +94,7 @@ class ColorPaletteSingleton : public QObject NOTIFY palettesChanged) public: - static ColorPaletteSingleton *instance(); - - ~ColorPaletteSingleton(); + ~ColorPaletteBackend(); void readPalettes(); void writePalettes(); @@ -140,8 +138,8 @@ public: bool handleEyeDropperKeyPress(QKeyEvent *e); - ColorPaletteSingleton(const ColorPaletteSingleton &) = delete; - void operator=(const ColorPaletteSingleton &) = delete; + ColorPaletteBackend(const ColorPaletteBackend &) = delete; + void operator=(const ColorPaletteBackend &) = delete; signals: void currentPaletteChanged(const QString &palette); @@ -154,10 +152,10 @@ signals: void eyeDropperRejected(); private: - ColorPaletteSingleton(); + ColorPaletteBackend(); private: - static QPointer m_instance; + static QPointer m_instance; QString m_currentPalette; QStringList m_currentPaletteColors; QHash m_data; @@ -171,29 +169,33 @@ private: class QColorPickingEventFilter : public QObject { public: - explicit QColorPickingEventFilter(QObject *parent = 0) - : QObject(parent) + explicit QColorPickingEventFilter(ColorPaletteBackend *colorPalette) + : QObject(colorPalette) + , m_colorPalette(colorPalette) {} bool eventFilter(QObject *, QEvent *event) override { switch (event->type()) { case QEvent::MouseMove: - return ColorPaletteSingleton::instance()->handleEyeDropperMouseMove( + return m_colorPalette->handleEyeDropperMouseMove( static_cast(event)); case QEvent::MouseButtonRelease: - return ColorPaletteSingleton::instance()->handleEyeDropperMouseButtonRelease( + return m_colorPalette->handleEyeDropperMouseButtonRelease( static_cast(event)); case QEvent::KeyPress: - return ColorPaletteSingleton::instance()->handleEyeDropperKeyPress( + return m_colorPalette->handleEyeDropperKeyPress( static_cast(event)); default: break; } return false; } + +private: + ColorPaletteBackend *m_colorPalette; }; } // namespace QmlDesigner -QML_DECLARE_TYPE(QmlDesigner::ColorPaletteSingleton) +QML_DECLARE_TYPE(QmlDesigner::ColorPaletteBackend) diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri index 0360652fbf0..dc8407e66b0 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri @@ -16,7 +16,7 @@ SOURCES += propertyeditorview.cpp \ gradientpresetlistmodel.cpp \ gradientpresetdefaultlistmodel.cpp \ gradientpresetcustomlistmodel.cpp \ - colorpalettesingleton.cpp \ + colorpalettebackend.cpp \ itemfiltermodel.cpp \ aligndistribute.cpp \ tooltip.cpp @@ -37,7 +37,7 @@ HEADERS += propertyeditorview.h \ gradientpresetlistmodel.h \ gradientpresetdefaultlistmodel.h \ gradientpresetcustomlistmodel.h \ - colorpalettesingleton.h \ + colorpalettebackend.h \ itemfiltermodel.h \ aligndistribute.h \ tooltip.h diff --git a/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp index 6298448bbc3..09450cdb7ca 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp @@ -29,7 +29,7 @@ #include "annotationeditor/annotationeditor.h" #include "bindingeditor/actioneditor.h" #include "bindingeditor/bindingeditor.h" -#include "colorpalettesingleton.h" +#include "colorpalettebackend.h" #include "fileresourcesmodel.h" #include "gradientmodel.h" #include "gradientpresetcustomlistmodel.h" @@ -63,7 +63,7 @@ void Quick2PropertyEditorView::registerQmlTypes() GradientPresetDefaultListModel::registerDeclarativeType(); GradientPresetCustomListModel::registerDeclarativeType(); ItemFilterModel::registerDeclarativeType(); - ColorPaletteSingleton::registerDeclarativeType(); + ColorPaletteBackend::registerDeclarativeType(); Internal::QmlAnchorBindingProxy::registerDeclarativeType(); BindingEditor::registerDeclarativeType(); ActionEditor::registerDeclarativeType(); diff --git a/src/plugins/qmldesigner/qmldesignerplugin.qbs b/src/plugins/qmldesigner/qmldesignerplugin.qbs index 37d8bf84bea..8b95987a7b9 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.qbs +++ b/src/plugins/qmldesigner/qmldesignerplugin.qbs @@ -677,8 +677,8 @@ Project { "navigator/previewtooltip.ui", "propertyeditor/aligndistribute.cpp", "propertyeditor/aligndistribute.h", - "propertyeditor/colorpalettesingleton.cpp", - "propertyeditor/colorpalettesingleton.h", + "propertyeditor/colorpalettebackend.cpp", + "propertyeditor/colorpalettebackend.h", "propertyeditor/designerpropertymap.cpp", "propertyeditor/designerpropertymap.h", "propertyeditor/fileresourcesmodel.cpp", From 99700bb00961da9515b9cabc09895aa50c2decae Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 12 Aug 2021 19:22:41 +0200 Subject: [PATCH 16/20] Android: Enforce portable/clean Android SDK path When reading a path from file chooser, settings or environment variable, make sure it is portable and "clean". Avoids extra compiler registrations, invalid Kits and similar issues. Fixes: QTCREATORBUG-26092 Change-Id: I2a11563f40973d5f595bf00e37ff045a503aa9f7 Reviewed-by: Eike Ziller --- src/plugins/android/androidconfigurations.cpp | 6 +++--- src/plugins/android/androidsettingswidget.cpp | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index 7b00fb7f4f2..c93d5a78f2c 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -227,7 +227,7 @@ void AndroidConfig::load(const QSettings &settings) // user settings m_emulatorArgs = settings.value(EmulatorArgsKey, QStringList({"-netdelay", "none", "-netspeed", "full"})).toStringList(); - m_sdkLocation = FilePath::fromString(settings.value(SDKLocationKey).toString()); + m_sdkLocation = FilePath::fromUserInput(settings.value(SDKLocationKey).toString()).cleanPath(); m_customNdkList = settings.value(CustomNdkLocationsKey).toStringList(); m_sdkManagerToolArgs = settings.value(SDKManagerToolArgsKey).toStringList(); m_openJDKLocation = FilePath::fromString(settings.value(OpenJDKLocationKey).toString()); @@ -239,7 +239,7 @@ void AndroidConfig::load(const QSettings &settings) if (reader.load(FilePath::fromString(sdkSettingsFileName())) && settings.value(changeTimeStamp).toInt() != QFileInfo(sdkSettingsFileName()).lastModified().toMSecsSinceEpoch() / 1000) { // persisten settings - m_sdkLocation = FilePath::fromString(reader.restoreValue(SDKLocationKey, m_sdkLocation.toString()).toString()); + m_sdkLocation = FilePath::fromUserInput(reader.restoreValue(SDKLocationKey, m_sdkLocation.toString()).toString()).cleanPath(); m_customNdkList = reader.restoreValue(CustomNdkLocationsKey).toStringList(); m_sdkManagerToolArgs = reader.restoreValue(SDKManagerToolArgsKey, m_sdkManagerToolArgs).toStringList(); m_openJDKLocation = FilePath::fromString(reader.restoreValue(OpenJDKLocationKey, m_openJDKLocation.toString()).toString()); @@ -1024,7 +1024,7 @@ FilePath AndroidConfig::defaultSdkPath() { QString sdkFromEnvVar = QString::fromLocal8Bit(getenv("ANDROID_SDK_ROOT")); if (!sdkFromEnvVar.isEmpty()) - return Utils::FilePath::fromString(sdkFromEnvVar); + return FilePath::fromUserInput(sdkFromEnvVar).cleanPath(); // Set default path of SDK as used by Android Studio if (Utils::HostOsInfo::isMacHost()) { diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp index 6c5d7ed514c..f2329294c8d 100644 --- a/src/plugins/android/androidsettingswidget.cpp +++ b/src/plugins/android/androidsettingswidget.cpp @@ -596,7 +596,7 @@ void AndroidSettingsWidget::validateOpenSsl() void AndroidSettingsWidget::onSdkPathChanged() { - const FilePath sdkPath = m_ui.SDKLocationPathChooser->filePath(); + const FilePath sdkPath = m_ui.SDKLocationPathChooser->filePath().cleanPath(); m_androidConfig.setSdkLocation(sdkPath); FilePath currentOpenSslPath = m_androidConfig.openSslLocation(); if (currentOpenSslPath.isEmpty() || !currentOpenSslPath.exists()) @@ -608,7 +608,7 @@ void AndroidSettingsWidget::onSdkPathChanged() void AndroidSettingsWidget::validateSdk() { - const FilePath sdkPath = m_ui.SDKLocationPathChooser->filePath(); + const FilePath sdkPath = m_ui.SDKLocationPathChooser->filePath().cleanPath(); m_androidConfig.setSdkLocation(sdkPath); m_androidSummary->setPointValid(SdkPathExistsRow, m_androidConfig.sdkLocation().exists()); @@ -865,14 +865,15 @@ void AndroidSettingsWidget::downloadSdk() } const QString message = tr("Download and install Android SDK Tools to: %1?") - .arg(m_ui.SDKLocationPathChooser->filePath().toUserOutput()); + .arg(m_ui.SDKLocationPathChooser->filePath().cleanPath().toUserOutput()); auto userInput = QMessageBox::information(this, AndroidSdkDownloader::dialogTitle(), message, QMessageBox::Yes | QMessageBox::No); if (userInput == QMessageBox::Yes) { if (m_javaSummary->allRowsOk()) { auto javaPath = m_ui.OpenJDKLocationPathChooser->filePath(); - m_sdkDownloader.downloadAndExtractSdk(javaPath.toString(), - m_ui.SDKLocationPathChooser->filePath().toString()); + m_sdkDownloader.downloadAndExtractSdk( + javaPath.toString(), + m_ui.SDKLocationPathChooser->filePath().cleanPath().toString()); } } } From 67a86b72b746c9258d6bf876bc8a59ef40fb53fe Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 13 Aug 2021 14:55:22 +0200 Subject: [PATCH 17/20] LanguageClient: do not send empty responses Even if we do not have to provide any data just send a null as the result so the server nows that the request did not fail. Fixes: QTCREATORBUG-26116 Change-Id: I9b965389bb197cdd81d0d3ffbac05f289cabda40 Reviewed-by: Eike Ziller --- .../languageserverprotocol/jsonrpcmessages.h | 37 ++++++++++++++++++- src/plugins/languageclient/client.cpp | 6 ++- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/libs/languageserverprotocol/jsonrpcmessages.h b/src/libs/languageserverprotocol/jsonrpcmessages.h index 1b31e2a6565..bb20ca8a3cd 100644 --- a/src/libs/languageserverprotocol/jsonrpcmessages.h +++ b/src/libs/languageserverprotocol/jsonrpcmessages.h @@ -236,7 +236,7 @@ public: Utils::optional result() const { - const QJsonValue &result = m_jsonObject.value("result"); + const QJsonValue &result = m_jsonObject.value(resultKey); if (result.isUndefined()) return Utils::nullopt; return Utils::make_optional(Result(result)); @@ -259,6 +259,41 @@ public: { return JsonRpcMessage::isValid(errorMessage) && id().isValid(); } }; +template +class Response : public JsonRpcMessage +{ +public: + explicit Response(const MessageId &id) { setId(id); } + using JsonRpcMessage::JsonRpcMessage; + + MessageId id() const + { return MessageId(m_jsonObject.value(idKey)); } + void setId(MessageId id) + { this->m_jsonObject.insert(idKey, id); } + + Utils::optional result() const + { + return m_jsonObject.value(resultKey).isNull() ? Utils::make_optional(nullptr) + : Utils::nullopt; + } + void setResult(const std::nullptr_t &) { m_jsonObject.insert(resultKey, QJsonValue::Null); } + void clearResult() { m_jsonObject.remove(resultKey); } + + using Error = ResponseError; + Utils::optional error() const + { + const QJsonValue &val = m_jsonObject.value(errorKey); + return val.isUndefined() ? Utils::nullopt + : Utils::make_optional(fromJsonValue(val)); + } + void setError(const Error &error) + { m_jsonObject.insert(errorKey, QJsonValue(error)); } + void clearError() { m_jsonObject.remove(errorKey); } + + bool isValid(QString *errorMessage) const override + { return JsonRpcMessage::isValid(errorMessage) && id().isValid(); } +}; + template class Request : public Notification { diff --git a/src/plugins/languageclient/client.cpp b/src/plugins/languageclient/client.cpp index a2a61f12244..87263038f67 100644 --- a/src/plugins/languageclient/client.cpp +++ b/src/plugins/languageclient/client.cpp @@ -1293,8 +1293,10 @@ void Client::handleMethod(const QString &method, const MessageId &id, const ICon response.setResult(result); sendContent(response); } else if (method == WorkDoneProgressCreateRequest::methodName) { - sendContent(WorkDoneProgressCreateRequest::Response( - dynamic_cast(content)->id())); + WorkDoneProgressCreateRequest::Response response( + dynamic_cast(content)->id()); + response.setResult(nullptr); + sendContent(response); } else if (method == ProgressNotification::methodName) { if (Utils::optional params = dynamic_cast(content)->params()) { From aef13a5dcdf557ea8afd95b4c20c593f4d56cb09 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 13 Aug 2021 16:48:39 +0300 Subject: [PATCH 18/20] QmlDesigner: Disable 3D particle systems from running on puppets Running 3D particle systems based on their application set properties is usually not desirable, so until we have proper solution for controlling particle systems from UI, we disable them entirely. Fixes: QDS-4773 Fixes: QDS-4801 Change-Id: I45682d8ac5a161a92be98fe9b0304ffb948f104f Reviewed-by: Thomas Hartmann --- src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp index 228b824bcb8..bd174ba400b 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp @@ -535,6 +535,7 @@ QProcessEnvironment PuppetCreator::processEnvironment() const import = QmlDesigner::Import::createLibraryImport("QtCharts", "2.0"); if (m_model->hasImport(import, true, true)) environment.set("QMLDESIGNER_FORCE_QAPPLICATION", "true"); + environment.set("QT_QUICK3D_DISABLE_PARTICLE_SYSTEMS", "1"); #endif QStringList importPaths = m_model->importPaths(); From a107a277b945bd0da824005211c43535efccdf6d Mon Sep 17 00:00:00 2001 From: Aleksei German Date: Wed, 11 Aug 2021 18:46:59 +0200 Subject: [PATCH 19/20] QmlDesigner: Fix for Annotation Table View Task-number: QDS-4636 Change-Id: I7eb31f58525264f763f06bed72636d1e9d905dc7 Reviewed-by: Aleksei German --- .../components/annotationeditor/annotationtableview.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp b/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp index b074a3dc48f..50c3f008382 100644 --- a/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp +++ b/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp @@ -357,14 +357,16 @@ QVector AnnotationTableView::fetchComments() const Comment AnnotationTableView::fetchComment(int row) const { - auto *item = m_model->item(row, ColumnId::Title); - if (item->text().isEmpty()) + const auto *item = m_model->item(row, ColumnId::Title); + Comment comment = item->data().value(); + + if (comment.isEmpty()) return {}; - Comment comment = item->data().value(); comment.setTitle(item->text()); comment.setAuthor(m_model->item(row, ColumnId::Author)->text()); comment.setText(dataToCommentText(m_model->item(row, ColumnId::Value)->data(Qt::DisplayRole))); + return comment; } From 2ab7176e79d12c6a9d32582416c25b7f1ce88c23 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 13 Aug 2021 08:39:33 +0200 Subject: [PATCH 20/20] QmlDesigner: Clean up singleton generation The singleton is of type QmlDesigner::Theme and there is no reason for the QObject cast. Change-Id: I352f3e455de8233c914f37ba93e2313a3a6357fe Reviewed-by: Qt CI Bot Reviewed-by: Thomas Hartmann --- .../qmldesigner/components/componentcore/theme.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/components/componentcore/theme.cpp b/src/plugins/qmldesigner/components/componentcore/theme.cpp index cb5cdb218e8..a2fea95603d 100644 --- a/src/plugins/qmldesigner/components/componentcore/theme.cpp +++ b/src/plugins/qmldesigner/components/componentcore/theme.cpp @@ -127,10 +127,10 @@ QString Theme::replaceCssColors(const QString &input) void Theme::setupTheme(QQmlEngine *engine) { - static const int typeIndex = qmlRegisterSingletonType("QtQuickDesignerTheme", 1, 0, - "Theme", [](QQmlEngine *, QJSEngine *) { - return qobject_cast(new Theme(Utils::creatorTheme(), nullptr)); - }); + static const int typeIndex = qmlRegisterSingletonType( + "QtQuickDesignerTheme", 1, 0, "Theme", [](QQmlEngine *engine, QJSEngine *) { + return new Theme(Utils::creatorTheme(), nullptr); + }); Q_UNUSED(typeIndex) engine->addImageProvider(QLatin1String("icons"), new QmlDesignerIconProvider());