From 428a097f347c949ecb727023bbee08e5dcff4e0c Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 17 May 2019 10:18:22 +0000 Subject: [PATCH 01/20] Revert "Perforce: Allow working with localhost server" It breaks the common use-case. Running p4 client -o in any directory returns Host, even if it is not managed by Perforce. This reverts commit 28f7c7935f4d142d5498d58465ff004462e996a6. Fixes: QTCREATORBUG-22458 Change-Id: Iaa84ff68e2c6d807c6c177ff2113b07380b4e5be Reviewed-by: Tobias Hunger --- src/plugins/perforce/perforcechecker.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/plugins/perforce/perforcechecker.cpp b/src/plugins/perforce/perforcechecker.cpp index 92dd5a4cc42..87b02e6ef30 100644 --- a/src/plugins/perforce/perforcechecker.cpp +++ b/src/plugins/perforce/perforcechecker.cpp @@ -175,6 +175,17 @@ static inline QString clientRootFromOutput(const QString &in) return QString(); } +// When p4 port and p4 user is set a preconfigured Root: is given, which doesn't relate with +// the current mapped project. In this case "Client:" has the same value as "Host:", which is an +// invalid case. +static inline bool clientAndHostAreEqual(const QString &in) +{ + QString client = findTerm(in, QLatin1String("Client:")); + QString host = findTerm(in, QLatin1String("Host:")); + + return client == host; +} + void PerforceChecker::parseOutput(const QString &response) { if (!response.contains(QLatin1String("View:")) && !response.contains(QLatin1String("//depot/"))) { @@ -182,6 +193,12 @@ void PerforceChecker::parseOutput(const QString &response) return; } + if (clientAndHostAreEqual(response)) { + // Is an invalid case. But not an error. QtC checks cmake install directories for + // p4 repositories, or the %temp% directory. + return; + } + const QString repositoryRoot = clientRootFromOutput(response); if (repositoryRoot.isEmpty()) { //: Unable to determine root of the p4 client installation From 65df4a2bc0d9a23ad57adc53585195104e6eab97 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 17 May 2019 16:43:41 +0200 Subject: [PATCH 02/20] QmlDesigner: Update animations when deleting timeline Task-number: QDS-663 Change-Id: Ieb0a8ea41cdd788e97ed1479026fe1c08b0196f1 Reviewed-by: Tim Jenssen --- .../timelineeditor/timelinesettingsdialog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsdialog.cpp b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsdialog.cpp index 6178c8cda2a..960c409553a 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsdialog.cpp +++ b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsdialog.cpp @@ -220,6 +220,7 @@ void TimelineSettingsDialog::setupTimelines(const QmlTimeline &timeline) } setTabForTimeline(ui->timelineTab, m_currentTimeline); + setupAnimations(m_currentTimeline); m_timelineSettingsModel->resetModel(); } From 36c167db5b11523f1adc7a61d135faaa3f8243a6 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 17 May 2019 16:25:16 +0200 Subject: [PATCH 03/20] Fix error message Task-number: QDS-664 Change-Id: Iba5b8917908c6a1e9068e813ca09f8ebe70a7a12 Reviewed-by: Tim Jenssen --- .../timelineeditor/timelinesettingsmodel.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsmodel.cpp b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsmodel.cpp index d9e9fd8a1c0..509a8878e87 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsmodel.cpp +++ b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsmodel.cpp @@ -295,9 +295,11 @@ void TimelineSettingsModel::updateTimeline(int row) propertyChanges.modelNode().variantProperty("enabled").setValue(false); } - QmlPropertyChanges propertyChanges(modelState.propertyChanges(timeline)); - if (propertyChanges.isValid()) - propertyChanges.modelNode().variantProperty("enabled").setValue(true); + if (timeline.isValid()) { + QmlPropertyChanges propertyChanges(modelState.propertyChanges(timeline)); + if (propertyChanges.isValid()) + propertyChanges.modelNode().variantProperty("enabled").setValue(true); + } } } catch (Exception &e) { @@ -345,9 +347,11 @@ void TimelineSettingsModel::updateAnimation(int row) } } - QmlPropertyChanges propertyChanges(modelState.propertyChanges(animation)); - if (propertyChanges.isValid()) - propertyChanges.modelNode().variantProperty("running").setValue(true); + if (animation.isValid()) { + QmlPropertyChanges propertyChanges(modelState.propertyChanges(animation)); + if (propertyChanges.isValid()) + propertyChanges.modelNode().variantProperty("running").setValue(true); + } } } catch (Exception &e) { m_exceptionError = e.description(); From e02213262e264bb6fcfeed9c3a38198663a04bd2 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 24 Jan 2017 16:53:03 +0100 Subject: [PATCH 04/20] QmlDesigner: Testproject for meta info hints Change-Id: I610f6180fb8b26d0bc84cd291781da2f06179b7a Reviewed-by: Thomas Hartmann --- .../metainfohints/MainForm.ui.qml | 65 ++++++++ .../metainfohints/imports/test/ForceClip.qml | 34 +++++ .../imports/test/OnlyFormEditor.qml | 34 +++++ .../imports/test/OnlyNavigator.qml | 34 +++++ .../imports/test/TestComponent.qml | 38 +++++ .../metainfohints/imports/test/TestLayout.qml | 30 ++++ .../imports/test/designer/MyPlugin.metainfo | 143 ++++++++++++++++++ .../metainfohints/imports/test/qmldir | 5 + .../metainfohints/metainfohints.qml | 13 ++ .../metainfohints/metainfohints.qmlproject | 18 +++ 10 files changed, 414 insertions(+) create mode 100644 tests/manual/qml/testprojects/metainfohints/MainForm.ui.qml create mode 100644 tests/manual/qml/testprojects/metainfohints/imports/test/ForceClip.qml create mode 100644 tests/manual/qml/testprojects/metainfohints/imports/test/OnlyFormEditor.qml create mode 100644 tests/manual/qml/testprojects/metainfohints/imports/test/OnlyNavigator.qml create mode 100644 tests/manual/qml/testprojects/metainfohints/imports/test/TestComponent.qml create mode 100644 tests/manual/qml/testprojects/metainfohints/imports/test/TestLayout.qml create mode 100644 tests/manual/qml/testprojects/metainfohints/imports/test/designer/MyPlugin.metainfo create mode 100644 tests/manual/qml/testprojects/metainfohints/imports/test/qmldir create mode 100644 tests/manual/qml/testprojects/metainfohints/metainfohints.qml create mode 100644 tests/manual/qml/testprojects/metainfohints/metainfohints.qmlproject diff --git a/tests/manual/qml/testprojects/metainfohints/MainForm.ui.qml b/tests/manual/qml/testprojects/metainfohints/MainForm.ui.qml new file mode 100644 index 00000000000..be32b09535d --- /dev/null +++ b/tests/manual/qml/testprojects/metainfohints/MainForm.ui.qml @@ -0,0 +1,65 @@ +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Layouts 1.3 +import Qt.labs.calendar 1.0 +import test 1.0 + +Item { + property alias mouseArea: mouseArea + property alias textEdit: textEdit + + width: 360 + height: 360 + TestComponent { + } + + ForceClip { + } + + Rectangle { + id: rectangle + x: 152 + y: 65 + width: 200 + height: 200 + color: "#ffffff" + + TestComponent { + id: testComponent + x: 55 + y: 35 + text: qsTr("This is text") + } + } + + Text { + id: text1 + x: 17 + y: 133 + text: qsTr("Text") + font.pixelSize: 12 + } + + TestLayout { + id: testLayout + x: 8 + y: 252 + width: 100 + height: 100 + + CheckBox { + id: checkBox + text: qsTr("Check Box") + } + + CheckBox { + id: checkBox1 + text: qsTr("Check Box") + } + + CheckBox { + id: checkBox2 + text: qsTr("Check Box") + } + } +} diff --git a/tests/manual/qml/testprojects/metainfohints/imports/test/ForceClip.qml b/tests/manual/qml/testprojects/metainfohints/imports/test/ForceClip.qml new file mode 100644 index 00000000000..6c332ae0d7c --- /dev/null +++ b/tests/manual/qml/testprojects/metainfohints/imports/test/ForceClip.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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. +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.3 + +Item { + Rectangle { + anchors.fill: parent + anchors.margins: -100 + } +} diff --git a/tests/manual/qml/testprojects/metainfohints/imports/test/OnlyFormEditor.qml b/tests/manual/qml/testprojects/metainfohints/imports/test/OnlyFormEditor.qml new file mode 100644 index 00000000000..65604f2c661 --- /dev/null +++ b/tests/manual/qml/testprojects/metainfohints/imports/test/OnlyFormEditor.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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. +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.3 + +Item { + default property alias content: layout.children + RowLayout { + id: layout + } +} diff --git a/tests/manual/qml/testprojects/metainfohints/imports/test/OnlyNavigator.qml b/tests/manual/qml/testprojects/metainfohints/imports/test/OnlyNavigator.qml new file mode 100644 index 00000000000..65604f2c661 --- /dev/null +++ b/tests/manual/qml/testprojects/metainfohints/imports/test/OnlyNavigator.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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. +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.3 + +Item { + default property alias content: layout.children + RowLayout { + id: layout + } +} diff --git a/tests/manual/qml/testprojects/metainfohints/imports/test/TestComponent.qml b/tests/manual/qml/testprojects/metainfohints/imports/test/TestComponent.qml new file mode 100644 index 00000000000..d18f3eb40fa --- /dev/null +++ b/tests/manual/qml/testprojects/metainfohints/imports/test/TestComponent.qml @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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. +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + width: 60 + height: 60 + color: "green" + property alias text: textItem.text + + Text { + id: textItem + anchors.centerIn: parent + } +} diff --git a/tests/manual/qml/testprojects/metainfohints/imports/test/TestLayout.qml b/tests/manual/qml/testprojects/metainfohints/imports/test/TestLayout.qml new file mode 100644 index 00000000000..56cc2437e75 --- /dev/null +++ b/tests/manual/qml/testprojects/metainfohints/imports/test/TestLayout.qml @@ -0,0 +1,30 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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. +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.3 + +Item { +} diff --git a/tests/manual/qml/testprojects/metainfohints/imports/test/designer/MyPlugin.metainfo b/tests/manual/qml/testprojects/metainfohints/imports/test/designer/MyPlugin.metainfo new file mode 100644 index 00000000000..efdec6ce6eb --- /dev/null +++ b/tests/manual/qml/testprojects/metainfohints/imports/test/designer/MyPlugin.metainfo @@ -0,0 +1,143 @@ +MetaInfo { + Type { + name: "test.TestComponent" + icon: ":/qtquickplugin/images/item-icon16.png" + + Hints { + canBeContainer: model.potentialChildIsSubclassOf("QtQuick.Text") + canBeReparented: model.potentialParentIsSubclassOf("QtQuick.Rectangle") + isResizable: false + isMovable: !model.currentParentIsSubclassOf("QtQuick.Rectangle"); + } + + ItemLibraryEntry { + name: "Test Component" + category: "Test Plugin" + libraryIcon: ":/qtquickplugin/images/item-icon.png" + version: "1.0" + requiredImport: "test" + + Property { + name: "text" + type: "binding" + value: "qsTr(\"This is text\")" + } + } + } + + Type { + name: "test.TestLayout" + icon: ":/qtquickplugin/images/item-icon16.png" + + Hints { + canBeContainer: true + doesLayoutChildren: true + } + + ItemLibraryEntry { + name: "Test Layout" + category: "Test Plugin" + libraryIcon: ":/qtquickplugin/images/item-icon.png" + version: "1.0" + requiredImport: "test" + + Property { + name: "width" + type: "int" + value: "100" + } + + Property { + name: "height" + type: "int" + value: "100" + } + } + } + + Type { + name: "test.OnlyNavigator" + icon: ":/qtquickplugin/images/item-icon16.png" + + Hints { + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Only Navigator" + category: "Test Plugin" + libraryIcon: ":/qtquickplugin/images/item-icon.png" + version: "1.0" + requiredImport: "test" + Property { + name: "width" + type: "int" + value: "100" + } + + Property { + name: "height" + type: "int" + value: "100" + } + } + } + + Type { + name: "test.OnlyFormEditor" + icon: ":/qtquickplugin/images/item-icon16.png" + + Hints { + canBeDroppedInNavigator: false + } + + ItemLibraryEntry { + name: "Only Form Editor" + category: "Test Plugin" + libraryIcon: ":/qtquickplugin/images/item-icon.png" + version: "1.0" + requiredImport: "test" + Property { + name: "width" + type: "int" + value: "100" + } + + Property { + name: "height" + type: "int" + value: "100" + } + } + } + + Type { + name: "test.ForceClip" + icon: ":/qtquickplugin/images/item-icon16.png" + + Hints { + forceClip: true + } + + ItemLibraryEntry { + name: "Force Clip" + category: "Test Plugin" + libraryIcon: ":/qtquickplugin/images/item-icon.png" + version: "1.0" + requiredImport: "test" + Property { + name: "width" + type: "int" + value: "100" + } + + Property { + name: "height" + type: "int" + value: "100" + } + } + } + + +} diff --git a/tests/manual/qml/testprojects/metainfohints/imports/test/qmldir b/tests/manual/qml/testprojects/metainfohints/imports/test/qmldir new file mode 100644 index 00000000000..a13b61853a9 --- /dev/null +++ b/tests/manual/qml/testprojects/metainfohints/imports/test/qmldir @@ -0,0 +1,5 @@ +TestComponent 1.0 TestComponent.qml +TestLayout 1.0 TestLayout.qml +OnlyNavigator 1.0 OnlyNavigator.qml +OnlyFormEditor 1.0 OnlyFormEditor.qml +ForceClip 1.0 ForceClip.qml diff --git a/tests/manual/qml/testprojects/metainfohints/metainfohints.qml b/tests/manual/qml/testprojects/metainfohints/metainfohints.qml new file mode 100644 index 00000000000..ab0b7ce6ef7 --- /dev/null +++ b/tests/manual/qml/testprojects/metainfohints/metainfohints.qml @@ -0,0 +1,13 @@ +import QtQuick 2.8 +import QtQuick.Window 2.2 + +Window { + visible: true + width: 640 + height: 480 + title: qsTr("Hello World") + + MainForm { + anchors.fill: parent + } +} diff --git a/tests/manual/qml/testprojects/metainfohints/metainfohints.qmlproject b/tests/manual/qml/testprojects/metainfohints/metainfohints.qmlproject new file mode 100644 index 00000000000..4febc7b6468 --- /dev/null +++ b/tests/manual/qml/testprojects/metainfohints/metainfohints.qmlproject @@ -0,0 +1,18 @@ +import QmlProject 1.1 + +Project { + mainFile: "metainfohints.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + + importPaths: [ "imports" ] +} From ce9a05938859c9453bbb8bbc4efbbba1067c4b21 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 20 May 2019 11:25:28 +0200 Subject: [PATCH 05/20] QmlDesigner: Add missing else statement to color editor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QDS-685 Change-Id: Id941aaa19cb727e020ca1021a452aba32ba493ee Reviewed-by: Tim Jenssen Reviewed-by: Henning Gründl --- .../imports/HelperWidgets/ColorEditor.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml index ad35898b9bd..c039d984fb3 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml @@ -121,8 +121,9 @@ Column { default: buttonRow.initalChecked = 1 } + } else { + buttonRow.initalChecked = 1 } - colorEditor.color = gradientLine.currentColor } else { buttonRow.initalChecked = 0 From fc8dea883033b16527e183ae35d9a4392b98bfe1 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 3 Apr 2019 14:56:30 +0200 Subject: [PATCH 06/20] Squish: Remove unused workaround code We have not been using this for more than a year. Instead, we seem to prefer having workaround code inline. Change-Id: I37066f359eac5eda62c9c9acfcae3b89f980d024 Reviewed-by: Christian Stenger --- tests/system/shared/workarounds.py | 92 ++++++------------------------ 1 file changed, 16 insertions(+), 76 deletions(-) diff --git a/tests/system/shared/workarounds.py b/tests/system/shared/workarounds.py index a74fbb5981f..697625945f9 100644 --- a/tests/system/shared/workarounds.py +++ b/tests/system/shared/workarounds.py @@ -59,13 +59,6 @@ JIRA_URL='https://bugreports.qt.io/browse' class JIRA: __instance__ = None - # internal exception to be used inside workaround functions (lack of having return values) - class JiraException(Exception): - def __init__(self, value): - self.value = value - def __str__(self): - return repr(self.value) - # Helper class class Bug: CREATOR = 'QTCREATORBUG' @@ -93,45 +86,12 @@ class JIRA: def __setattr__(self, attr, value): return setattr(self.__instance__, attr, value) - # function to get an instance of the singleton - @staticmethod - def getInstance(): - if '_JIRA__instance__' in JIRA.__dict__: - return JIRA.__instance__ - else: - return JIRA.__impl(0, Bug.CREATOR) - # function to check if the given bug is open or not @staticmethod def isBugStillOpen(number, bugType=Bug.CREATOR): tmpJIRA = JIRA(number, bugType) return tmpJIRA.isOpen() - # function that performs the workaround (function) for the given bug - # if the function needs additional arguments pass them as 3rd parameter - @staticmethod - def performWorkaroundForBug(number, bugType=Bug.CREATOR, *args): - if not JIRA.isBugStillOpen(number, bugType): - test.warning("Bug %s-%d is closed for version %s." % - (bugType, number, JIRA(number, bugType)._fix), - "You should probably remove potential code inside workarounds.py") - functionToCall = JIRA.getInstance().__bugs__.get("%s-%d" % (bugType, number), None) - if functionToCall: - test.warning("Using workaround for %s-%d" % (bugType, number)) - try: - functionToCall(*args) - except: - t, v = sys.exc_info()[0:2] - if t == JIRA.JiraException: - raise JIRA.JiraException(v) - else: - test.warning("Exception caught while executing workaround function.", - "%s (%s)" % (str(t), str(v))) - return True - else: - JIRA.getInstance()._exitFatal_(bugType, number) - return False - # implementation of JIRA singleton class __impl: # constructor of __impl @@ -139,8 +99,6 @@ class JIRA: self._number = number self._bugType = bugType self._fix = None - self._localOnly = os.getenv("SYSTEST_JIRA_NO_LOOKUP")=="1" - self.__initBugDict__() self._fetchResults_ = {} self.__fetchResolutionFromJira__() @@ -169,30 +127,23 @@ class JIRA: return data = None proxy = os.getenv("SYSTEST_PROXY", None) - if not self._localOnly: - 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)) - data = bugReport.read() - except: - data = self.__tryExternalTools__(proxy) - if data == None: - test.warning("Sorry, ssl module missing - cannot fetch data via HTTPS", - "Try to install the ssl module by yourself, or set the python " - "path inside SQUISHDIR/etc/paths.ini to use a python version with " - "ssl support OR install wget or curl to get rid of this warning!") - self._localOnly = True + 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)) + data = bugReport.read() + except: + data = self.__tryExternalTools__(proxy) + if data == None: + test.warning("Sorry, ssl module missing - cannot fetch data via HTTPS", + "Try to install the ssl module by yourself, or set the python " + "path inside SQUISHDIR/etc/paths.ini to use a python version with " + "ssl support OR install wget or curl to get rid of this warning!") if data == None: - if bug in self.__bugs__: - test.warning("Using internal dict - bug status could have changed already", - "Please check manually!") - self._resolution = None - else: - test.fatal("No workaround function deposited for %s" % bug) - self._resolution = 'Done' + test.fatal("No resolution info for %s" % bug) + self._resolution = 'Done' else: data = data.replace("\r", "").replace("\n", "") resPattern = re.compile('(?P.*?)') @@ -249,14 +200,3 @@ class JIRA: "%s[...]" % fetched[:200]) else: test.log("Fetched and cropped data: [...]%s[...]" % fetched[resoInd-20:resoInd+100]) - - # this function initializes the bug dict for localOnly usage and - # for later lookup which function to call for which bug - # ALWAYS update this dict when adding a new function for a workaround! - def __initBugDict__(self): - self.__bugs__= {} - # helper function - will be called if no workaround for the requested bug is deposited - def _exitFatal_(self, bugType, number): - test.fatal("No workaround found for bug %s-%d" % (bugType, number)) - -############### functions that hold workarounds ################################# From 9956d8d4611775da223a1778295b568bb209a978 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 24 Apr 2019 18:42:25 +0200 Subject: [PATCH 07/20] Squish: Update tst_qtquick_creation Task-number: QTCREATORBUG-20056 Change-Id: I5a7e239b9c65b32e2bc57dd594cc96bdda94b472 Reviewed-by: Christian Stenger --- tests/system/shared/project.py | 17 ++++------------ .../tst_qtquick_creation/test.py | 20 +++++++------------ 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index 8a0d69b222f..a4be7f14d1f 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -273,23 +273,14 @@ def createProject_Qt_Console(path, projectName, checks = True, buildSystem = Non if checks: __verifyFileCreation__(path, expectedFiles) -def createNewQtQuickApplication(workingDir, projectName = None, +def createNewQtQuickApplication(workingDir, projectName=None, targets=Targets.desktopTargetClasses(), minimumQtVersion="5.6", - withControls = False, fromWelcome = False, buildSystem = None): - if withControls: - template = "Qt Quick Application - Swipe" - else: - template = "Qt Quick Application - Empty" + template="Qt Quick Application - Empty", fromWelcome=False, + buildSystem=None): available = __createProjectOrFileSelectType__(" Application", template, fromWelcome) projectName = __createProjectSetNameAndPath__(workingDir, projectName) __handleBuildSystem__(buildSystem) - if withControls: - requiredQt = "5.7" - # TODO use parameter to define style to choose - test.log("Using default controls style") - clickButton(waitForObject(":Next_QPushButton")) - else: - requiredQt = __createProjectHandleQtQuickSelection__(minimumQtVersion) + requiredQt = __createProjectHandleQtQuickSelection__(minimumQtVersion) __modifyAvailableTargets__(available, requiredQt) checkedTargets = __chooseTargets__(targets, available) snooze(1) diff --git a/tests/system/suite_qtquick/tst_qtquick_creation/test.py b/tests/system/suite_qtquick/tst_qtquick_creation/test.py index 704d6e233b9..d4bb4338961 100644 --- a/tests/system/suite_qtquick/tst_qtquick_creation/test.py +++ b/tests/system/suite_qtquick/tst_qtquick_creation/test.py @@ -30,26 +30,20 @@ def main(): if not startedWithoutPluginError(): return - available = [("5.6", False), ("5.6", True)] + available = [("5.6", "Qt Quick Application - Empty", Targets.DESKTOP_5_6_1_DEFAULT), + ("5.10", "Qt Quick Application - Swipe", Targets.DESKTOP_5_10_1_DEFAULT)] - for qtVersion, controls in available: - targ = Targets.DESKTOP_5_6_1_DEFAULT + for qtVersion, appTemplate, targ in available: # using a temporary directory won't mess up a potentially existing workingDir = tempDir() checkedTargets = createNewQtQuickApplication(workingDir, targets=[targ], minimumQtVersion=qtVersion, - withControls = controls)[0] + template=appTemplate)[0] if len(checkedTargets) == 0: - if controls and qtVersion < "5.7": - test.xfail("Could not check wanted target.", "Quick Controls 2 wizard needs Qt5.7+") - else: - test.fatal("Could not check wanted target") + test.fatal("Could not check wanted target") continue - additionalText = '' - if controls: - additionalText = ' Controls ' - test.log("Building project Qt Quick%sApplication (%s)" - % (additionalText, Targets.getStringForTarget(targ))) + test.log("Building project %s (%s)" + % (appTemplate, Targets.getStringForTarget(targ))) invokeMenuItem("Build", "Build All") waitForCompile() if not checkCompile(): From cb71f6ec5fc9225055184dc96f5e7dfc23314230 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 20 May 2019 11:34:58 +0200 Subject: [PATCH 08/20] QmlDesigner: Code clean up Change-Id: Ie396426df1060805fb39024fa6da6e758203099a Reviewed-by: Tim Jenssen --- src/plugins/qmldesigner/components/componentcore/crumblebar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp b/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp index ac2f07d50c1..112923c5f75 100644 --- a/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp +++ b/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp @@ -80,7 +80,7 @@ CrumbleBar::~CrumbleBar() void CrumbleBar::pushFile(const Utils::FileName &fileName) { - if (m_isInternalCalled == false) { + if (!m_isInternalCalled) { crumblePath()->clear(); } else { CrumbleBarInfo lastElementCrumbleBarInfo = crumblePath()->dataForLastIndex().value(); From bd2aa8ada387184b6ab1f995a54582ae60093c7d Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 21 May 2019 11:49:39 +0200 Subject: [PATCH 09/20] QmlDesigner: Fix issue with gradient editing The gradient only has to be deleted if we are in gradient editing mode. If we are not in gradient editing mode, we should not delete any gradient. This was creating issues when editing border.color. Task-number: QDS-675 Change-Id: Ie3fcbc4a817cb0062e895298d42794b7338084d6 Reviewed-by: Tim Jenssen --- .../imports/HelperWidgets/ColorEditor.qml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml index c039d984fb3..e39bd8e88df 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml @@ -103,7 +103,7 @@ Column { } onHasGradientChanged: { - if (!supportGradient) + if (!colorEditor.supportGradient) return if (gradientLine.hasGradient) { @@ -217,7 +217,9 @@ Column { iconSource: "images/icon_color_solid.png" onClicked: { - gradientLine.deleteGradient() + if (colorEditor.supportGradient) + gradientLine.deleteGradient() + textField.text = colorEditor.color colorEditor.backendValue.resetValue() } @@ -472,7 +474,8 @@ Column { iconSource: "images/icon_color_none.png" onClicked: { colorEditor.color = "#00000000" - gradientLine.deleteGradient() + if (colorEditor.supportGradient) + gradientLine.deleteGradient() } tooltip: qsTr("Transparent") } From a345fbb5b136fd91d6a58bffcdb314179613a819 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 21 May 2019 11:26:25 +0200 Subject: [PATCH 10/20] QmlDesigner: Improve readability of names in the easingcurve editor - Increased item size - Decreased font size - Changed text background color - Added tooltips - Elide text in the middle Task-number: QDS-394 Change-Id: Ia796bfb0fbf25bee3ad8d2dd7c697163607426a4 Reviewed-by: Tim Jenssen --- .../timelineeditor/preseteditor.cpp | 28 +++++++++++++++---- .../timelineeditor/preseteditor.h | 4 +++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/preseteditor.cpp b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/preseteditor.cpp index 203da8bacdb..4e6f9c9f170 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/preseteditor.cpp +++ b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/preseteditor.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -42,11 +41,12 @@ #include #include +#include namespace QmlDesigner { -constexpr int iconWidth = 64; -constexpr int iconHeight = 64; +constexpr int iconWidth = 86; +constexpr int iconHeight = 86; constexpr int itemFrame = 3; constexpr int itemWidth = iconWidth + 2 * itemFrame; constexpr int unsavedMarkSize = 18; @@ -77,15 +77,15 @@ void PresetItemDelegate::paint(QPainter *painter, auto textRect = QRect(option.rect.topLeft(), textSize); textRect.moveBottom(option.rect.bottom()); - QFontMetrics fm(option.font); - option.text = fm.elidedText(option.text, Qt::ElideRight, textRect.width()); + option.font.setPixelSize(Theme::instance()->smallFontPixelSize()); + painter->save(); painter->fillRect(option.rect, canvasBackground); if (option.text.isEmpty()) painter->fillRect(textRect, canvasBackground); else - painter->fillRect(textRect, labelBackground); + painter->fillRect(textRect, Theme::instance()->qmlDesignerButtonColor()); style->drawControl(QStyle::CE_ItemViewItem, &option, painter, option.widget); @@ -108,6 +108,7 @@ void PresetItemDelegate::paint(QPainter *painter, painter->drawText(asteriskRect, Qt::AlignTop | Qt::AlignRight, "*"); } } + painter->restore(); } QSize PresetItemDelegate::sizeHint(const QStyleOptionViewItem &opt, const QModelIndex &index) const @@ -185,6 +186,8 @@ PresetList::PresetList(QSettings::Scope scope, QWidget *parent) setWrapping(true); + setTextElideMode(Qt::ElideMiddle); + setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); } @@ -278,6 +281,7 @@ void PresetList::readPresets() auto *item = new QStandardItem(paintPreview(curves[i].curve()), curves[i].name()); item->setData(curveData, ItemRole_Data); item->setEditable(m_scope == QSettings::UserScope); + item->setToolTip(curves[i].name()); simodel->setItem(i, item); } @@ -318,6 +322,7 @@ void PresetList::revert(const QModelIndex &index) item->setData(false, ItemRole_Dirty); item->setData(paintPreview(curve.curve()), Qt::DecorationRole); item->setData(QVariant::fromValue(curve.curve()), ItemRole_Data); + item->setToolTip(name); return; } } @@ -357,6 +362,16 @@ void PresetList::contextMenuEvent(QContextMenuEvent *event) menu.exec(event->globalPos()); } +void PresetList::dataChanged(const QModelIndex &topLeft, + const QModelIndex &bottomRight, + const QVector &roles) +{ + if (topLeft == bottomRight && roles.contains(0)) { + const QVariant name = model()->data(topLeft, 0); + model()->setData(topLeft, name, Qt::ToolTipRole); + } +} + void PresetList::createItem() { EasingCurve curve; @@ -368,6 +383,7 @@ void PresetList::createItem(const QString &name, const EasingCurve &curve) { auto *item = new QStandardItem(paintPreview(curve), name); item->setData(QVariant::fromValue(curve), ItemRole_Data); + item->setToolTip(name); int row = model()->rowCount(); qobject_cast(model())->setItem(row, item); diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/preseteditor.h b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/preseteditor.h index e1907af99c6..6fab3e7adbb 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/preseteditor.h +++ b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/preseteditor.h @@ -99,6 +99,10 @@ public: protected: void contextMenuEvent(QContextMenuEvent *event) override; + void dataChanged(const QModelIndex &topLeft, + const QModelIndex &bottomRight, + const QVector &roles = QVector()) override; + private: QStringList allNames() const; From 7eb29b650553548c75218fafb9990d1d034aba32 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 21 May 2019 14:43:19 +0200 Subject: [PATCH 11/20] QmlDesigner: Fix regression This regression was caused by an optimization. I added updatePath() to avoid similar issues in the future. Task-number: QDS-690 Change-Id: I0c1c67a3d35a6944da494651db34c746561a1e26 Reviewed-by: Tim Jenssen --- .../itemlibrary/customfilesystemmodel.cpp | 71 ++++++++++--------- .../itemlibrary/customfilesystemmodel.h | 1 + 2 files changed, 39 insertions(+), 33 deletions(-) diff --git a/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.cpp b/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.cpp index 62f7f315ced..51dc03d94fe 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.cpp @@ -79,7 +79,7 @@ CustomFileSystemModel::CustomFileSystemModel(QObject *parent) : QAbstractListMod m_fileSystemModel->setIconProvider(new ItemLibraryFileIconProvider()); connect(m_fileSystemWatcher, &Utils::FileSystemWatcher::directoryChanged, [this] { - setRootPath(m_fileSystemModel->rootPath()); + updatePath(m_fileSystemModel->rootPath()); }); } @@ -120,38 +120,7 @@ QModelIndex CustomFileSystemModel::setRootPath(const QString &newPath) if (m_fileSystemModel->rootPath() == newPath) return QAbstractListModel::index(0, 0); - beginResetModel(); - m_fileSystemModel->setRootPath(newPath); - - m_fileSystemWatcher->removeDirectories(m_fileSystemWatcher->directories()); - - m_fileSystemWatcher->addDirectory(newPath, Utils::FileSystemWatcher::WatchAllChanges); - - QStringList nameFilterList; - - const QString searchFilter = m_searchFilter; - - if (searchFilter.contains(QLatin1Char('.'))) { - nameFilterList.append(QString(QStringLiteral("*%1*")).arg(searchFilter)); - } else { - foreach (const QByteArray &extension, QImageReader::supportedImageFormats()) { - nameFilterList.append(QString(QStringLiteral("*%1*.%2")).arg(searchFilter, QString::fromUtf8(extension))); - } - } - - m_files.clear(); - - QDirIterator fileIterator(newPath, nameFilterList, QDir::Files, QDirIterator::Subdirectories); - - while (fileIterator.hasNext()) - m_files.append(filterMetaIcons(fileIterator.next())); - - QDirIterator dirIterator(newPath, {}, QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); - while (dirIterator.hasNext()) - m_fileSystemWatcher->addDirectory(dirIterator.next(), Utils::FileSystemWatcher::WatchAllChanges); - - endResetModel(); - return QAbstractListModel::index(0, 0); + return updatePath(newPath); } QVariant CustomFileSystemModel::data(const QModelIndex &index, int role) const @@ -210,6 +179,42 @@ void CustomFileSystemModel::setSearchFilter(const QString &nameFilterList) setRootPath(m_fileSystemModel->rootPath()); } +QModelIndex CustomFileSystemModel::updatePath(const QString &newPath) +{ + beginResetModel(); + m_fileSystemModel->setRootPath(newPath); + + m_fileSystemWatcher->removeDirectories(m_fileSystemWatcher->directories()); + + m_fileSystemWatcher->addDirectory(newPath, Utils::FileSystemWatcher::WatchAllChanges); + + QStringList nameFilterList; + + const QString searchFilter = m_searchFilter; + + if (searchFilter.contains(QLatin1Char('.'))) { + nameFilterList.append(QString(QStringLiteral("*%1*")).arg(searchFilter)); + } else { + foreach (const QByteArray &extension, QImageReader::supportedImageFormats()) { + nameFilterList.append(QString(QStringLiteral("*%1*.%2")).arg(searchFilter, QString::fromUtf8(extension))); + } + } + + m_files.clear(); + + QDirIterator fileIterator(newPath, nameFilterList, QDir::Files, QDirIterator::Subdirectories); + + while (fileIterator.hasNext()) + m_files.append(filterMetaIcons(fileIterator.next())); + + QDirIterator dirIterator(newPath, {}, QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); + while (dirIterator.hasNext()) + m_fileSystemWatcher->addDirectory(dirIterator.next(), Utils::FileSystemWatcher::WatchAllChanges); + + endResetModel(); + return QAbstractListModel::index(0, 0); +} + QModelIndex CustomFileSystemModel::fileSystemModelIndex(const QModelIndex &index) const { const int row = index.row(); diff --git a/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.h b/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.h index 7ad76ace1c2..69a0e4b1317 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.h +++ b/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.h @@ -61,6 +61,7 @@ public: void setSearchFilter(const QString &nameFilterList); private: + QModelIndex updatePath(const QString &newPath); QModelIndex fileSystemModelIndex(const QModelIndex &index) const; QFileSystemModel *m_fileSystemModel; From 8aa227a7783b990e8dc4a5c9610eee4e8858a275 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 21 May 2019 15:22:36 +0200 Subject: [PATCH 12/20] QmlDesigner: Fix stupid bug in resource browser We were keeping skipped files as empty files. Task-number: QDS-227 Change-Id: I5d7fca348e29d1accf3db29661a9d274b5b0f998 Reviewed-by: Tim Jenssen --- .../itemlibrary/customfilesystemmodel.cpp | 16 +++++++++++----- .../itemlibrary/customfilesystemmodel.h | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.cpp b/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.cpp index 51dc03d94fe..c09854b29a9 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.cpp @@ -88,7 +88,7 @@ void CustomFileSystemModel::setFilter(QDir::Filters) } -QString filterMetaIcons(const QString &fileName) +bool filterMetaIcons(const QString &fileName) { QFileInfo info(fileName); @@ -101,7 +101,7 @@ QString filterMetaIcons(const QString &fileName) while (!currentDir.isRoot() && i < 3) { if (currentDir.dirName() == "designer") { if (!currentDir.entryList({"*.metainfo"}).isEmpty()) - return {}; + return false; } currentDir.cdUp(); @@ -109,10 +109,10 @@ QString filterMetaIcons(const QString &fileName) } if (info.dir().dirName() == "designer") - return {}; + return false; } - return fileName; + return true; } QModelIndex CustomFileSystemModel::setRootPath(const QString &newPath) @@ -179,6 +179,12 @@ void CustomFileSystemModel::setSearchFilter(const QString &nameFilterList) setRootPath(m_fileSystemModel->rootPath()); } +void CustomFileSystemModel::appendIfNotFiltered(const QString &file) +{ + if (filterMetaIcons(file)) + m_files.append(file); +} + QModelIndex CustomFileSystemModel::updatePath(const QString &newPath) { beginResetModel(); @@ -205,7 +211,7 @@ QModelIndex CustomFileSystemModel::updatePath(const QString &newPath) QDirIterator fileIterator(newPath, nameFilterList, QDir::Files, QDirIterator::Subdirectories); while (fileIterator.hasNext()) - m_files.append(filterMetaIcons(fileIterator.next())); + appendIfNotFiltered(fileIterator.next()); QDirIterator dirIterator(newPath, {}, QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); while (dirIterator.hasNext()) diff --git a/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.h b/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.h index 69a0e4b1317..e0d8148ce65 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.h +++ b/src/plugins/qmldesigner/components/itemlibrary/customfilesystemmodel.h @@ -63,6 +63,7 @@ public: private: QModelIndex updatePath(const QString &newPath); QModelIndex fileSystemModelIndex(const QModelIndex &index) const; + void appendIfNotFiltered(const QString &file); QFileSystemModel *m_fileSystemModel; QStringList m_files; From fd24586421d837ec16fb4511ce5f1fe299734d12 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 22 May 2019 10:23:34 +0200 Subject: [PATCH 13/20] QmlDesigner: Properly reset line edits if an error occurs Task-number: QDS-707 Change-Id: Ic70c4296afd8bd6b590242fea129624af2fee7a6 Reviewed-by: Tim Jenssen --- .../timelineeditor/timelineanimationform.cpp | 11 ++++++++++- .../timelineeditor/timelineform.cpp | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineanimationform.cpp b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineanimationform.cpp index 4fc04b57592..65f77a0e5fb 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineanimationform.cpp +++ b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineanimationform.cpp @@ -85,14 +85,23 @@ TimelineAnimationForm::TimelineAnimationForm(QWidget *parent) if (newId == animation().id()) return; - if (!animation().isValidId(newId)) { + bool error = false; + + if (!ModelNode::isValidId(newId)) { Core::AsynchronousMessageBox::warning(tr("Invalid Id"), tr("%1 is an invalid id.").arg(newId)); + error = true; } else if (animation().view()->hasId(newId)) { Core::AsynchronousMessageBox::warning(tr("Invalid Id"), tr("%1 already exists.").arg(newId)); } else { animation().setIdWithRefactoring(newId); + error = true; + } + + if (error) { + lastString.clear(); + ui->idLineEdit->setText(animation().id()); } }); diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineform.cpp b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineform.cpp index 3c1c3950ddc..eb63ad48838 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineform.cpp +++ b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineform.cpp @@ -98,15 +98,24 @@ TimelineForm::TimelineForm(QWidget *parent) if (newId == m_timeline.modelNode().id()) return; - if (!m_timeline.modelNode().isValidId(newId)) { + bool error = false; + + if (!ModelNode::isValidId(newId)) { Core::AsynchronousMessageBox::warning(tr("Invalid Id"), tr("%1 is an invalid id.").arg(newId)); + error = true; } else if (m_timeline.view()->hasId(newId)) { Core::AsynchronousMessageBox::warning(tr("Invalid Id"), tr("%1 already exists.").arg(newId)); + error = true; } else { m_timeline.modelNode().setIdWithRefactoring(newId); } + + if (error) { + lastString.clear(); + ui->idLineEdit->setText(m_timeline.modelNode().id()); + } }); connectSpinBox(ui->startFrame, "startFrame"); From 0131439288fa4210a73af4489ab23704a57ca346 Mon Sep 17 00:00:00 2001 From: Aaron Barany Date: Thu, 16 May 2019 21:36:46 -0700 Subject: [PATCH 14/20] CMake: don't disable widgets on configuration error If the configuration failure was caused by an incorrect option, you want to be able to fully use the UI to fix the issue. Change-Id: I3048b1f6e0b4d88e90433df9a36ca18fa72c03c6 Reviewed-by: Tobias Hunger --- .../cmakeprojectmanager/cmakebuildsettingswidget.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsettingswidget.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsettingswidget.cpp index 3ee12eeb3bd..192d3b0af51 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsettingswidget.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsettingswidget.cpp @@ -349,12 +349,6 @@ void CMakeBuildSettingsWidget::setError(const QString &message) m_errorMessageLabel->setVisible(showError); m_errorMessageLabel->setText(message); m_errorMessageLabel->setToolTip(message); - - m_editButton->setEnabled(!showError); - m_unsetButton->setEnabled(!showError); - m_resetButton->setEnabled(!showError); - m_showAdvancedCheckBox->setEnabled(!showError); - m_filterEdit->setEnabled(!showError); } void CMakeBuildSettingsWidget::setWarning(const QString &message) From 36b7071c702b2ede9cf2a1ab82ddc0128c883f86 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Mon, 20 May 2019 18:23:21 +0200 Subject: [PATCH 15/20] Squish: Update comments Change-Id: I10dc06b257ae82e454a47d21086b481f8bca7654 Reviewed-by: Christian Stenger --- tests/system/suite_CSUP/tst_CSUP04/test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/suite_CSUP/tst_CSUP04/test.py b/tests/system/suite_CSUP/tst_CSUP04/test.py index 6fc59a3caad..196d25bc1d8 100644 --- a/tests/system/suite_CSUP/tst_CSUP04/test.py +++ b/tests/system/suite_CSUP/tst_CSUP04/test.py @@ -53,9 +53,9 @@ def main(): return test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "Verifying if: .cpp file is opened in Edit mode.") - # place cursor on line "QmlApplicationViewer viewer;" editorWidget = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") - # invoke find usages from context menu on word "viewer" + # place cursor on line "class TriangleWindow : public OpenGLWindow" + # invoke find usages from context menu on word "OpenGLWindow" if not invokeFindUsage(editorWidget, "class TriangleWindow : public OpenGLWindow", ""): invokeMenuItem("File", "Exit") From 11d6f9ff7f48bedaddc509b1b4cda008e60eb1d6 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 23 May 2019 19:16:46 +0200 Subject: [PATCH 16/20] Update qbs submodule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To HEAD of 1.13 branch. Change-Id: I111966cef702d28d75a50180f13c034c68a6135c Reviewed-by: Jörg Bornemann --- src/shared/qbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/qbs b/src/shared/qbs index 1301eb87fd4..8cd4b8cec7f 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit 1301eb87fd40d200310365f7553ab4b901a855d8 +Subproject commit 8cd4b8cec7ffda0b19b01129e96eda8d2fb75ec0 From a7df03810639bc6fdf571188e582abfa17dd8d5c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 24 May 2019 15:19:19 +0200 Subject: [PATCH 17/20] Add more change log for 4.9.1 Change-Id: I5471bc8ae879f200b785d7c67022250103f5fa01 Reviewed-by: Leena Miettinen --- dist/changes-4.9.1.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dist/changes-4.9.1.md b/dist/changes-4.9.1.md index 5e49b1f8bb6..d65b63460b8 100644 --- a/dist/changes-4.9.1.md +++ b/dist/changes-4.9.1.md @@ -14,10 +14,18 @@ Editing QMake Projects * Fixed unnecessary reparsing on file save (QTCREATORBUG-22361) +* Fixed code model for generated files when specified in `.pri` file + (QTCREATORBUG-22395) CMake Projects * Fixed deployment with `QtCreatorDeployment.txt` (QTCREATORBUG-22184) +* Fixed that configuration UI was disabled after configuration error + +Qbs Projects + +* Fixed crash when editing environment variables (QTCREATORBUG-22386) +* Fixed handling of `cpp.minimum*Version` (QTCREATORBUG-22355) Debugging From 168e91b618f7041409b587138ec313bb35c17b3c Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 24 May 2019 16:13:43 +0200 Subject: [PATCH 18/20] QmlDesigner: Fix issue with list properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On pure QML types list properties were reported as list properties. Task-number: QDS-687 Change-Id: I34b1688953185b65d64c299c72c8170d7daa789b Reviewed-by: Henning Gründl Reviewed-by: Tim Jenssen --- .../qmldesigner/designercore/metainfo/nodemetainfo.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index 821841e2187..9c88cd130a6 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -870,6 +870,12 @@ bool NodeMetaInfoPrivate::isPropertyList(const PropertyName &propertyName) const const CppComponentValue *qmlObjectValue = getNearestCppComponentValue(); if (!qmlObjectValue) return false; + + if (!qmlObjectValue->hasProperty(QString::fromUtf8(propertyName))) { + const TypeName typeName = propertyType(propertyName); + return (typeName == "Item" || typeName == "QtObject"); + } + return qmlObjectValue->isListProperty(QString::fromUtf8(propertyName)); } From 2001e96f018b3683ec9ed7aefe92fe6853d60305 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 27 May 2019 09:39:35 +0200 Subject: [PATCH 19/20] Update 4.9.1 changes file Change-Id: I5f6ea48265de11088e5028f38430c3bac373babd Reviewed-by: Eike Ziller --- dist/changes-4.9.1.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/changes-4.9.1.md b/dist/changes-4.9.1.md index d65b63460b8..3d1be12bc05 100644 --- a/dist/changes-4.9.1.md +++ b/dist/changes-4.9.1.md @@ -56,6 +56,7 @@ Remote Linux (QTCREATORBUG-22352) Credits for these changes go to: +Aaron Barany André Pönitz BogDan Vatra Christian Kandeler @@ -67,6 +68,7 @@ Jonathan Liu Leena Miettinen Mitch Curtis Nikolai Kosjar +Orgad Shaneh Robert Löhning Thomas Hartmann Ulf Hermann From aff3e204c1608e073d02598fe9b387f4419b72cd Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 27 May 2019 17:36:54 +0200 Subject: [PATCH 20/20] QmlDesigner: Add try catch blocks for anchoring There have been casual unreproducible crashes. This kind of code should be replaced by using lambdas in master. Change-Id: I5b44a4c7b013f70a012c22ff9610e5579b165ab4 Reviewed-by: Alessandro Portale --- .../propertyeditor/qmlanchorbindingproxy.cpp | 436 ++++++++++++------ 1 file changed, 290 insertions(+), 146 deletions(-) diff --git a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp index 34863477f0b..bc6b4376b66 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp @@ -24,7 +24,9 @@ ****************************************************************************/ #include "qmlanchorbindingproxy.h" -#include "abstractview.h" + +#include +#include #include #include #include @@ -359,14 +361,20 @@ void QmlAnchorBindingProxy::setTopTarget(const QString &target) if (!newTarget.isValid()) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setTopTarget")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setTopTarget")); - m_topTarget = newTarget; + m_topTarget = newTarget; - setDefaultRelativeTopTarget(); + setDefaultRelativeTopTarget(); - anchorTop(); + anchorTop(); + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } emit topTargetChanged(); } @@ -385,12 +393,18 @@ void QmlAnchorBindingProxy::setBottomTarget(const QString &target) if (!newTarget.isValid()) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setBottomTarget")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setBottomTarget")); - m_bottomTarget = newTarget; - setDefaultRelativeBottomTarget(); - anchorBottom(); + m_bottomTarget = newTarget; + setDefaultRelativeBottomTarget(); + anchorBottom(); + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } emit bottomTargetChanged(); } @@ -408,12 +422,18 @@ void QmlAnchorBindingProxy::setLeftTarget(const QString &target) if (!newTarget.isValid()) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setLeftTarget")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setLeftTarget")); - m_leftTarget = newTarget; - setDefaultRelativeLeftTarget(); - anchorLeft(); + m_leftTarget = newTarget; + setDefaultRelativeLeftTarget(); + anchorLeft(); + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } emit leftTargetChanged(); } @@ -431,12 +451,18 @@ void QmlAnchorBindingProxy::setRightTarget(const QString &target) if (!newTarget.isValid()) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setRightTarget")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setRightTarget")); - m_rightTarget = newTarget; - setDefaultRelativeRightTarget(); - anchorRight(); + m_rightTarget = newTarget; + setDefaultRelativeRightTarget(); + anchorRight(); + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } emit rightTargetChanged(); } @@ -454,11 +480,17 @@ void QmlAnchorBindingProxy::setVerticalTarget(const QString &target) if (!newTarget.isValid()) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalTarget")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalTarget")); - m_verticalTarget = newTarget; - anchorVertical(); + m_verticalTarget = newTarget; + anchorVertical(); + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } emit verticalTargetChanged(); } @@ -476,11 +508,17 @@ void QmlAnchorBindingProxy::setHorizontalTarget(const QString &target) if (!newTarget.isValid()) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalTarget")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalTarget")); - m_horizontalTarget = newTarget; - anchorHorizontal(); + m_horizontalTarget = newTarget; + anchorHorizontal();\ + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } emit horizontalTargetChanged(); } @@ -493,12 +531,18 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetTop(QmlAnchorBindingProxy::Re if (target == m_relativeTopTarget) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetTop")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetTop")); - m_relativeTopTarget = target; + m_relativeTopTarget = target; - anchorTop(); + anchorTop(); + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } emit relativeAnchorTargetTopChanged(); } @@ -511,12 +555,19 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetBottom(QmlAnchorBindingProxy: if (target == m_relativeBottomTarget) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetBottom")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetBottom")); - m_relativeBottomTarget = target; + m_relativeBottomTarget = target; - anchorBottom(); + + anchorBottom(); + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } emit relativeAnchorTargetBottomChanged(); } @@ -529,12 +580,18 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetLeft(QmlAnchorBindingProxy::R if (target == m_relativeLeftTarget) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetLeft")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetLeft")); - m_relativeLeftTarget = target; + m_relativeLeftTarget = target; - anchorLeft(); + anchorLeft(); + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } emit relativeAnchorTargetLeftChanged(); } @@ -547,12 +604,18 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetRight(QmlAnchorBindingProxy:: if (target == m_relativeRightTarget) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetRight")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetRight")); - m_relativeRightTarget = target; + m_relativeRightTarget = target; - anchorRight(); + anchorRight(); + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } emit relativeAnchorTargetRightChanged(); @@ -566,12 +629,18 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetVertical(QmlAnchorBindingProx if (target == m_relativeVerticalTarget) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetVertical")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetVertical")); - m_relativeVerticalTarget = target; + m_relativeVerticalTarget = target; - anchorVertical(); + anchorVertical(); + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } emit relativeAnchorTargetVerticalChanged(); } @@ -584,12 +653,18 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetHorizontal(QmlAnchorBindingPr if (target == m_relativeHorizontalTarget) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetHorizontal")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetHorizontal")); - m_relativeHorizontalTarget = target; + m_relativeHorizontalTarget = target; - anchorHorizontal(); + anchorHorizontal(); + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } emit relativeAnchorTargetHorizontalChanged(); } @@ -635,8 +710,10 @@ int QmlAnchorBindingProxy::indexOfPossibleTargetItem(const QString &targetName) } void QmlAnchorBindingProxy::resetLayout() { - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::resetLayout")); + + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::resetLayout")); m_qmlItemNode.anchors().removeAnchors(); m_qmlItemNode.anchors().removeMargins(); @@ -646,6 +723,11 @@ void QmlAnchorBindingProxy::resetLayout() { restoreProperty(modelNode(), "width"); restoreProperty(modelNode(), "height"); + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } + emit topAnchorChanged(); emit bottomAnchorChanged(); emit leftAnchorChanged(); @@ -661,16 +743,22 @@ void QmlAnchorBindingProxy::setBottomAnchor(bool anchor) if (bottomAnchored() == anchor) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setBottomAnchor")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setBottomAnchor")); - if (!anchor) { - removeBottomAnchor(); - } else { - setDefaultRelativeBottomTarget(); - anchorBottom(); - if (topAnchored()) - backupPropertyAndRemove(modelNode(), "height"); + if (!anchor) { + removeBottomAnchor(); + } else { + setDefaultRelativeBottomTarget(); + anchorBottom(); + if (topAnchored()) + backupPropertyAndRemove(modelNode(), "height"); + } + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); } emit relativeAnchorTargetBottomChanged(); @@ -688,18 +776,24 @@ void QmlAnchorBindingProxy::setLeftAnchor(bool anchor) if (leftAnchored() == anchor) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setLeftAnchor")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setLeftAnchor")); - if (!anchor) { - removeLeftAnchor(); - } else { - setDefaultRelativeLeftTarget(); + if (!anchor) { + removeLeftAnchor(); + } else { + setDefaultRelativeLeftTarget(); - anchorLeft(); - backupPropertyAndRemove(modelNode(), "x"); - if (rightAnchored()) - backupPropertyAndRemove(modelNode(), "width"); + anchorLeft(); + backupPropertyAndRemove(modelNode(), "x"); + if (rightAnchored()) + backupPropertyAndRemove(modelNode(), "width"); + } + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); } emit relativeAnchorTargetLeftChanged(); @@ -716,17 +810,23 @@ void QmlAnchorBindingProxy::setRightAnchor(bool anchor) if (rightAnchored() == anchor) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setRightAnchor")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setRightAnchor")); - if (!anchor) { - removeRightAnchor(); - } else { - setDefaultRelativeRightTarget(); + if (!anchor) { + removeRightAnchor(); + } else { + setDefaultRelativeRightTarget(); - anchorRight(); - if (leftAnchored()) - backupPropertyAndRemove(modelNode(), "width"); + anchorRight(); + if (leftAnchored()) + backupPropertyAndRemove(modelNode(), "width"); + } + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); } emit relativeAnchorTargetRightChanged(); @@ -926,18 +1026,23 @@ void QmlAnchorBindingProxy::setTopAnchor(bool anchor) if (topAnchored() == anchor) return; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setTopAnchor")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setTopAnchor")); - if (!anchor) { - removeTopAnchor(); - } else { - setDefaultRelativeTopTarget(); + if (!anchor) { + removeTopAnchor(); + } else { + setDefaultRelativeTopTarget(); - anchorTop(); - backupPropertyAndRemove(modelNode(), "y"); - if (bottomAnchored()) - backupPropertyAndRemove(modelNode(), "height"); + anchorTop(); + backupPropertyAndRemove(modelNode(), "y"); + if (bottomAnchored()) + backupPropertyAndRemove(modelNode(), "height"); + } + transaction.commit(); + } catch (const Exception &e) { + e.showException(); } emit relativeAnchorTargetTopChanged(); @@ -947,47 +1052,70 @@ void QmlAnchorBindingProxy::setTopAnchor(bool anchor) } void QmlAnchorBindingProxy::removeTopAnchor() { - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::removeTopAnchor")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::removeTopAnchor")); - m_qmlItemNode.anchors().removeAnchor(AnchorLineTop); - m_qmlItemNode.anchors().removeMargin(AnchorLineTop); + m_qmlItemNode.anchors().removeAnchor(AnchorLineTop); + m_qmlItemNode.anchors().removeMargin(AnchorLineTop); - restoreProperty(modelNode(), "y"); - restoreProperty(modelNode(), "height"); + restoreProperty(modelNode(), "y"); + restoreProperty(modelNode(), "height"); + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } } void QmlAnchorBindingProxy::removeBottomAnchor() { - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::removeBottomAnchor")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::removeBottomAnchor")); - m_qmlItemNode.anchors().removeAnchor(AnchorLineBottom); - m_qmlItemNode.anchors().removeMargin(AnchorLineBottom); + m_qmlItemNode.anchors().removeAnchor(AnchorLineBottom); + m_qmlItemNode.anchors().removeMargin(AnchorLineBottom); - restoreProperty(modelNode(), "height"); + restoreProperty(modelNode(), "height"); + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } } void QmlAnchorBindingProxy::removeLeftAnchor() { - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::removeLeftAnchor")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::removeLeftAnchor")); - m_qmlItemNode.anchors().removeAnchor(AnchorLineLeft); - m_qmlItemNode.anchors().removeMargin(AnchorLineLeft); + m_qmlItemNode.anchors().removeAnchor(AnchorLineLeft); + m_qmlItemNode.anchors().removeMargin(AnchorLineLeft); - restoreProperty(modelNode(), "x"); - restoreProperty(modelNode(), "width"); + restoreProperty(modelNode(), "x"); + restoreProperty(modelNode(), "width"); + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } } void QmlAnchorBindingProxy::removeRightAnchor() { - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::removeRightAnchor")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::removeRightAnchor")); - m_qmlItemNode.anchors().removeAnchor(AnchorLineRight); - m_qmlItemNode.anchors().removeMargin(AnchorLineRight); + m_qmlItemNode.anchors().removeAnchor(AnchorLineRight); + m_qmlItemNode.anchors().removeMargin(AnchorLineRight); - restoreProperty(modelNode(), "width"); + restoreProperty(modelNode(), "width"); + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } } void QmlAnchorBindingProxy::setVerticalCentered(bool centered) @@ -1000,18 +1128,23 @@ void QmlAnchorBindingProxy::setVerticalCentered(bool centered) m_locked = true; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalCentered")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalCentered")); - if (!centered) { - m_qmlItemNode.anchors().removeAnchor(AnchorLineVerticalCenter); - m_qmlItemNode.anchors().removeMargin(AnchorLineVerticalCenter); - } else { - m_relativeVerticalTarget = Center; + if (!centered) { + m_qmlItemNode.anchors().removeAnchor(AnchorLineVerticalCenter); + m_qmlItemNode.anchors().removeMargin(AnchorLineVerticalCenter); + } else { + m_relativeVerticalTarget = Center; - anchorVertical(); + anchorVertical(); + } + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); } - m_locked = false; emit relativeAnchorTargetVerticalChanged(); @@ -1028,18 +1161,23 @@ void QmlAnchorBindingProxy::setHorizontalCentered(bool centered) m_locked = true; - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalCentered")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalCentered")); - if (!centered) { - m_qmlItemNode.anchors().removeAnchor(AnchorLineHorizontalCenter); - m_qmlItemNode.anchors().removeMargin(AnchorLineHorizontalCenter); - } else { - m_relativeHorizontalTarget = Center; + if (!centered) { + m_qmlItemNode.anchors().removeAnchor(AnchorLineHorizontalCenter); + m_qmlItemNode.anchors().removeMargin(AnchorLineHorizontalCenter); + } else { + m_relativeHorizontalTarget = Center; - anchorHorizontal(); + anchorHorizontal(); + } + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); } - m_locked = false; emit relativeAnchorTargetHorizontalChanged(); @@ -1119,24 +1257,30 @@ bool QmlAnchorBindingProxy::horizontalCentered() void QmlAnchorBindingProxy::fill() { - RewriterTransaction transaction = beginRewriterTransaction( - QByteArrayLiteral("QmlAnchorBindingProxy::fill")); + try { + RewriterTransaction transaction = beginRewriterTransaction( + QByteArrayLiteral("QmlAnchorBindingProxy::fill")); - backupPropertyAndRemove(modelNode(), "x"); - backupPropertyAndRemove(modelNode(), "y"); - backupPropertyAndRemove(modelNode(), "width"); - backupPropertyAndRemove(modelNode(), "height"); + backupPropertyAndRemove(modelNode(), "x"); + backupPropertyAndRemove(modelNode(), "y"); + backupPropertyAndRemove(modelNode(), "width"); + backupPropertyAndRemove(modelNode(), "height"); - m_qmlItemNode.anchors().fill(); + m_qmlItemNode.anchors().fill(); - setHorizontalCentered(false); - setVerticalCentered(false); + setHorizontalCentered(false); + setVerticalCentered(false); - m_qmlItemNode.anchors().removeMargin(AnchorLineRight); - m_qmlItemNode.anchors().removeMargin(AnchorLineLeft); - m_qmlItemNode.anchors().removeMargin(AnchorLineTop); - m_qmlItemNode.anchors().removeMargin(AnchorLineBottom); + m_qmlItemNode.anchors().removeMargin(AnchorLineRight); + m_qmlItemNode.anchors().removeMargin(AnchorLineLeft); + m_qmlItemNode.anchors().removeMargin(AnchorLineTop); + m_qmlItemNode.anchors().removeMargin(AnchorLineBottom); + + transaction.commit(); + } catch (const Exception &e) { + e.showException(); + } emit topAnchorChanged(); emit bottomAnchorChanged();