diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientDialogPopup.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientDialogPopup.qml index bbfc5525c7f..a3e886f6b57 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientDialogPopup.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientDialogPopup.qml @@ -25,9 +25,9 @@ import QtQuick 2.1 import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.0 as Controls +import StudioControls 1.0 as StudioControls +import StudioTheme 1.0 as StudioTheme import QtQuickDesignerTheme 1.0 -import QtQuick.Controls.Styles 1.1 Loader { id: gradientDialogLoader @@ -93,33 +93,12 @@ Loader { text: qsTr("Gradient Properties") } - Button { + StudioControls.AbstractButton { width: 16 height: 16 - style: ButtonStyle { - background: Item { - Image { - width: 16 - height: 16 - source: "image://icons/error" - opacity: { - if (control.pressed) - return 0.8 - return 1.0 - } - Rectangle { - z: -1 - anchors.fill: parent - color: control.pressed - || control.hovered ? Theme.qmlDesignerBackgroundColorDarker() : Theme.qmlDesignerButtonColor() - border.color: Theme.qmlDesignerBorderColor() - radius: 2 - } - } - } - } + buttonIcon: StudioTheme.Constants.closeCross onClicked: gradientDialogLoader.visible = false - + backgroundRadius: 2 anchors.right: parent.right anchors.top: parent.top anchors.margins: 4 diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPopupIndicator.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPopupIndicator.qml index f39486c78fa..1f617e44377 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPopupIndicator.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPopupIndicator.qml @@ -25,7 +25,6 @@ import QtQuick 2.1 import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.0 as Controls Image { id: root diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginControl.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginControl.qml index dab46aa0ce1..da2f2cac88d 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginControl.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginControl.qml @@ -25,6 +25,7 @@ import QtQuick 2.1 import QtQuickDesignerTheme 1.0 +import StudioTheme 1.0 as StudioTheme Item { width: grid.width @@ -41,10 +42,19 @@ Item { readonly property color selectedColor: Theme.qmlDesignerBackgroundColorDarkAlternate() readonly property color unselectedColor: Theme.qmlDesignerBackgroundColorDarker() - ExtendedFunctionButton { + ExtendedFunctionLogic { + id: extFuncLogic backendValue: originControl.backendValue - visible: originControl.enabled + } + + ActionIndicator { anchors.left: grid.right + anchors.leftMargin: grid.spacing + + visible: originControl.enabled + icon.color: extFuncLogic.color + icon.text: extFuncLogic.glyph + onClicked: extFuncLogic.show() } ColorLogic { @@ -100,8 +110,8 @@ Item { Rectangle { property bool selected: false id: topLeft - width: 15 - height: 15 + width: StudioTheme.Values.height + height: StudioTheme.Values.height color: selected ? selectedColor : unselectedColor border.width: selected ? 2 : 1 border.color: selected ? originControl.borderColorSelected : originControl.borderColor diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/AbstractButton.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/AbstractButton.qml index 4dec58d4b6c..222334f7cae 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/AbstractButton.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/AbstractButton.qml @@ -33,6 +33,7 @@ T.AbstractButton { property alias buttonIcon: buttonIcon.text property alias iconColor: buttonIcon.color property alias backgroundVisible: buttonBackground.visible + property alias backgroundRadius: buttonBackground.radius implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml index 6e4f44ae73e..e261ebed677 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml @@ -60,7 +60,8 @@ Rectangle { State { name: "hovered" when: actionIndicator.hover && !actionIndicator.pressed - && !myControl.edit && !myControl.drag && myControl.enabled + && (!myControl || (!myControl.edit && !myControl.drag)) + && actionIndicator.enabled PropertyChanges { target: actionIndicatorIcon scale: 1.2 @@ -68,7 +69,7 @@ Rectangle { }, State { name: "disabled" - when: !myControl.enabled + when: !actionIndicator.enabled PropertyChanges { target: actionIndicatorIcon color: StudioTheme.Values.themeTextColorDisabled diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ContextMenu.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ContextMenu.qml index 8589d8129f0..9d7685534a9 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ContextMenu.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ContextMenu.qml @@ -24,20 +24,19 @@ ****************************************************************************/ import QtQuick 2.12 -import QtQuick.Controls 2.12 as Controls2 Menu { id: contextMenu property Item myTextEdit - Controls2.MenuItem { + MenuItem { text: "Undo" enabled: myTextEdit.canUndo onTriggered: myTextEdit.undo() /* shortcut: StandardKey.Undo Shortcuts in QQC2 seem to override global shortcuts */ } - Controls2.MenuItem { + MenuItem { text: "Redo" enabled: myTextEdit.canRedo onTriggered: myTextEdit.redo() @@ -47,32 +46,32 @@ Menu { MenuSeparator { } - Controls2.MenuItem { + MenuItem { text: "Copy" enabled: myTextEdit.selectedText !== "" onTriggered: myTextEdit.copy() /* shortcut: StandardKey.Copy Shortcuts in QQC2 seem to override global shortcuts */ } - Controls2.MenuItem { + MenuItem { text: "Cut" enabled: myTextEdit.selectedText !== "" && !myTextEdit.readOnly onTriggered: myTextEdit.cut() /* shortcut: StandardKey.Cut Shortcuts in QQC2 seem to override global shortcuts */ } - Controls2.MenuItem { + MenuItem { text: "Paste" enabled: myTextEdit.canPaste onTriggered: myTextEdit.paste() /* shortcut: StandardKey.Paste Shortcuts in QQC2 seem to override global shortcuts */ } - Controls2.MenuItem { + MenuItem { text: "Delete" enabled: myTextEdit.selectedText !== "" onTriggered: myTextEdit.remove(myTextEdit.selectionStart, myTextEdit.selectionEnd) /* shortcut: StandardKey.Delete Shortcuts in QQC2 seem to override global shortcuts */ } - Controls2.MenuItem { + MenuItem { text: "Clear" enabled: myTextEdit.text !== "" onTriggered: myTextEdit.clear() @@ -82,7 +81,7 @@ Menu { MenuSeparator { } - Controls2.MenuItem { + MenuItem { text: "Select All" enabled: myTextEdit.text !== "" && myTextEdit.selectedText !== myTextEdit.text diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuItem.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuItem.qml index ff3c1396794..023f9b0f5dc 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuItem.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuItem.qml @@ -46,11 +46,6 @@ T.MenuItem { action: Action {} contentItem: Item { - id: menuItem - - width: control.menu.width - height: StudioTheme.Values.height - Text { id: textLabel text: control.text @@ -77,11 +72,11 @@ T.MenuItem { background: Rectangle { implicitWidth: textLabel.implicitWidth + control.labelSpacing + shortcutLabel.implicitWidth - + control.leftPadding + control.rightPadding // TODO + + control.leftPadding + control.rightPadding implicitHeight: StudioTheme.Values.height x: StudioTheme.Values.border y: StudioTheme.Values.border - width: control.width - (StudioTheme.Values.border * 2) + width: control.menu.width - (StudioTheme.Values.border * 2) height: control.height - (StudioTheme.Values.border * 2) color: control.down ? control.palette.midlight : control.highlighted ? StudioTheme.Values.themeInteraction : "transparent" } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuSeparator.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuSeparator.qml index 4e226f5c584..a2f2f57e946 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuSeparator.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuSeparator.qml @@ -36,11 +36,10 @@ T.MenuSeparator { implicitContentHeight + topPadding + bottomPadding) padding: 0 - verticalPadding: padding contentItem: Rectangle { - implicitWidth: 10 - implicitHeight: StudioTheme.Values.border + width: control.parent.width + height: StudioTheme.Values.border color: StudioTheme.Values.themeControlOutline } } diff --git a/src/plugins/autotest/autotestunittests.cpp b/src/plugins/autotest/autotestunittests.cpp index 614a61a6c27..b571ed13546 100644 --- a/src/plugins/autotest/autotestunittests.cpp +++ b/src/plugins/autotest/autotestunittests.cpp @@ -131,13 +131,13 @@ void AutoTestUnitTests::testCodeParser_data() << 1 << 0 << 0 << 0; QTest::newRow("mixedAutoTestAndQuickTests") << QString(m_tmpDir->path() + "/mixed_atp/mixed_atp.pro") - << 4 << 7 << 3 << 10; + << 4 << 10 << 4 << 10; QTest::newRow("plainAutoTestQbs") << QString(m_tmpDir->path() + "/plain/plain.qbs") << 1 << 0 << 0 << 0; QTest::newRow("mixedAutoTestAndQuickTestsQbs") << QString(m_tmpDir->path() + "/mixed_atp/mixed_atp.qbs") - << 4 << 7 << 3 << 10; + << 4 << 10 << 4 << 10; } void AutoTestUnitTests::testCodeParserSwitchStartup() @@ -183,8 +183,8 @@ void AutoTestUnitTests::testCodeParserSwitchStartup_data() m_tmpDir->path() + "/mixed_atp/mixed_atp.qbs"}); QList expectedAutoTests = QList() << 1 << 4 << 1 << 4; - QList expectedNamedQuickTests = QList() << 0 << 7 << 0 << 7; - QList expectedUnnamedQuickTests = QList() << 0 << 3 << 0 << 3; + QList expectedNamedQuickTests = QList() << 0 << 10 << 0 << 10; + QList expectedUnnamedQuickTests = QList() << 0 << 4 << 0 << 4; QList expectedDataTagsCount = QList() << 0 << 10 << 0 << 10; QTest::newRow("loadMultipleProjects") diff --git a/src/plugins/autotest/quick/quicktestparser.cpp b/src/plugins/autotest/quick/quicktestparser.cpp index 25423255102..72592b32a0b 100644 --- a/src/plugins/autotest/quick/quicktestparser.cpp +++ b/src/plugins/autotest/quick/quicktestparser.cpp @@ -190,35 +190,36 @@ static bool checkQmlDocumentForQuickTestCode(QFutureInterface &testFunctions = qmlVisitor.testFunctions(); + const QVector &testCases = qmlVisitor.testCases(); - QuickTestParseResult *parseResult = new QuickTestParseResult(id); - parseResult->proFile = proFile; - parseResult->itemType = TestTreeItem::TestCase; - QMap::ConstIterator it = testFunctions.begin(); - const QMap::ConstIterator end = testFunctions.end(); - for ( ; it != end; ++it) { - const TestCodeLocationAndType &loc = it.value(); - QuickTestParseResult *funcResult = new QuickTestParseResult(id); - funcResult->name = it.key(); - funcResult->displayName = it.key(); - funcResult->itemType = loc.m_type; - funcResult->fileName = loc.m_name; - funcResult->line = loc.m_line; - funcResult->column = loc.m_column; - funcResult->proFile = proFile; + for (const QuickTestCaseSpec &testCase : testCases) { + const QString testCaseName = testCase.m_caseName; - parseResult->children.append(funcResult); + QuickTestParseResult *parseResult = new QuickTestParseResult(id); + parseResult->proFile = proFile; + parseResult->itemType = TestTreeItem::TestCase; + if (!testCaseName.isEmpty()) { + parseResult->fileName = testCase.m_locationAndType.m_name; + parseResult->name = testCaseName; + parseResult->line = testCase.m_locationAndType.m_line; + parseResult->column = testCase.m_locationAndType.m_column; + } + + for (auto function : testCase.m_functions) { + QuickTestParseResult *funcResult = new QuickTestParseResult(id); + funcResult->name = function.m_functionName; + funcResult->displayName = function.m_functionName; + funcResult->itemType = function.m_locationAndType.m_type; + funcResult->fileName = function.m_locationAndType.m_name; + funcResult->line = function.m_locationAndType.m_line; + funcResult->column = function.m_locationAndType.m_column; + funcResult->proFile = proFile; + + parseResult->children.append(funcResult); + } + + futureInterface.reportResult(TestParseResultPtr(parseResult)); } - if (!testCaseName.isEmpty()) { - parseResult->fileName = tcLocationAndType.m_name; - parseResult->name = testCaseName; - parseResult->line = tcLocationAndType.m_line; - parseResult->column = tcLocationAndType.m_column; - } - futureInterface.reportResult(TestParseResultPtr(parseResult)); return true; } diff --git a/src/plugins/autotest/quick/quicktesttreeitem.cpp b/src/plugins/autotest/quick/quicktesttreeitem.cpp index 52d3796463e..c18de0ee9e2 100644 --- a/src/plugins/autotest/quick/quicktesttreeitem.cpp +++ b/src/plugins/autotest/quick/quicktesttreeitem.cpp @@ -323,11 +323,11 @@ TestTreeItem *QuickTestTreeItem::find(const TestParseResult *result) TestTreeItem *group = findFirstLevelChild([path](TestTreeItem *group) { return group->filePath() == path; }); - return group ? group->findChildByFile(result->fileName) : nullptr; + return group ? group->findChildByNameAndFile(result->name, result->fileName) : nullptr; } - return findChildByFile(result->fileName); + return findChildByNameAndFile(result->name, result->fileName); case GroupNode: - return findChildByFile(result->fileName); + return findChildByNameAndFile(result->name, result->fileName); case TestCase: return name().isEmpty() ? findChildByNameAndFile(result->name, result->fileName) : findChildByName(result->name); @@ -345,9 +345,9 @@ TestTreeItem *QuickTestTreeItem::findChild(const TestTreeItem *other) case Root: if (otherType == TestCase && other->name().isEmpty()) return unnamedQuickTests(); - return findChildByFileAndType(other->filePath(), otherType); + return findChildByFileNameAndType(other->filePath(), other->name(), otherType); case GroupNode: - return findChildByFileAndType(other->filePath(), otherType); + return findChildByFileNameAndType(other->filePath(), other->name(), otherType); case TestCase: if (otherType != TestFunction && otherType != TestDataFunction && otherType != TestSpecialFunction) return nullptr; @@ -444,6 +444,16 @@ void QuickTestTreeItem::markForRemovalRecursively(const QString &filePath) } } +TestTreeItem *QuickTestTreeItem::findChildByFileNameAndType(const QString &filePath, + const QString &name, + TestTreeItem::Type tType) + +{ + return findFirstLevelChild([filePath, name, tType](const TestTreeItem *other) { + return other->type() == tType && other->name() == name && other->filePath() == filePath; + }); +} + TestTreeItem *QuickTestTreeItem::unnamedQuickTests() const { if (type() != Root) diff --git a/src/plugins/autotest/quick/quicktesttreeitem.h b/src/plugins/autotest/quick/quicktesttreeitem.h index b9f06d6a079..a9e48fca940 100644 --- a/src/plugins/autotest/quick/quicktesttreeitem.h +++ b/src/plugins/autotest/quick/quicktesttreeitem.h @@ -57,6 +57,8 @@ public: QSet internalTargets() const override; void markForRemovalRecursively(const QString &filePath) override; private: + TestTreeItem *findChildByFileNameAndType(const QString &filePath, const QString &name, + Type tType); TestTreeItem *unnamedQuickTests() const; }; diff --git a/src/plugins/autotest/quick/quicktestvisitors.cpp b/src/plugins/autotest/quick/quicktestvisitors.cpp index f9934e735d2..f60b59b3684 100644 --- a/src/plugins/autotest/quick/quicktestvisitors.cpp +++ b/src/plugins/autotest/quick/quicktestvisitors.cpp @@ -31,6 +31,7 @@ #include #include #include +#include namespace Autotest { namespace Internal { @@ -85,29 +86,29 @@ static bool isDerivedFromTestCase(QmlJS::AST::UiQualifiedId *id, const QmlJS::Do bool TestQmlVisitor::visit(QmlJS::AST::UiObjectDefinition *ast) { const QStringRef name = ast->qualifiedTypeNameId->name; - m_objectStack.push(name.toString()); + m_objectIsTestStack.push(false); if (name != "TestCase") { - m_insideTestCase = false; if (!isDerivedFromTestCase(ast->qualifiedTypeNameId, m_currentDoc, m_snapshot)) return true; } else if (!documentImportsQtTest(m_currentDoc.data())) { return true; // find nested TestCase items as well } - m_typeIsTestCase = true; - m_insideTestCase = true; - m_currentTestCaseName.clear(); + m_objectIsTestStack.top() = true; const auto sourceLocation = ast->firstSourceLocation(); - m_testCaseLocation.m_name = m_currentDoc->fileName(); - m_testCaseLocation.m_line = sourceLocation.startLine; - m_testCaseLocation.m_column = sourceLocation.startColumn - 1; - m_testCaseLocation.m_type = TestTreeItem::TestCase; + QuickTestCaseSpec currentSpec; + currentSpec.m_locationAndType.m_name = m_currentDoc->fileName(); + currentSpec.m_locationAndType.m_line = sourceLocation.startLine; + currentSpec.m_locationAndType.m_column = sourceLocation.startColumn - 1; + currentSpec.m_locationAndType.m_type = TestTreeItem::TestCase; + m_caseParseStack.push(currentSpec); return true; } void TestQmlVisitor::endVisit(QmlJS::AST::UiObjectDefinition *) { - m_insideTestCase = m_objectStack.pop() == "TestCase"; + if (!m_objectIsTestStack.isEmpty() && m_objectIsTestStack.pop() && !m_caseParseStack.isEmpty()) + m_testCases << m_caseParseStack.pop(); } bool TestQmlVisitor::visit(QmlJS::AST::ExpressionStatement *ast) @@ -118,7 +119,7 @@ bool TestQmlVisitor::visit(QmlJS::AST::ExpressionStatement *ast) bool TestQmlVisitor::visit(QmlJS::AST::UiScriptBinding *ast) { - if (m_insideTestCase) + if (m_objectIsTestStack.top()) m_expectTestCaseName = ast->qualifiedId->name == "name"; return m_expectTestCaseName; } @@ -131,6 +132,9 @@ void TestQmlVisitor::endVisit(QmlJS::AST::UiScriptBinding *) bool TestQmlVisitor::visit(QmlJS::AST::FunctionDeclaration *ast) { + if (m_caseParseStack.isEmpty()) + return false; + const QStringRef name = ast->name; if (name.startsWith("test_") || name.startsWith("benchmark_") @@ -148,15 +152,17 @@ bool TestQmlVisitor::visit(QmlJS::AST::FunctionDeclaration *ast) else locationAndType.m_type = TestTreeItem::TestFunction; - m_testFunctions.insert(name.toString(), locationAndType); + m_caseParseStack.top().m_functions.append( + QuickTestFunctionSpec{name.toString(), locationAndType}); } return false; } bool TestQmlVisitor::visit(QmlJS::AST::StringLiteral *ast) { - if (m_expectTestCaseName && m_currentTestCaseName.isEmpty()) { - m_currentTestCaseName = ast->value.toString(); + if (m_expectTestCaseName) { + QTC_ASSERT(!m_caseParseStack.isEmpty(), return false); + m_caseParseStack.top().m_caseName = ast->value.toString(); m_expectTestCaseName = false; } return false; diff --git a/src/plugins/autotest/quick/quicktestvisitors.h b/src/plugins/autotest/quick/quicktestvisitors.h index 025ce0198db..e4af8661c2f 100644 --- a/src/plugins/autotest/quick/quicktestvisitors.h +++ b/src/plugins/autotest/quick/quicktestvisitors.h @@ -37,6 +37,21 @@ namespace Autotest { namespace Internal { +class QuickTestFunctionSpec +{ +public: + QString m_functionName; + TestCodeLocationAndType m_locationAndType; +}; + +class QuickTestCaseSpec +{ +public: + QString m_caseName; + TestCodeLocationAndType m_locationAndType; + QVector m_functions; +}; + class TestQmlVisitor : public QmlJS::AST::Visitor { public: @@ -50,20 +65,15 @@ public: bool visit(QmlJS::AST::FunctionDeclaration *ast) override; bool visit(QmlJS::AST::StringLiteral *ast) override; - QString testCaseName() const { return m_currentTestCaseName; } - TestCodeLocationAndType testCaseLocation() const { return m_testCaseLocation; } - QMap testFunctions() const { return m_testFunctions; } - bool isValid() const { return m_typeIsTestCase; } + QVector testCases() const { return m_testCases; } + bool isValid() const { return !m_testCases.isEmpty(); } private: QmlJS::Document::Ptr m_currentDoc; QmlJS::Snapshot m_snapshot; - QString m_currentTestCaseName; - TestCodeLocationAndType m_testCaseLocation; - QMap m_testFunctions; - QStack m_objectStack; - bool m_typeIsTestCase = false; - bool m_insideTestCase = false; + QStack m_caseParseStack; + QVector m_testCases; + QStack m_objectIsTestStack; bool m_expectTestCaseName = false; }; diff --git a/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto/tst_test2.qml b/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto/tst_test2.qml index d0115c5dd74..b6330ac4ea6 100644 --- a/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto/tst_test2.qml +++ b/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto/tst_test2.qml @@ -34,21 +34,38 @@ TestCase { verify(blubb == bla, "Comparing concat equality") } -// nested TestCases actually fail -// TestCase { -// name: "boo" + TestCase { + name: "boo" -// function test_boo() { -// verify(true); -// } + function test_boo() { + verify(true); + } -// TestCase { -// name: "far" + TestCase { + name: "far" -// function test_far() { -// verify(true); -// } -// } -// } + function test_far() { + verify(true); + } + } + + function test_boo2() { // should not get added to "far", but to "boo" + verify(false); + } + } + + TestCase { + name: "secondBoo" + + function test_bar() { + compare(1, 1); + } + } + + TestCase { // unnamed + function test_func() { + verify(true); + } + } } diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index 90c4bca5068..9a1a3c99e50 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -357,10 +357,15 @@ Utils::CommandLine CMakeBuildStep::cmakeCommand(CMakeRunConfiguration *rc) const QString target; if (isCurrentExecutableTarget(m_buildTarget)) { - if (rc) - target = rc->buildKey().section('\n', 0, 0); - else + if (rc) { + target = rc->buildKey(); + const int pos = target.indexOf("///::///"); + if (pos >= 0) { + target = target.mid(pos + 8); + } + } else { target = "<" + tr(ADD_RUNCONFIGURATION_TEXT) + ">"; + } } else { target = m_buildTarget; } diff --git a/src/plugins/help/CMakeLists.txt b/src/plugins/help/CMakeLists.txt index 7f3c05a75e9..e96f15d91cc 100644 --- a/src/plugins/help/CMakeLists.txt +++ b/src/plugins/help/CMakeLists.txt @@ -42,6 +42,7 @@ find_package(Qt5WebEngineWidgets QUIET) extend_qtc_plugin(Help CONDITION TARGET Qt5::WebEngineWidgets DEPENDS Qt5::WebEngineWidgets + DEFINES QTC_WEBENGINE_HELPVIEWER SOURCES webenginehelpviewer.cpp webenginehelpviewer.h diff --git a/src/plugins/perfprofiler/perfloaddialog.ui b/src/plugins/perfprofiler/perfloaddialog.ui index c08b6433f1a..dc6ae1972ac 100644 --- a/src/plugins/perfprofiler/perfloaddialog.ui +++ b/src/plugins/perfprofiler/perfloaddialog.ui @@ -109,38 +109,4 @@ - - - buttonBox - accepted() - PerfLoadDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - PerfLoadDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - diff --git a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp index 245d6047074..0b5f79a39e7 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp @@ -162,6 +162,33 @@ QVariant FileResourcesModel::modelNodeBackend() const return QVariant(); } +bool filterMetaIcons(const QString &fileName) +{ + + QFileInfo info(fileName); + + if (info.dir().path().split("/").contains("designer")) { + + QDir currentDir = info.dir(); + + int i = 0; + while (!currentDir.isRoot() && i < 3) { + if (currentDir.dirName() == "designer") { + if (!currentDir.entryList({"*.metainfo"}).isEmpty()) + return false; + } + + currentDir.cdUp(); + ++i; + } + + if (info.dir().dirName() == "designer") + return false; + } + + return true; +} + void FileResourcesModel::setupModel() { m_lock = true; @@ -174,7 +201,8 @@ void FileResourcesModel::setupModel() QDirIterator it(m_dirPath.absolutePath(), filterList, QDir::Files, QDirIterator::Subdirectories); while (it.hasNext()) { QString absolutePath = it.next(); - m_model.append(m_dirPath.relativeFilePath(absolutePath)); + if (filterMetaIcons(absolutePath)) + m_model.append(m_dirPath.relativeFilePath(absolutePath)); } m_lock = false; diff --git a/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp index b6ed184f9d5..c76b67dceb9 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp @@ -142,7 +142,7 @@ void ChangePropertyVisitor::replaceMemberValue(UiObjectMember *propertyMember, b if (publicMember->semicolonToken.isValid()) endOffset = publicMember->semicolonToken.end(); else - endOffset = publicMember->statement->lastSourceLocation().offset; + endOffset = publicMember->statement->lastSourceLocation().end(); } else { startOffset = publicMember->lastSourceLocation().end(); endOffset = startOffset; diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index b9b82f5714f..ea72cc51a20 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -97,7 +97,8 @@ QStringList globalQtEnums() QStringList knownEnumScopes() { static const QStringList list = { - "TextInput", "TextEdit", "Material", "Universal", "Font", "Shape", "ShapePath", "AbstractButton" + "TextInput", "TextEdit", "Material", "Universal", "Font", "Shape", "ShapePath", + "AbstractButton", "Text" }; return list; } diff --git a/src/shared/qbs b/src/shared/qbs index 27b78ea67f8..2269ddc60e4 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit 27b78ea67f82fca051666599603273c12ecb403b +Subproject commit 2269ddc60e47bfea459ef034ab1be112716b4764 diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp index 31ea4e59147..266dc92508f 100644 --- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp +++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp @@ -611,6 +611,8 @@ void tst_TestCore::testRewriterDynamicProperties() const QString inThere = testRewriterView1->rootModelNode().variantProperty("vv").value().value(); QCOMPARE(inThere, QString("Hello")); + rootModelNode.variantProperty("vv").setDynamicTypeNameAndValue("variant", "hallo2"); + // test model2text // QPlainTextEdit textEdit2; // textEdit2.setPlainText("import QtQuick 1.1; Item{}"); diff --git a/tests/system/suite_debugger/tst_qml_js_console/test.py b/tests/system/suite_debugger/tst_qml_js_console/test.py index 329839cb7fe..b94303bfb1b 100644 --- a/tests/system/suite_debugger/tst_qml_js_console/test.py +++ b/tests/system/suite_debugger/tst_qml_js_console/test.py @@ -139,6 +139,7 @@ def main(): switchViewTo(ViewConstants.EDIT) # start debugging clickButton(fancyDebugButton) + progressBarWait() waitForObject(":Locals and Expressions_Debugger::Internal::WatchTreeView") rootIndex = getQModelIndexStr("text='QQmlEngine'", ":Locals and Expressions_Debugger::Internal::WatchTreeView") @@ -147,7 +148,9 @@ def main(): doubleClick(waitForObject(mainRect)) if not object.exists(":DebugModeWidget_Debugger::Internal::ConsoleView"): invokeMenuItem("Window", "Output Panes", "QML Debugger Console") - progressBarWait() + # Window might be too small to show Locals, so close what we don't need + for view in ("Stack", "Breakpoints", "Expressions"): + invokeMenuItem("Window", "Views", view) # color and float values have additional ZERO WIDTH SPACE (\u200b), different usage of # whitespaces inside expressions is part of the test checks = [("color", u"#\u200b008000"), ("width", "50"), diff --git a/tests/system/suite_general/tst_default_settings/test.py b/tests/system/suite_general/tst_default_settings/test.py index b92a1c93aea..2956f4acbba 100644 --- a/tests/system/suite_general/tst_default_settings/test.py +++ b/tests/system/suite_general/tst_default_settings/test.py @@ -94,7 +94,7 @@ def __processSubItems__(treeObjStr, section, parModelIndexStr, doneItems, itObj = "%s occurrence='%d'}" % (itObj[:-1], alreadyDone + 1) currentSelectedTreeItem = waitForObject(itObj, 3000) tree.scrollTo(it) - mouseClick(currentSelectedTreeItem) + mouseClick(currentSelectedTreeItem, 5, 5, 0, Qt.LeftButton) additionalFunc(indexName, *additionalParameters) currentSelectedTreeItem = None if model.rowCount(it) > 0: @@ -210,6 +210,7 @@ def __getExpectedCompilers__(): compilers = ["g++", "gcc"] if platform.system() in ('Linux', 'Darwin'): compilers.extend(["clang++", "clang", "afl-clang"]) + compilers.extend(findAllFilesInPATH("clang-[0-9]")) compilers.extend(findAllFilesInPATH("clang-[0-9].[0-9]")) compilers.extend(findAllFilesInPATH("*g++*")) compilers.extend(findAllFilesInPATH("*gcc*")) diff --git a/tests/system/suite_general/tst_opencreator_qbs/testdata/projecttree_creator.tsv b/tests/system/suite_general/tst_opencreator_qbs/testdata/projecttree_creator.tsv index 6e594bcb6c3..eee343829d2 100644 --- a/tests/system/suite_general/tst_opencreator_qbs/testdata/projecttree_creator.tsv +++ b/tests/system/suite_general/tst_opencreator_qbs/testdata/projecttree_creator.tsv @@ -4873,9 +4873,7 @@ "zoomin_overlay@2x.png" "7" "zoomout_overlay.png" "7" "zoomout_overlay@2x.png" "7" -"tooltip" "6" -"images" "7" -"f1.png" "8" +"f1.png" "7" "utils_global.h" "4" "utilsicons.cpp" "4" "utilsicons.h" "4" @@ -7576,10 +7574,8 @@ "debugger.qbs:248" "5" "debuggerunittests.qrc" "5" "/" "6" -"unit-tests" "7" -"simple" "8" -"main.cpp" "9" -"simple.pro" "9" +"main.cpp" "8" +"simple.pro" "8" "Debugger dev headers" "3" "debugger.qbs:6" "4" "Group 1" "4" diff --git a/tests/system/suite_general/tst_openqt_creator/test.py b/tests/system/suite_general/tst_openqt_creator/test.py index d615d7d85fa..230549ecc8d 100644 --- a/tests/system/suite_general/tst_openqt_creator/test.py +++ b/tests/system/suite_general/tst_openqt_creator/test.py @@ -62,12 +62,10 @@ def main(): if not test.verify(object.exists(":Qt Creator_Core::OutputWindow"), "Did the General Messages view show up?"): openGeneralMessages() - # Verify messages appear once, from using default kit before configuring + # Verify message appears once, written before a kit was selected for qtcreator.pro generalMessages = str(waitForObject(":Qt Creator_Core::OutputWindow").plainText) - test.compare(generalMessages.count("Project MESSAGE: Cannot build Qt Creator with Qt version 5.6.1."), 1, - "Warning about outdated Qt shown?") - test.compare(generalMessages.count("Project ERROR: Use at least Qt 5.9.0."), 1, - "Minimum Qt version shown (once when parsing with default kit, once with selected)?") + test.compare(generalMessages.count('Cannot parse project "qtcreator": No kit selected.'), 1, + 'Warning about missing kit selection shown?') # Verify that qmljs.g is in the project even when we don't know where (QTCREATORBUG-17609) selectFromLocator("p qmljs.g", "qmljs.g") diff --git a/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv b/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv index 550fda20b6c..4710adcf131 100644 --- a/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv +++ b/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv @@ -4259,9 +4259,7 @@ "zoomin_overlay@2x.png" "8" "zoomout_overlay.png" "8" "zoomout_overlay@2x.png" "8" -"tooltip" "7" -"images" "8" -"f1.png" "9" +"f1.png" "8" "Other files" "3" "utils.qbs" "4" "utils_dependencies" "2" @@ -7292,10 +7290,8 @@ "tracepointoverlay@2x.png" "7" "debuggerunittests.qrc" "4" "/" "5" -"unit-tests" "6" -"simple" "7" -"main.cpp" "8" -"simple.pro" "8" +"main.cpp" "7" +"simple.pro" "7" "Other files" "3" "debugger.qbs" "4" "debugger_dependencies" "2" @@ -18043,9 +18039,7 @@ "zoomin_overlay@2x.png" "8" "zoomout_overlay.png" "8" "zoomout_overlay@2x.png" "8" -"tooltip" "7" -"images" "8" -"f1.png" "9" +"f1.png" "8" "Headers" "3" "echoclangcodemodelserver.h" "4" "Sources" "3" @@ -19279,9 +19273,7 @@ "zoomin_overlay@2x.png" "9" "zoomout_overlay.png" "9" "zoomout_overlay@2x.png" "9" -"tooltip" "8" -"images" "9" -"f1.png" "10" +"f1.png" "9" "gmock_dependency" "3" "gmock_dependency.pri" "4" "Headers" "4"