From 2123aebf652212d962a8bb57db4ea6ac20f7f840 Mon Sep 17 00:00:00 2001 From: Marco Benelli Date: Thu, 22 Jun 2017 14:59:53 +0200 Subject: [PATCH 1/7] QmlJS: keep track of cursor position in reformatting Task-number: QTCREATORBUG-18416 Change-Id: I30c07e0bff1b3f3933ff0e4aee8f1f2c81bd5ef6 Reviewed-by: Eike Ziller Reviewed-by: Thomas Hartmann --- src/plugins/qmljseditor/qmljseditorplugin.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index 9a427a1b08f..3faeda45126 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -258,10 +258,16 @@ void QmlJSEditorPlugin::reformatFile() return; const QString &newText = QmlJS::reformat(document); - QTextCursor tc(m_currentDocument->document()); - tc.movePosition(QTextCursor::Start); - tc.movePosition(QTextCursor::End, QTextCursor::KeepAnchor); - tc.insertText(newText); + QmlJSEditorWidget *widget = EditorManager::currentEditor() + ? qobject_cast(EditorManager::currentEditor()->widget()) + : nullptr; + if (widget) { + const int position = widget->position(); + m_currentDocument->document()->setPlainText(newText); + widget->setCursorPosition(position); + } else { + m_currentDocument->document()->setPlainText(newText); + } } } From 681d60143f1bf96f3cf61581a3917e810b26f9f5 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 23 Jun 2017 13:30:29 +0200 Subject: [PATCH 2/7] QmlDesigner: Be more specific with overriding shortcuts We have to be less aggressive when ovveriden keys, so that shortcuts like strg+shift+up/down still work. Task-number: QTCREATORBUG-18361 Change-Id: I2f4819f627f8820533b603575e853aec7d91171d Reviewed-by: Tim Jenssen --- .../components/texteditor/texteditorwidget.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp index d82fabfaf0a..591164138f3 100644 --- a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp +++ b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp @@ -175,14 +175,18 @@ void TextEditorWidget::setBlockCurserSelectionSyncronisation(bool b) bool TextEditorWidget::eventFilter( QObject *, QEvent *event) { - static std::vector overrideKeys = { Qt::Key_Delete, Qt::Key_Backspace, Qt::Key_Left, - Qt::Key_Right, Qt::Key_Up, Qt::Key_Down, Qt::Key_Insert, + static std::vector overrideKeys = { Qt::Key_Delete, Qt::Key_Backspace, Qt::Key_Insert, Qt::Key_Escape }; static std::vector overrideSequences = { QKeySequence::SelectAll, QKeySequence::Cut, - QKeySequence::Copy, QKeySequence::Delete, - QKeySequence::Paste, QKeySequence::Undo, - QKeySequence::Redo, QKeySequence(Qt::CTRL + Qt::ALT) }; + QKeySequence::Copy, QKeySequence::Delete, + QKeySequence::Paste, QKeySequence::Undo, + QKeySequence::Redo, QKeySequence(Qt::CTRL + Qt::ALT), + QKeySequence(Qt::Key_Left + Qt::CTRL), + QKeySequence(Qt::Key_Right + Qt::CTRL), + QKeySequence(Qt::Key_Up + Qt::CTRL), + QKeySequence(Qt::Key_Down + Qt::CTRL) + }; if (event->type() == QEvent::ShortcutOverride) { QKeyEvent *keyEvent = static_cast(event); From b884f5c4816c99d02828218381433bf4998a98ab Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 23 Jun 2017 15:43:20 +0200 Subject: [PATCH 3/7] Update qbs submodule To HEAD of 1.8 branch. Change-Id: I78de243f6a383f08b29e4a4807092c4f003d55ad Reviewed-by: Jake Petroules --- src/shared/qbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/qbs b/src/shared/qbs index 4d4ba7670ac..7e0191856b3 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit 4d4ba7670ac60dc5906fe01f2d950c22aace1c18 +Subproject commit 7e0191856b3c76517a2654183b52192713ff5770 From 89b3ab727463618bb42b11c1b30e27ff4b384e2c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 23 Jun 2017 14:40:56 +0200 Subject: [PATCH 4/7] Add more changes for 4.3.1 Change-Id: I11e5650fdd77c8eb0fb62beefaad2d9af81e96ed Reviewed-by: Tobias Hunger Reviewed-by: Orgad Shaneh --- dist/changes-4.3.1.md | 79 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/dist/changes-4.3.1.md b/dist/changes-4.3.1.md index e8412e02597..fa1ac40afbc 100644 --- a/dist/changes-4.3.1.md +++ b/dist/changes-4.3.1.md @@ -7,25 +7,104 @@ you can check out from the public Git repository. For example: git clone git://code.qt.io/qt-creator/qt-creator.git git log --cherry-pick --pretty=oneline v4.3.0..v4.3.1 +General + +* Fixed that wizards overwrote existing files even when told not to do so + (QTCREATORBUG-18284) + +Editing + +* Fixed memory leak in code completion (QTCREATORBUG-18326) + +All Projects + +* Fixed that links in `Application Output` stopped working after application + stops (QTCREATORBUG-18134) +* Fixed that `Application Output` was no longer editable (QTCREATORBUG-18418) + +QMake Projects + +* Fixed `Add Library` (QTCREATORBUG-18263) + +CMake Projects + +* Fixed crash when restoring session with multiple CMake projects + (QTCREATORBUG-18258) +* Fixed that `test` target was missing (QTCREATORBUG-18323) +* Fixed that `STATIC` and `INTERNAL` variables were shown in project + configuration +* Fixed that CMake `message`s were not shown in `Issues` pane + (QTCREATORBUG-18318) +* Fixed issues with CMake variables that contain `//` or `#` + (QTCREATORBUG-18385) +* Fixed that deployment information could contain empty items + (QTCREATORBUG-18406) +* Fixed that targets were duplicated when importing project (QTCREATORBUG-18409) +* Fixed that building application failed first time and after build error + when using CMake < 3.7 (QTCREATORBUG-18290, QTCREATORBUG-18382) + +Autotools Projects + +* Fixed regressions in project tree (QTCREATORBUG-18371) + +C++ Support + +* Fixed crash when requesting refactoring operations on invalid code + (QTCREATORBUG-18355) + +QML Support + +* Fixed crash when changing kit environment (QTCREATORBUG-18335) + +Valgrind + +* Fixed crash when running analyzer for iOS and Android (QTCREATORBUG-18254) + Version Control Systems +* Fixed filtering of untracked files in commit editor + when multiple projects are open * Git * Fixed that ref names were missing for `Show` +* Mercurial + * Fixed extra options in diff and log (QTCREATORBUG-17987) * Gerrit * Fixed parsing output from Gerrit 2.14 +Test Integration + +* Fixed that changing QML file triggered full rescan for tests + (QTCREATORBUG-18315) +* Fixed issues with multiple build targets + (QTCREATORBUG-17783, QTCREATORBUG-18357) + Platform Specific Windows * Fixed checking whether example should be copied to writable location (QTCREATORBUG-18184) +* Fixed issues with MSVC2017 and CMake (QTCREATORBUG-17925) + +macOS + +* Fixed performance issue on HiDPI displays (QTBUG-61384) WinRT * Fixed running MSVC 2017 based applications (QTCREATORBUG-18288) +Android + +* Fixed detection of MIPS64 toolchains +* Fixed that 64-bit ABIs were missing in AVD creation dialog + iOS +* Fixed running on iOS 10.3 devices (QTCREATORBUG-18380) * Fixed crash that could occur at startup while device is connected (QTCREATORBUG-18226) + +BareMetal + +* Fixed crash on shutdown From 6ab1da8b78d9bac8ffb0ba8ced6dfef42511d521 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 26 Jun 2017 10:25:46 +0200 Subject: [PATCH 5/7] AutoTest: Fix finding runconfig for multiple build targets As we are still constructing build system target to compare with on the test runner's side instead of getting the complete information from the run configuration we ended up using the wrong one in several circumstances. Avoid this by using the executable information we already got. Task-number: QTCREATORBUG-17783 Change-Id: I40431bef228f7070109297873c472fea410dbd16 Reviewed-by: David Schulz --- src/plugins/autotest/testconfiguration.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/plugins/autotest/testconfiguration.cpp b/src/plugins/autotest/testconfiguration.cpp index 52723a5b642..8440348d7d2 100644 --- a/src/plugins/autotest/testconfiguration.cpp +++ b/src/plugins/autotest/testconfiguration.cpp @@ -86,7 +86,12 @@ void TestConfiguration::completeTestInformation(int runMode) && targWithProjectFile.at(1).startsWith(bti.projectFilePath.toString()); }); }); - const Utils::FileName executable = targetInfo.targetFilePath; // empty if BTI is default created + QString executable = targetInfo.targetFilePath.toString(); // empty if BTI default created + if (Utils::HostOsInfo::isWindowsHost() && !executable.isEmpty() + && !executable.toLower().endsWith(".exe")) { + executable = Utils::HostOsInfo::withExecutableSuffix(executable); + } + for (RunConfiguration *runConfig : target->runConfigurations()) { if (!isLocal(runConfig)) // TODO add device support continue; @@ -99,13 +104,18 @@ void TestConfiguration::completeTestInformation(int runMode) StandardRunnable stdRunnable = runnable.as(); // TODO this might pick up the wrong executable m_executableFile = stdRunnable.executable; + if (Utils::HostOsInfo::isWindowsHost() && !m_executableFile.isEmpty() + && !m_executableFile.toLower().endsWith(".exe")) { + m_executableFile = Utils::HostOsInfo::withExecutableSuffix(m_executableFile); + } m_displayName = runConfig->displayName(); m_workingDir = Utils::FileUtils::normalizePathName(stdRunnable.workingDirectory); m_environment = stdRunnable.environment; m_project = project; if (runMode == TestRunner::Debug) m_runConfig = new TestRunConfiguration(runConfig->target(), this); - break; + if (m_executableFile == executable) // we can find a better runConfig if no match + break; } } // RunConfiguration for this target could be explicitly removed or not created at all @@ -117,12 +127,7 @@ void TestConfiguration::completeTestInformation(int runMode) if (runnable.is()) { StandardRunnable stdRunnable = runnable.as(); m_environment = stdRunnable.environment; - // when guessing we might have no extension - const QString &exeString = executable.toString(); - if (Utils::HostOsInfo::isWindowsHost() && !exeString.toLower().endsWith(".exe")) - m_executableFile = Utils::HostOsInfo::withExecutableSuffix(exeString); - else - m_executableFile = exeString; + m_executableFile = executable; m_project = project; m_guessedConfiguration = true; m_guessedFrom = rc->displayName(); From 56db0df2e65f897a6d268a6e8e22bb543a56215d Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Mon, 26 Jun 2017 12:39:52 +0200 Subject: [PATCH 6/7] Qbs: Fix crash when renaming files Fix a crash when using file nodes to change the project. The methods used to take const references, with the data living in the nodes of the project tree. Since the methods change the project tree and thus cause the tree to be rebuilt, the original data may get lost. So copy the data instead. All the qbs::*Data classes are using shared data, so the overhead is not too big. Task-number: QTCREATORBUG-18440 Change-Id: I45ca5403a04e17790416dfe15b836f12c732e824 Reviewed-by: Eike Ziller Reviewed-by: Tim Jenssen Reviewed-by: Christian Kandeler --- dist/changes-4.3.1.md | 4 ++++ src/plugins/qbsprojectmanager/qbsproject.cpp | 12 ++++++------ src/plugins/qbsprojectmanager/qbsproject.h | 15 ++++++++++----- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/dist/changes-4.3.1.md b/dist/changes-4.3.1.md index fa1ac40afbc..018f3a461d8 100644 --- a/dist/changes-4.3.1.md +++ b/dist/changes-4.3.1.md @@ -43,6 +43,10 @@ CMake Projects * Fixed that building application failed first time and after build error when using CMake < 3.7 (QTCREATORBUG-18290, QTCREATORBUG-18382) +Qbs Projects + +* Fixed crash when renaming files (QTCREATORBUG-18440) + Autotools Projects * Fixed regressions in project tree (QTCREATORBUG-18371) diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index fe0980e01d1..6496a66d31f 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -237,8 +237,8 @@ bool QbsProject::ensureWriteableQbsFile(const QString &file) } bool QbsProject::addFilesToProduct(const QStringList &filePaths, - const qbs::ProductData &productData, - const qbs::GroupData &groupData, QStringList *notAdded) + const qbs::ProductData productData, + const qbs::GroupData groupData, QStringList *notAdded) { QTC_ASSERT(m_qbsProject.isValid(), return false); QStringList allPaths = groupData.allFilePaths(); @@ -262,8 +262,8 @@ bool QbsProject::addFilesToProduct(const QStringList &filePaths, } bool QbsProject::removeFilesFromProduct(const QStringList &filePaths, - const qbs::ProductData &productData, - const qbs::GroupData &groupData, + const qbs::ProductData productData, + const qbs::GroupData groupData, QStringList *notRemoved) { QTC_ASSERT(m_qbsProject.isValid(), return false); @@ -290,8 +290,8 @@ bool QbsProject::removeFilesFromProduct(const QStringList &filePaths, } bool QbsProject::renameFileInProduct(const QString &oldPath, const QString &newPath, - const qbs::ProductData &productData, - const qbs::GroupData &groupData) + const qbs::ProductData productData, + const qbs::GroupData groupData) { if (newPath.isEmpty()) return false; diff --git a/src/plugins/qbsprojectmanager/qbsproject.h b/src/plugins/qbsprojectmanager/qbsproject.h index a13fdf698ae..505d70412a4 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.h +++ b/src/plugins/qbsprojectmanager/qbsproject.h @@ -66,14 +66,19 @@ public: QStringList filesGeneratedFrom(const QString &sourceFile) const override; bool isProjectEditable() const; - bool addFilesToProduct(const QStringList &filePaths, const qbs::ProductData &productData, - const qbs::GroupData &groupData, QStringList *notAdded); + // qbs::ProductData and qbs::GroupData are held by the nodes in the project tree. + // These methods change those trees and invalidate the lot, so pass in copies of + // the data we are interested in! + // The overhead is not as big as it seems at first glance: These all are handles + // for shared data. + bool addFilesToProduct(const QStringList &filePaths, const qbs::ProductData productData, + const qbs::GroupData groupData, QStringList *notAdded); bool removeFilesFromProduct(const QStringList &filePaths, - const qbs::ProductData &productData, const qbs::GroupData &groupData, + const qbs::ProductData productData, const qbs::GroupData groupData, QStringList *notRemoved); bool renameFileInProduct(const QString &oldPath, - const QString &newPath, const qbs::ProductData &productData, - const qbs::GroupData &groupData); + const QString &newPath, const qbs::ProductData productData, + const qbs::GroupData groupData); qbs::BuildJob *build(const qbs::BuildOptions &opts, QStringList products, QString &error); qbs::CleanJob *clean(const qbs::CleanOptions &opts); From a72b38b8c9f26c375ee0e6e348d4c3a32af16c25 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 27 Jun 2017 11:04:21 +0200 Subject: [PATCH 7/7] AutoTest: Improve finding executables for cmake based projects Depending on the structure of a project we might end up inside a library and will not find the correct executable for running a test. This patch improves finding the correct executable, but depending on the complexity of the project it will not be able to fix all circumstances. Task-number: QTCREATORBUG-17882 Change-Id: I847bb40426bc1b874c2dc6a2a6880b11fe048bda Reviewed-by: David Schulz --- src/plugins/autotest/gtest/gtesttreeitem.cpp | 12 ++++++++++++ src/plugins/autotest/gtest/gtesttreeitem.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/plugins/autotest/gtest/gtesttreeitem.cpp b/src/plugins/autotest/gtest/gtesttreeitem.cpp index dc53bd21dda..cd201cb9a46 100644 --- a/src/plugins/autotest/gtest/gtesttreeitem.cpp +++ b/src/plugins/autotest/gtest/gtesttreeitem.cpp @@ -327,5 +327,17 @@ QString GTestTreeItem::nameSuffix() const return suffix; } +QSet GTestTreeItem::internalTargets() const +{ + QSet result; + const auto cppMM = CppTools::CppModelManager::instance(); + const auto projectInfo = cppMM->projectInfo(ProjectExplorer::SessionManager::startupProject()); + for (const CppTools::ProjectPart::Ptr projectPart : projectInfo.projectParts()) { + if (projectPart->projectFile == proFile()) + result.insert(projectPart->buildSystemTarget); + } + return result; +} + } // namespace Internal } // namespace Autotest diff --git a/src/plugins/autotest/gtest/gtesttreeitem.h b/src/plugins/autotest/gtest/gtesttreeitem.h index 67973771dd5..60eb37b7f28 100644 --- a/src/plugins/autotest/gtest/gtesttreeitem.h +++ b/src/plugins/autotest/gtest/gtesttreeitem.h @@ -67,6 +67,7 @@ public: GTestTreeItem::TestStates state, const QString &proFile) const; QString nameSuffix() const; + QSet internalTargets() const override; private: GTestTreeItem::TestStates m_state;