From 15734ac5eb5b7b55916aca7b83a85ed8b6c793c1 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Wed, 8 Jan 2020 10:14:24 +0200 Subject: [PATCH 1/6] QBS: Fix template for Android CppApplication sets usesNativeCode for android which it's needed to compile the C++ part of the application. Change-Id: Ibf787fecd256e4f90c09b8e3061a23419feb526e Reviewed-by: Christian Kandeler --- .../templates/wizards/projects/qtquickapplication/app.qbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs b/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs index f06fb39824b..b22af44529d 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs @@ -1,6 +1,6 @@ import qbs -Application { +CppApplication { @if "%{UseVirtualKeyboard}" == "true" Depends { name: "Qt"; submodules: ["quick", "virtualkeyboard"] } @else From 1ab9dc946410e96e0e211347e9d9127740ab18dd Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 4 Dec 2019 09:53:26 +0100 Subject: [PATCH 2/6] CppEditor: generate valid code via "Convert to Pointer/Stack Variable" Adding a "= new " after converting a stack variable without assignment or initializer to pointer. Also remove the assignment when converting from pointer to stack variable as this works better with explicit constructors. Fixes: QTCREATORBUG-23181 Change-Id: I377ec32a1b66cf4b96db14cfcb4b71fb96c80c98 Reviewed-by: David Schulz Reviewed-by: Christian Stenger --- doc/src/editors/creator-code-refactoring.qdoc | 2 +- src/plugins/cppeditor/cppquickfix_test.cpp | 45 +++++++++++++++-- src/plugins/cppeditor/cppquickfixes.cpp | 50 ++++++++++++------- 3 files changed, 74 insertions(+), 23 deletions(-) diff --git a/doc/src/editors/creator-code-refactoring.qdoc b/doc/src/editors/creator-code-refactoring.qdoc index 8120a0543cd..f333c92bc42 100644 --- a/doc/src/editors/creator-code-refactoring.qdoc +++ b/doc/src/editors/creator-code-refactoring.qdoc @@ -755,7 +755,7 @@ as \code - QByteArray foo = "foo"; + QByteArray foo("foo"); foo.append("bar"); \endcode diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index 63f1290b6ac..e75464d2b56 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -1578,7 +1578,7 @@ void CppEditorPlugin::test_quickfix_data() " f2(&str);\n" "}\n") << _("void foo() {\n" - " QString *str;\n" + " QString *str = new QString;\n" " if (!str->isEmpty())\n" " str->clear();\n" " f1(*str);\n" @@ -1612,7 +1612,7 @@ void CppEditorPlugin::test_quickfix_data() " str->clear();\n" "}\n") << _("void foo() {\n" - " QString str = QLatin1String(\"schnurz\");\n" + " QString str(QLatin1String(\"schnurz\"));\n" " if (!str.isEmpty())\n" " str.clear();\n" "}\n"); @@ -1731,7 +1731,7 @@ void CppEditorPlugin::test_quickfix_data() " f1(str);\n" "}\n") << _("void foo() {\n" - " QString *str;\n" + " QString *str = new QString;\n" " str->clear();\n" " {\n" " QString str;\n" @@ -1808,6 +1808,45 @@ void CppEditorPlugin::test_quickfix_data() " BAR = *foo;\n" "}\n"); + QString testObjAndFunc = "struct Object\n" + "{\n" + " Object(%1){}\n" + "};\n" + "void func()\n" + "{\n" + " %2\n" + "}\n"; + + QTest::newRow("ConvertToStack1_QTCREATORBUG23181") + << CppQuickFixFactoryPtr(new ConvertFromAndToPointer) + << _(testObjAndFunc.arg("int").arg("Object *@obj = new Object(0);").toUtf8()) + << _(testObjAndFunc.arg("int").arg("Object obj(0);").toUtf8()); + + QTest::newRow("ConvertToStack2_QTCREATORBUG23181") + << CppQuickFixFactoryPtr(new ConvertFromAndToPointer) + << _(testObjAndFunc.arg("int").arg("Object *@obj = new Object{0};").toUtf8()) + << _(testObjAndFunc.arg("int").arg("Object obj{0};").toUtf8()); + + QTest::newRow("ConvertToPointer1_QTCREATORBUG23181") + << CppQuickFixFactoryPtr(new ConvertFromAndToPointer) + << _(testObjAndFunc.arg("").arg("Object @obj;").toUtf8()) + << _(testObjAndFunc.arg("").arg("Object *obj = new Object;").toUtf8()); + + QTest::newRow("ConvertToPointer2_QTCREATORBUG23181") + << CppQuickFixFactoryPtr(new ConvertFromAndToPointer) + << _(testObjAndFunc.arg("").arg("Object @obj();").toUtf8()) + << _(testObjAndFunc.arg("").arg("Object *obj = new Object();").toUtf8()); + + QTest::newRow("ConvertToPointer3_QTCREATORBUG23181") + << CppQuickFixFactoryPtr(new ConvertFromAndToPointer) + << _(testObjAndFunc.arg("").arg("Object @obj{};").toUtf8()) + << _(testObjAndFunc.arg("").arg("Object *obj = new Object{};").toUtf8()); + + QTest::newRow("ConvertToPointer4_QTCREATORBUG23181") + << CppQuickFixFactoryPtr(new ConvertFromAndToPointer) + << _(testObjAndFunc.arg("int").arg("Object @obj(0);").toUtf8()) + << _(testObjAndFunc.arg("int").arg("Object *obj = new Object(0);").toUtf8()); + QTest::newRow("InsertQtPropertyMembers_noTriggerInvalidCode") << CppQuickFixFactoryPtr(new InsertQtPropertyMembers) << _("class C { @Q_PROPERTY(typeid foo READ foo) };\n") diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index d384322bdd4..c3c93f7a5e7 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -4153,20 +4153,21 @@ private: void removeNewExpression(ChangeSet &changes, NewExpressionAST *newExprAST) const { - ExpressionListParenAST *exprlist = newExprAST->new_initializer - ? newExprAST->new_initializer->asExpressionListParen() - : nullptr; + ExpressionListAST *exprlist = nullptr; + if (newExprAST->new_initializer) { + if (ExpressionListParenAST *ast = newExprAST->new_initializer->asExpressionListParen()) + exprlist = ast->expression_list; + else if (BracedInitializerAST *ast = newExprAST->new_initializer->asBracedInitializer()) + exprlist = ast->expression_list; + } - if (exprlist && exprlist->expression_list) { + if (exprlist) { // remove 'new' keyword and type before initializer changes.remove(m_file->startOf(newExprAST->new_token), m_file->startOf(newExprAST->new_initializer)); - // remove parenthesis around initializer - int pos = m_file->startOf(exprlist->lparen_token); - changes.remove(pos, pos + 1); - pos = m_file->startOf(exprlist->rparen_token); - changes.remove(pos, pos + 1); + changes.remove(m_file->endOf(m_declaratorAST->equal_token - 1), + m_file->startOf(m_declaratorAST->equal_token + 1)); } else { // remove the whole new expression changes.remove(m_file->endOf(m_identifierAST->firstToken()), @@ -4272,24 +4273,30 @@ private: return overview.prettyName(namedType->name->name); } - void insertNewExpression(ChangeSet &changes, CallAST *callAST) const + void insertNewExpression(ChangeSet &changes, ExpressionAST *ast) const { const QString typeName = typeNameOfDeclaration(); - if (typeName.isEmpty()) { - changes.insert(m_file->startOf(callAST), QLatin1String("new ")); + if (CallAST *callAST = ast->asCall()) { + if (typeName.isEmpty()) { + changes.insert(m_file->startOf(callAST), QLatin1String("new ")); + } else { + changes.insert(m_file->startOf(callAST), + QLatin1String("new ") + typeName + QLatin1Char('(')); + changes.insert(m_file->startOf(callAST->lastToken()), QLatin1String(")")); + } } else { - changes.insert(m_file->startOf(callAST), - QLatin1String("new ") + typeName + QLatin1Char('(')); - changes.insert(m_file->startOf(callAST->lastToken()), QLatin1String(")")); + if (typeName.isEmpty()) + return; + changes.insert(m_file->startOf(ast), QLatin1String(" = new ") + typeName); } } - void insertNewExpression(ChangeSet &changes, ExpressionListParenAST *exprListAST) const + void insertNewExpression(ChangeSet &changes) const { const QString typeName = typeNameOfDeclaration(); if (typeName.isEmpty()) return; - changes.insert(m_file->startOf(exprListAST), + changes.insert(m_file->endOf(m_identifierAST->firstToken()), QLatin1String(" = new ") + typeName); } @@ -4301,10 +4308,15 @@ private: changes.insert(m_file->startOf(idExprAST), QLatin1String("&")); } else if (CallAST *callAST = m_declaratorAST->initializer->asCall()) { insertNewExpression(changes, callAST); - } else if (ExpressionListParenAST *exprListAST - = m_declaratorAST->initializer->asExpressionListParen()) { + } else if (ExpressionListParenAST *exprListAST = m_declaratorAST->initializer + ->asExpressionListParen()) { insertNewExpression(changes, exprListAST); + } else if (BracedInitializerAST *bracedInitializerAST = m_declaratorAST->initializer + ->asBracedInitializer()) { + insertNewExpression(changes, bracedInitializerAST); } + } else { + insertNewExpression(changes); } // Fix all occurrences of the identifier in this function. From 4b62f2ebd3327b14034e1eccebba19e9495bb3ce Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 8 Jan 2020 11:18:43 +0100 Subject: [PATCH 3/6] ProjectExplorer: Do not access output window from non-UI thread Amends b4022f90d5. Fixes: QTCREATORBUG-23442 Change-Id: I9ef369193f32b06c29f43ed7484cb120e1dfc892 Reviewed-by: hjk --- src/plugins/projectexplorer/gcctoolchain.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index c5fb9857075..526a3e1725a 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include @@ -93,9 +94,11 @@ static QByteArray runGcc(const FilePath &gcc, const QStringList &arguments, cons SynchronousProcessResponse response = cpp.runBlocking(cmdLine); if (response.result != SynchronousProcessResponse::Finished || response.exitCode != 0) { - Core::MessageManager::write("Compiler feature detection failure!"); - Core::MessageManager::write(response.exitMessage(cmdLine.toUserOutput(), 10)); - Core::MessageManager::write(QString::fromUtf8(response.allRawOutput())); + QTimer::singleShot(0, Core::MessageManager::instance(), [cmdLine, response] { + Core::MessageManager::write("Compiler feature detection failure!"); + Core::MessageManager::write(response.exitMessage(cmdLine.toUserOutput(), 10)); + Core::MessageManager::write(QString::fromUtf8(response.allRawOutput())); + }); return QByteArray(); } From 04b3c56a2be9b5233140619deaec1d46d2f85c22 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 8 Jan 2020 14:27:27 +0100 Subject: [PATCH 4/6] CMakePM: Fix license header QC uses GPL nowadays. Change-Id: I6229deb09fadb1f7b1b210ba17ac4d0f3858023d Reviewed-by: Eike Ziller --- .../configmodelitemdelegate.cpp | 26 ++++++++++++------- .../configmodelitemdelegate.h | 26 ++++++++++++------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/configmodelitemdelegate.cpp b/src/plugins/cmakeprojectmanager/configmodelitemdelegate.cpp index c7e7d645aa8..7d9071bacbb 100644 --- a/src/plugins/cmakeprojectmanager/configmodelitemdelegate.cpp +++ b/src/plugins/cmakeprojectmanager/configmodelitemdelegate.cpp @@ -2,17 +2,25 @@ ** ** Copyright (C) 2016 Alexander Drozdov. ** Contact: adrozdoff@gmail.com +** Contact: https://www.qt.io/licensing/ ** -** This file is part of CMakeProjectManager2 plugin. +** This file is part of Qt Creator. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** ****************************************************************************/ diff --git a/src/plugins/cmakeprojectmanager/configmodelitemdelegate.h b/src/plugins/cmakeprojectmanager/configmodelitemdelegate.h index d33fb48c7a0..5df8decd113 100644 --- a/src/plugins/cmakeprojectmanager/configmodelitemdelegate.h +++ b/src/plugins/cmakeprojectmanager/configmodelitemdelegate.h @@ -2,17 +2,25 @@ ** ** Copyright (C) 2016 Alexander Drozdov. ** Contact: adrozdoff@gmail.com +** Contact: https://www.qt.io/licensing/ ** -** This file is part of CMakeProjectManager2 plugin. +** This file is part of Qt Creator. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** ****************************************************************************/ From 9165119819fe6a595c2a82b327ae67e597ffceba Mon Sep 17 00:00:00 2001 From: Marius Sincovici Date: Wed, 25 Dec 2019 20:02:11 +0100 Subject: [PATCH 5/6] Debugger: Check if m_perspective is valid before using it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When debugging a remote machine using ssh, if the ssh connection returns an error before other workers are fully started, and it will call destroyPerspective(). Then the other workers will call setState() when they are in EngineSetupOk and then in EngineRunRequested. Before calling select() method check if m_perspective is valid. Fixes: QTCREATORBUG-23415 Change-Id: Ib174015b1d11cdaa5f59e7ccb012b849d49672f1 Reviewed-by: Christian Stenger Reviewed-by: hjk Reviewed-by: André Hartmann --- src/plugins/debugger/debuggerengine.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index a90c569c6dc..86d4834b653 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -1828,7 +1828,8 @@ void DebuggerEngine::setState(DebuggerState state, bool forced) if (state == EngineRunRequested) { emit engineStarted(); - d->m_perspective->select(); + if (d->m_perspective) + d->m_perspective->select(); } showMessage(msg, LogDebug); From a4055f382c194198473b21b95fc0aedbc00a0477 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 7 Jan 2020 17:11:30 +0100 Subject: [PATCH 6/6] Add changes file for 4.11.1 Change-Id: I4fceef356ff83bcd4bf1e282eaad427feaf80038 Reviewed-by: Leena Miettinen --- dist/changes-4.11.1.md | 57 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 dist/changes-4.11.1.md diff --git a/dist/changes-4.11.1.md b/dist/changes-4.11.1.md new file mode 100644 index 00000000000..f2718ca6bcb --- /dev/null +++ b/dist/changes-4.11.1.md @@ -0,0 +1,57 @@ +# Qt Creator 4.11.1 + +Qt Creator version 4.11.1 contains bug fixes. + +The most important changes are listed in this document. For a complete +list of changes, see the Git log for the Qt Creator sources that +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 origin/v4.11.0..v4.11.1 + +## Editing + +* Fixed `Visualize Whitespace` for editors without specialized highlighter definition + (QTCREATORBUG-23040) + +### C++ + +* Fixed wrong warnings about C++98 incompatibility with MSVC (QTCREATORBUG-23118) +* Fixed accidentally added internal include paths from GCC (QTCREATORBUG-23330) + +### FakeVim + +* Fixed goto next and previous split (QTCREATORBUG-22397) +* Fixed indentation of continuation lines (QTCREATORBUG-20876) + +## Projects + +* Fixed crash when closing application output + +### CMake + +* Fixed subdirectory structure in project tree (QTCREATORBUG-23372) + +## Qt Quick Designer + +* Fixed removing single signals from Connection (QDS-1333) + +## Test Integration + +* Fixed stopping tests when debugging (QTCREATORBUG-23298) + +## Platforms + +### Windows + +* Worked around issue with HiDPI in Qt (QTBUG-80934) + +### WebAssembly + +* Fixed missing device in kit (QTCREATORBUG-23360) + +### QNX + +* Fixed deployment of Qt examples (QTCREATORBUG-22592) + +## Credits for these changes go to: