From 90e432aa059ba0a6ab4af8b7c8897f59dbd5fce7 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 8 Feb 2019 11:19:19 +0100 Subject: [PATCH 01/13] LSP: Avoid unneeded copy inside loop Change-Id: I7c4d61eda6caf0baacdde01392e2457d54286863 Reviewed-by: David Schulz --- src/libs/languageserverprotocol/languagefeatures.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/languageserverprotocol/languagefeatures.cpp b/src/libs/languageserverprotocol/languagefeatures.cpp index 6672bbc2b87..06793217f14 100644 --- a/src/libs/languageserverprotocol/languagefeatures.cpp +++ b/src/libs/languageserverprotocol/languagefeatures.cpp @@ -396,7 +396,7 @@ CodeActionResult::CodeActionResult(const QJsonValue &val) { using ResultArray = QList>; if (val.isArray()) { - QJsonArray array = val.toArray(); + const QJsonArray array = val.toArray(); ResultArray result; for (const QJsonValue &val : array) { Command command(val); From 1f804e7fc7192979b81bf28c6e53af6de74cbd23 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Mon, 4 Feb 2019 10:29:04 +0100 Subject: [PATCH 02/13] ProjectExplorer: Add MSVC2019 flavor support It is promised to be compatible with prior versions. Change-Id: I85e433382a66c82e9880401c3a983fef06c03606 Reviewed-by: Marco Bubke Reviewed-by: David Schulz Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/abi.cpp | 28 +++++++++++++------ src/plugins/projectexplorer/abi.h | 1 + src/plugins/projectexplorer/msvctoolchain.cpp | 10 ++++++- src/plugins/qtsupport/baseqtversion.cpp | 2 ++ tests/unit/mockup/projectexplorer/abi.h | 1 + 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/plugins/projectexplorer/abi.cpp b/src/plugins/projectexplorer/abi.cpp index 131fbb33b41..0de4ea655d2 100644 --- a/src/plugins/projectexplorer/abi.cpp +++ b/src/plugins/projectexplorer/abi.cpp @@ -112,6 +112,7 @@ static void setupPreregisteredOsFlavors() { registerOsFlavor(Abi::WindowsMsvc2013Flavor, "msvc2013", {Abi::OS::WindowsOS}); registerOsFlavor(Abi::WindowsMsvc2015Flavor, "msvc2015", {Abi::OS::WindowsOS}); registerOsFlavor(Abi::WindowsMsvc2017Flavor, "msvc2017", {Abi::OS::WindowsOS}); + registerOsFlavor(Abi::WindowsMsvc2019Flavor, "msvc2019", {Abi::OS::WindowsOS}); registerOsFlavor(Abi::WindowsMSysFlavor, "msys", {Abi::OS::WindowsOS}); registerOsFlavor(Abi::WindowsCEFlavor, "ce", {Abi::OS::WindowsOS}); registerOsFlavor(Abi::VxWorksFlavor, "vxworks", {Abi::OS::VxWorks}); @@ -279,12 +280,15 @@ static QList parseCoffHeader(const QByteArray &data) flavor = Abi::WindowsMsvc2013Flavor; break; case 14: - flavor = minorLinker >= quint8(10) - ? Abi::WindowsMsvc2017Flavor // MSVC2017 RC - : Abi::WindowsMsvc2015Flavor; + if (minorLinker >= quint8(20)) + flavor = Abi::WindowsMsvc2019Flavor; + else if (minorLinker >= quint8(10)) + flavor = Abi::WindowsMsvc2017Flavor; + else + flavor = Abi::WindowsMsvc2015Flavor; break; case 15: - flavor = Abi::WindowsMsvc2017Flavor; + flavor = Abi::WindowsMsvc2019Flavor; break; default: // Keep unknown flavor if (minorLinker != 0) @@ -589,6 +593,13 @@ bool Abi::operator == (const Abi &other) const && m_wordWidth == other.m_wordWidth; } +static bool compatibleMSVCFlavors(const Abi::OSFlavor &left, const Abi ::OSFlavor &right) +{ + // MSVC 2019, 2017 and 2015 are compatible + return left >= Abi::WindowsMsvc2015Flavor && left <= Abi::WindowsMsvc2019Flavor + && right >= Abi::WindowsMsvc2015Flavor && right <= Abi::WindowsMsvc2019Flavor; +} + bool Abi::isCompatibleWith(const Abi &other) const { // Generic match: If stuff is identical or the other side is unknown, then this is a match. @@ -615,12 +626,9 @@ bool Abi::isCompatibleWith(const Abi &other) const if (isCompat && (osFlavor() == AndroidLinuxFlavor || other.osFlavor() == AndroidLinuxFlavor)) isCompat = (architecture() == other.architecture()) && (osFlavor() == other.osFlavor()); - // MSVC2017 is compatible with MSVC2015 - if (!isCompat - && ((osFlavor() == WindowsMsvc2015Flavor && other.osFlavor() == WindowsMsvc2017Flavor) - || (osFlavor() == WindowsMsvc2017Flavor && other.osFlavor() == WindowsMsvc2015Flavor))) { + if (!isCompat && compatibleMSVCFlavors(osFlavor(), other.osFlavor())) isCompat = true; - } + return isCompat; } @@ -896,6 +904,8 @@ bool Abi::osSupportsFlavor(const Abi::OS &os, const Abi::OSFlavor &flavor) Abi::OSFlavor Abi::flavorForMsvcVersion(int version) { + if (version >= 1920) + return WindowsMsvc2019Flavor; if (version >= 1910) return WindowsMsvc2017Flavor; switch (version) { diff --git a/src/plugins/projectexplorer/abi.h b/src/plugins/projectexplorer/abi.h index 4c31ed99f5d..43243847c87 100644 --- a/src/plugins/projectexplorer/abi.h +++ b/src/plugins/projectexplorer/abi.h @@ -89,6 +89,7 @@ public: WindowsMsvc2013Flavor, WindowsMsvc2015Flavor, WindowsMsvc2017Flavor, + WindowsMsvc2019Flavor, WindowsMSysFlavor, WindowsCEFlavor, diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index 711cf30accb..8b8c5711428 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -384,7 +384,9 @@ static Abi findAbiOfMsvc(MsvcToolChain::Type type, else if (version == QLatin1String("v7.0A") || version == QLatin1String("v7.1")) msvcVersionString = QLatin1String("10.0"); } - if (msvcVersionString.startsWith(QLatin1String("15."))) + if (msvcVersionString.startsWith(QLatin1String("16."))) + flavor = Abi::WindowsMsvc2019Flavor; + else if (msvcVersionString.startsWith(QLatin1String("15."))) flavor = Abi::WindowsMsvc2017Flavor; else if (msvcVersionString.startsWith(QLatin1String("14."))) flavor = Abi::WindowsMsvc2015Flavor; @@ -955,6 +957,12 @@ Utils::FileNameList MsvcToolChain::suggestedMkspecList() const << Utils::FileName::fromLatin1("winrt-x86-msvc2017") << Utils::FileName::fromLatin1("winrt-x64-msvc2017"); break; + case Abi::WindowsMsvc2019Flavor: + result << Utils::FileName::fromLatin1("win32-msvc2019") + << Utils::FileName::fromLatin1("winrt-arm-msvc2019") + << Utils::FileName::fromLatin1("winrt-x86-msvc2019") + << Utils::FileName::fromLatin1("winrt-x64-msvc2019"); + break; default: result.clear(); break; diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 9fefd8f28cf..0bfab886b57 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -1963,6 +1963,8 @@ static Abi refineAbiFromBuildString(const QByteArray &buildString, const Abi &pr flavor = Abi::WindowsMsvc2015Flavor; } else if (compiler.startsWith("MSVC 2017") && os == Abi::WindowsOS) { flavor = Abi::WindowsMsvc2017Flavor; + } else if (compiler.startsWith("MSVC 2019") && os == Abi::WindowsOS) { + flavor = Abi::WindowsMsvc2019Flavor; } return Abi(arch, os, flavor, format, wordWidth); diff --git a/tests/unit/mockup/projectexplorer/abi.h b/tests/unit/mockup/projectexplorer/abi.h index 25baca234a6..c742567bdef 100644 --- a/tests/unit/mockup/projectexplorer/abi.h +++ b/tests/unit/mockup/projectexplorer/abi.h @@ -49,6 +49,7 @@ public: WindowsMsvc2013Flavor, WindowsMsvc2015Flavor, WindowsMsvc2017Flavor, + WindowsMsvc2019Flavor, WindowsMSysFlavor, WindowsCEFlavor, From 037ab39cb8e77e7b8d33cb76559c52dc6b1a4c3f Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 8 Feb 2019 13:35:55 +0100 Subject: [PATCH 03/13] Fix cloning DesktopQmakeRunConfiguration The value of a terminal aspect is not exported in toMap() unless it was set by the user, so we need help from the project manager to get the default value. The QbsRunConfiguration already works this way. Maybe the terminal aspect could export all of its information and we could drop the fromMap() override from both run configs, but that should be a different patch. Fixes: QTCREATORBUG-21918 Change-Id: I712158f4bcb4dbd3827568dd4e1fe8b21d802f47 Reviewed-by: Orgad Shaneh --- .../qmakeprojectmanager/desktopqmakerunconfiguration.cpp | 8 ++++++++ .../qmakeprojectmanager/desktopqmakerunconfiguration.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp index 385fd54b3d0..8ac2a1cd0b5 100644 --- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp +++ b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp @@ -105,6 +105,14 @@ void DesktopQmakeRunConfiguration::updateTargetInformation() aspect()->setExecutable(bti.targetFilePath); } +bool DesktopQmakeRunConfiguration::fromMap(const QVariantMap &map) +{ + if (!RunConfiguration::fromMap(map)) + return false; + updateTargetInformation(); + return true; +} + void DesktopQmakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &) { updateTargetInformation(); diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h index ecaa1bfc6b8..2a4ccd564ba 100644 --- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h +++ b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h @@ -43,6 +43,7 @@ public: private: void updateTargetInformation(); + bool fromMap(const QVariantMap &map) final; void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &info) final; QString defaultDisplayName(); From b0795c32101dbd855118bd5806a95d01786397f4 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 8 Feb 2019 08:10:13 +0100 Subject: [PATCH 04/13] Squish: Fix expected Qml error Change-Id: I06395d6c0643c86a13f97a77c3c82771be9a1de3 Reviewed-by: Robert Loehning --- tests/system/shared/suites_qtta.py | 1 + tests/system/suite_CCOM/tst_CCOM02/test.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/system/shared/suites_qtta.py b/tests/system/shared/suites_qtta.py index d465ea6aa46..79d5ee3edaf 100755 --- a/tests/system/shared/suites_qtta.py +++ b/tests/system/shared/suites_qtta.py @@ -55,6 +55,7 @@ def checkSyntaxError(issuesView, expectedTextsArray, warnIfMoreIssues = True): test.warning("Expected error text found, but is not of type: 'error'") return False else: + test.log("Found expected error (%s)" % expectedText) return True return False diff --git a/tests/system/suite_CCOM/tst_CCOM02/test.py b/tests/system/suite_CCOM/tst_CCOM02/test.py index 44e95fa787a..b49594ddfb3 100755 --- a/tests/system/suite_CCOM/tst_CCOM02/test.py +++ b/tests/system/suite_CCOM/tst_CCOM02/test.py @@ -54,7 +54,7 @@ def main(): ensureChecked(waitForObject(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton")) issuesView = waitForObject(":Qt Creator.Issues_QListView") # verify that error is properly reported - test.verify(checkSyntaxError(issuesView, ["Syntax error"], True), + test.verify(checkSyntaxError(issuesView, ["Expected token `:'"], True), "Verifying QML syntax error while parsing complex qt quick application.") # exit qt creator invokeMenuItem("File", "Exit") From 0624944a249ba383cc9ba4d023ad6fdb7efe5943 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 8 Feb 2019 09:00:00 +0100 Subject: [PATCH 05/13] Squish: Fix expected color Change-Id: I9f0b1ceb1b927c86b1f4fc08c0fb2f17ce4f2975 Reviewed-by: Robert Loehning --- tests/system/suite_WELP/tst_WELP01/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/suite_WELP/tst_WELP01/test.py b/tests/system/suite_WELP/tst_WELP01/test.py index ce07f4fdaf3..d20c5d1d912 100755 --- a/tests/system/suite_WELP/tst_WELP01/test.py +++ b/tests/system/suite_WELP/tst_WELP01/test.py @@ -41,7 +41,7 @@ def clickItemVerifyHelpCombo(button, expectedHelpComboRegex, testDetails): "Verifying: '%s' button is being displayed." % getStarted) def buttonActive(button): # colors of the default theme for active button on Welcome page - (activeRed, activeGreen, activeBlue) = (64, 66, 68) + (activeRed, activeGreen, activeBlue) = (64, 65, 66) # QPalette::Window (used background color of Welcome page buttons) enumQPaletteWindow = 10 color = button.palette.color(enumQPaletteWindow) From 52ff4f6f8e20f2a0305bed8ab2f1387996d52076 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Sat, 9 Feb 2019 07:33:37 +0100 Subject: [PATCH 06/13] ExternalToolConfig: Cleanup and modernize * Remove QLatin1String * Use QOverload * Use auto where possible * Sort includes * Remove superfluous lines Change-Id: Iaa524fdb632398feab8431cb91bffe6330a57be8 Reviewed-by: Orgad Shaneh --- .../coreplugin/dialogs/externaltoolconfig.cpp | 52 +++++++++---------- .../coreplugin/dialogs/externaltoolconfig.h | 2 +- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp index af23aaf688b..fb770c3cc3d 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp @@ -27,33 +27,30 @@ #include "ui_externaltoolconfig.h" #include +#include +#include +#include #include #include #include #include -#include -#include -#include #include #include #include -#include -#include #include +#include #include +#include using namespace Core; using namespace Core::Internal; - static const Qt::ItemFlags TOOLSMENU_ITEM_FLAGS = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled; static const Qt::ItemFlags CATEGORY_ITEM_FLAGS = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEditable; static const Qt::ItemFlags TOOL_ITEM_FLAGS = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsEditable; -// #pragma mark -- ExternalToolModel - ExternalToolModel::ExternalToolModel(QObject *parent) : QAbstractItemModel(parent) { @@ -133,7 +130,7 @@ QMimeData *ExternalToolModel::mimeData(const QModelIndexList &indexes) const QByteArray ba; QDataStream stream(&ba, QIODevice::WriteOnly); stream << category << m_tools.value(category).indexOf(tool); - md->setData(QLatin1String("application/qtcreator-externaltool-config"), ba); + md->setData("application/qtcreator-externaltool-config", ba); return md; } @@ -149,7 +146,7 @@ bool ExternalToolModel::dropMimeData(const QMimeData *data, bool found; QString toCategory = categoryForIndex(parent, &found); QTC_ASSERT(found, return false); - QByteArray ba = data->data(QLatin1String("application/qtcreator-externaltool-config")); + QByteArray ba = data->data("application/qtcreator-externaltool-config"); if (ba.isEmpty()) return false; QDataStream stream(&ba, QIODevice::ReadOnly); @@ -309,7 +306,7 @@ void ExternalToolModel::revertTool(const QModelIndex &modelIndex) ExternalTool *tool = toolForIndex(modelIndex); QTC_ASSERT(tool, return); QTC_ASSERT(tool->preset() && !tool->preset()->fileName().isEmpty(), return); - ExternalTool *resetTool = new ExternalTool(tool->preset().data()); + auto resetTool = new ExternalTool(tool->preset().data()); resetTool->setPreset(tool->preset()); (*tool) = (*resetTool); delete resetTool; @@ -350,10 +347,10 @@ QModelIndex ExternalToolModel::addTool(const QModelIndex &atIndex) //: Sample external tool text const QString text = tr("Useful text"); if (Utils::HostOsInfo::isWindowsHost()) { - tool->setExecutables(QStringList(QLatin1String("cmd"))); - tool->setArguments(QLatin1String("/c echo ") + text); + tool->setExecutables({"cmd"}); + tool->setArguments("/c echo " + text); } else { - tool->setExecutables(QStringList(QLatin1String("echo"))); + tool->setExecutables({"echo"}); tool->setArguments(text); } @@ -395,8 +392,6 @@ void ExternalToolModel::removeTool(const QModelIndex &modelIndex) delete tool; } -// #pragma mark -- ExternalToolConfig - static void fillBaseEnvironmentComboBox(QComboBox *box) { box->clear(); @@ -433,7 +428,8 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) : this, &ExternalToolConfig::updateCurrentItem); connect(ui->executable, &Utils::PathChooser::browsingFinished, this, &ExternalToolConfig::updateCurrentItem); - connect(ui->arguments, &QLineEdit::editingFinished, this, &ExternalToolConfig::updateCurrentItem); + connect(ui->arguments, &QLineEdit::editingFinished, + this, &ExternalToolConfig::updateCurrentItem); connect(ui->arguments, &QLineEdit::editingFinished, this, &ExternalToolConfig::updateEffectiveArguments); connect(ui->workingDirectory, &Utils::PathChooser::editingFinished, @@ -442,28 +438,30 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) : this, &ExternalToolConfig::updateCurrentItem); connect(ui->environmentButton, &QAbstractButton::clicked, this, &ExternalToolConfig::editEnvironmentChanges); - connect(ui->outputBehavior, static_cast(&QComboBox::activated), + connect(ui->outputBehavior, QOverload::of(&QComboBox::activated), this, &ExternalToolConfig::updateCurrentItem); - connect(ui->errorOutputBehavior, static_cast(&QComboBox::activated), + connect(ui->errorOutputBehavior, QOverload::of(&QComboBox::activated), this, &ExternalToolConfig::updateCurrentItem); connect(ui->modifiesDocumentCheckbox, &QAbstractButton::clicked, this, &ExternalToolConfig::updateCurrentItem); - connect(ui->inputText, &QPlainTextEdit::textChanged, this, &ExternalToolConfig::updateCurrentItem); + connect(ui->inputText, &QPlainTextEdit::textChanged, + this, &ExternalToolConfig::updateCurrentItem); - connect(ui->revertButton, &QAbstractButton::clicked, this, &ExternalToolConfig::revertCurrentItem); - connect(ui->removeButton, &QAbstractButton::clicked, this, &ExternalToolConfig::removeTool); + connect(ui->revertButton, &QAbstractButton::clicked, + this, &ExternalToolConfig::revertCurrentItem); + connect(ui->removeButton, &QAbstractButton::clicked, + this, &ExternalToolConfig::removeTool); auto menu = new QMenu(ui->addButton); ui->addButton->setMenu(menu); - QAction *addTool = new QAction(tr("Add Tool"), this); + auto addTool = new QAction(tr("Add Tool"), this); menu->addAction(addTool); connect(addTool, &QAction::triggered, this, &ExternalToolConfig::addTool); - QAction *addCategory = new QAction(tr("Add Category"), this); + auto addCategory = new QAction(tr("Add Category"), this); menu->addAction(addCategory); connect(addCategory, &QAction::triggered, this, &ExternalToolConfig::addCategory); showInfoForItem(QModelIndex()); - } ExternalToolConfig::~ExternalToolConfig() @@ -478,7 +476,7 @@ void ExternalToolConfig::setTools(const QMap > &t while (it.hasNext()) { it.next(); QList itemCopy; - foreach (ExternalTool *tool, it.value()) + for (ExternalTool *tool : it.value()) itemCopy.append(new ExternalTool(tool)); toolsCopy.insert(it.key(), itemCopy); } @@ -648,7 +646,7 @@ void ExternalToolConfig::editEnvironmentChanges() void ExternalToolConfig::updateEnvironmentLabel() { - QString shortSummary = Utils::EnvironmentItem::toStringList(m_environment).join(QLatin1String("; ")); + QString shortSummary = Utils::EnvironmentItem::toStringList(m_environment).join("; "); QFontMetrics fm(ui->environmentLabel->font()); shortSummary = fm.elidedText(shortSummary, Qt::ElideRight, ui->environmentLabel->width()); ui->environmentLabel->setText(shortSummary.isEmpty() ? tr("No changes to apply.") : shortSummary); diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.h b/src/plugins/coreplugin/dialogs/externaltoolconfig.h index 293e9c64d1b..298b70c54fe 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.h +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.h @@ -27,9 +27,9 @@ #include "../externaltool.h" -#include #include #include +#include QT_FORWARD_DECLARE_CLASS(QPlainTextEdit) From 7388326bcab9278cb65ca5e003a0f309dd66d18d Mon Sep 17 00:00:00 2001 From: Vikas Pachdha Date: Fri, 8 Feb 2019 17:49:57 +0100 Subject: [PATCH 07/13] Fix crash while quitting debugging Task-number: QTCREATORBUG-21684 Change-Id: I2a51d0666f2a591daeec34fc88ee12aa50265ff3 Reviewed-by: Alexandru Croitor --- src/plugins/debugger/threadshandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/debugger/threadshandler.cpp b/src/plugins/debugger/threadshandler.cpp index a37d6fbe1d9..42acf73b872 100644 --- a/src/plugins/debugger/threadshandler.cpp +++ b/src/plugins/debugger/threadshandler.cpp @@ -409,7 +409,7 @@ void ThreadsHandler::setThreads(const GdbMi &data) if (!m_currentThread && threads.childCount() > 0) m_currentThread = rootItem()->childAt(0); - if (!m_currentThread) { + if (m_currentThread) { const QModelIndex currentThreadIndex = m_currentThread->index(); threadSwitcher()->setCurrentIndex(currentThreadIndex.row()); } From 8309606a52c4fbb6e0e6caadc52b5f36c25fb25a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 1 Feb 2019 15:52:43 +0100 Subject: [PATCH 08/13] Help: Lookup in index if ID is not found And if multiple topics are found in the index, show the topic chooser dialog that we already have for the help index. Fixes: QTCREATORBUG-12704 Task-number: QTCREATORBUG-15959 Change-Id: I7afa6f44bbecc12f602aaaa4a11209ec72399689 Reviewed-by: David Schulz --- src/plugins/coreplugin/helpitem.cpp | 133 ++++++++++++++---- src/plugins/coreplugin/helpitem.h | 15 +- src/plugins/coreplugin/helpmanager.cpp | 5 + src/plugins/coreplugin/helpmanager.h | 1 + .../coreplugin/helpmanager_implementation.h | 1 + src/plugins/help/helpindexfilter.cpp | 2 +- src/plugins/help/helpmanager.h | 2 +- src/plugins/help/helpplugin.cpp | 18 ++- src/plugins/qmljseditor/qmljshoverhandler.cpp | 9 +- 9 files changed, 143 insertions(+), 43 deletions(-) diff --git a/src/plugins/coreplugin/helpitem.cpp b/src/plugins/coreplugin/helpitem.cpp index 268c00ce67b..b8794481cfe 100644 --- a/src/plugins/coreplugin/helpitem.cpp +++ b/src/plugins/coreplugin/helpitem.cpp @@ -104,7 +104,7 @@ bool HelpItem::isValid() const { if (m_helpUrl.isEmpty() && m_helpIds.isEmpty()) return false; - return !links().isEmpty(); + return !links().empty(); } QString HelpItem::extractContent(bool extended) const @@ -116,7 +116,8 @@ QString HelpItem::extractContent(bool extended) const htmlExtractor.setMode(Utils::HtmlDocExtractor::FirstParagraph); QString contents; - for (const QUrl &url : links()) { + for (const Link &item : links()) { + const QUrl url = item.second; const QString html = QString::fromUtf8(Core::HelpManager::fileData(url)); switch (m_category) { case Brief: @@ -157,50 +158,124 @@ QString HelpItem::extractContent(bool extended) const return contents; } -const QMap &HelpItem::links() const +static std::pair extractVersion(const QUrl &url) +{ + const QString host = url.host(); + const QStringList hostParts = host.split('.'); + if (hostParts.size() == 4 && (host.startsWith("com.trolltech.") + || host.startsWith("org.qt-project."))) { + bool ok = false; + // the following is only correct under the specific current conditions, and it will + // always be quite some guessing as long as the version information does not + // include separators for major vs minor vs patch version + const int version = hostParts.at(3).toInt(&ok); + if (ok) { + QUrl urlWithoutVersion(url); + urlWithoutVersion.setHost(hostParts.mid(0, 3).join('.')); + return {urlWithoutVersion, version}; + } + } + return {url, 0}; +} + +// sort primary by "url without version" and seconday by "version" +static bool helpUrlLessThan(const QUrl &a, const QUrl &b) +{ + const std::pair va = extractVersion(a); + const std::pair vb = extractVersion(b); + const QString sa = va.first.toString(); + const QString sb = vb.first.toString(); + if (sa == sb) + return va.second > vb.second; + return sa < sb; +} + +static bool linkLessThan(const HelpItem::Link &a, const HelpItem::Link &b) +{ + return helpUrlLessThan(a.second, b.second); +} + +// links are sorted with highest "version" first (for Qt help urls) +const HelpItem::Links &HelpItem::links() const { if (!m_helpLinks) { if (!m_helpUrl.isEmpty()) { - m_helpLinks.emplace(QMap({{m_helpUrl.toString(), m_helpUrl}})); + m_keyword = m_helpUrl.toString(); + m_helpLinks.emplace(Links{{m_keyword, m_helpUrl}}); } else { m_helpLinks.emplace(); // set a value even if there are no help IDs + QMap helpLinks; for (const QString &id : m_helpIds) { - m_helpLinks = Core::HelpManager::linksForIdentifier(id); - if (!m_helpLinks->isEmpty()) + helpLinks = Core::HelpManager::linksForIdentifier(id); + if (!helpLinks.isEmpty()) { + m_keyword = id; break; + } + } + if (helpLinks.isEmpty()) { // perform keyword lookup as well as a fallback + for (const QString &id : m_helpIds) { + helpLinks = Core::HelpManager::linksForKeyword(id); + if (!helpLinks.isEmpty()) { + m_keyword = id; + m_isFuzzyMatch = true; + break; + } + } + } + QMapIterator it(helpLinks); + while (it.hasNext()) { + it.next(); + m_helpLinks->emplace_back(it.key(), it.value()); } } + Utils::sort(*m_helpLinks, linkLessThan); } return *m_helpLinks; } -static QUrl findBestLink(const QMap &links) +static const HelpItem::Links getBestLinks(const HelpItem::Links &links) { - if (links.isEmpty()) - return QUrl(); - if (links.size() == 1) - return links.first(); - QUrl source = links.first(); - // workaround to show the latest Qt version - int version = 0; - QRegExp exp("(\\d+)"); - foreach (const QUrl &link, links) { - const QString &authority = link.authority(); - if (authority.startsWith("com.trolltech.") - || authority.startsWith("org.qt-project.")) { - if (exp.indexIn(authority) >= 0) { - const int tmpVersion = exp.cap(1).toInt(); - if (tmpVersion > version) { - source = link; - version = tmpVersion; - } - } + // extract the highest version (== first) link of each individual topic + HelpItem::Links bestLinks; + QUrl currentUnversionedUrl; + for (const HelpItem::Link &link : links) { + const QUrl unversionedUrl = extractVersion(link.second).first; + if (unversionedUrl != currentUnversionedUrl) { + currentUnversionedUrl = unversionedUrl; + bestLinks.push_back(link); } } - return source; + return bestLinks; } -const QUrl HelpItem::bestLink() const +static const HelpItem::Links getBestLink(const HelpItem::Links &links) { - return findBestLink(links()); + if (links.empty()) + return {}; + // Extract single link with highest version, from all topics. + // This is to ensure that if we succeeded with an ID lookup, and we have e.g. Qt5 and Qt4 + // documentation, that we only return the Qt5 link even though the Qt5 and Qt4 URLs look + // different. + int highestVersion = -1; + HelpItem::Link bestLink; + for (const HelpItem::Link &link : links) { + const int version = extractVersion(link.second).second; + if (version > highestVersion) { + highestVersion = version; + bestLink = link; + } + } + return {bestLink}; +} + +const HelpItem::Links HelpItem::bestLinks() const +{ + if (m_isFuzzyMatch) + return getBestLinks(links()); + return getBestLink(links()); +} + +const QString HelpItem::keyword() const +{ + return m_keyword; } diff --git a/src/plugins/coreplugin/helpitem.h b/src/plugins/coreplugin/helpitem.h index 5468659b2a4..4d9ab153fb8 100644 --- a/src/plugins/coreplugin/helpitem.h +++ b/src/plugins/coreplugin/helpitem.h @@ -29,16 +29,20 @@ #include -#include #include #include #include +#include + namespace Core { class CORE_EXPORT HelpItem { public: + using Link = std::pair; + using Links = std::vector; + enum Category { ClassOrNamespace, Enum, @@ -77,15 +81,18 @@ public: QString extractContent(bool extended) const; - const QMap &links() const; - const QUrl bestLink() const; + const Links &links() const; + const Links bestLinks() const; + const QString keyword() const; private: QUrl m_helpUrl; QStringList m_helpIds; QString m_docMark; Category m_category = Unknown; - mutable Utils::optional> m_helpLinks; // cached help links + mutable Utils::optional m_helpLinks; // cached help links + mutable QString m_keyword; + mutable bool m_isFuzzyMatch = false; }; } // namespace Core diff --git a/src/plugins/coreplugin/helpmanager.cpp b/src/plugins/coreplugin/helpmanager.cpp index 68c976fbfa0..20c6adf83b7 100644 --- a/src/plugins/coreplugin/helpmanager.cpp +++ b/src/plugins/coreplugin/helpmanager.cpp @@ -91,6 +91,11 @@ QMap linksForIdentifier(const QString &id) return checkInstance() ? m_instance->linksForIdentifier(id) : QMap(); } +QMap linksForKeyword(const QString &keyword) +{ + return checkInstance() ? m_instance->linksForKeyword(keyword) : QMap(); +} + QByteArray fileData(const QUrl &url) { return checkInstance() ? m_instance->fileData(url) : QByteArray(); diff --git a/src/plugins/coreplugin/helpmanager.h b/src/plugins/coreplugin/helpmanager.h index 00273365049..4f4484c65db 100644 --- a/src/plugins/coreplugin/helpmanager.h +++ b/src/plugins/coreplugin/helpmanager.h @@ -64,6 +64,7 @@ CORE_EXPORT void registerDocumentation(const QStringList &fileNames); CORE_EXPORT void unregisterDocumentation(const QStringList &nameSpaces); CORE_EXPORT QMap linksForIdentifier(const QString &id); +CORE_EXPORT QMap linksForKeyword(const QString &id); CORE_EXPORT QByteArray fileData(const QUrl &url); CORE_EXPORT void showHelpUrl(const QUrl &url, HelpViewerLocation location = HelpModeAlways); diff --git a/src/plugins/coreplugin/helpmanager_implementation.h b/src/plugins/coreplugin/helpmanager_implementation.h index 47afa96f348..6c160c7ce3f 100644 --- a/src/plugins/coreplugin/helpmanager_implementation.h +++ b/src/plugins/coreplugin/helpmanager_implementation.h @@ -41,6 +41,7 @@ public: virtual void registerDocumentation(const QStringList &fileNames) = 0; virtual void unregisterDocumentation(const QStringList &nameSpaces) = 0; virtual QMap linksForIdentifier(const QString &id) = 0; + virtual QMap linksForKeyword(const QString &keyword) = 0; virtual QByteArray fileData(const QUrl &url) = 0; virtual void showHelpUrl(const QUrl &url, HelpViewerLocation location = HelpModeAlways) = 0; }; diff --git a/src/plugins/help/helpindexfilter.cpp b/src/plugins/help/helpindexfilter.cpp index e205359cf4d..42467934b79 100644 --- a/src/plugins/help/helpindexfilter.cpp +++ b/src/plugins/help/helpindexfilter.cpp @@ -141,7 +141,7 @@ void HelpIndexFilter::accept(LocatorFilterEntry selection, Q_UNUSED(selectionStart) Q_UNUSED(selectionLength) const QString &key = selection.displayName; - const QMap &links = HelpManager::linksForKeyword(key); + const QMap &links = HelpManager::instance()->linksForKeyword(key); emit linksActivated(links, key); } diff --git a/src/plugins/help/helpmanager.h b/src/plugins/help/helpmanager.h index 825a27d0467..3a65b0f33dc 100644 --- a/src/plugins/help/helpmanager.h +++ b/src/plugins/help/helpmanager.h @@ -54,8 +54,8 @@ public: static void registerUserDocumentation(const QStringList &filePaths); static QSet userDocumentationPaths(); - static QMap linksForKeyword(const QString &key); QMap linksForIdentifier(const QString &id) override; + QMap linksForKeyword(const QString &key) override; static QUrl findFile(const QUrl &url); QByteArray fileData(const QUrl &url) override; diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index ada46f3b3ec..7703541670e 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -44,6 +44,7 @@ #include "searchwidget.h" #include "searchtaskhandler.h" #include "textbrowserhelpviewer.h" +#include "topicchooser.h" #ifdef QTC_MAC_NATIVE_HELPVIEWER #include "macwebkithelpviewer.h" @@ -636,8 +637,8 @@ void HelpPluginPrivate::requestContextHelp() void HelpPluginPrivate::showContextHelp(const HelpItem &contextHelp) { - const QUrl source = contextHelp.bestLink(); - if (!source.isValid()) { + const HelpItem::Links links = contextHelp.bestLinks(); + if (links.empty()) { // No link found or no context object HelpViewer *viewer = showHelpUrl(QUrl(Help::Constants::AboutBlank), LocalHelpManager::contextHelpOption()); @@ -653,8 +654,19 @@ void HelpPluginPrivate::showContextHelp(const HelpItem &contextHelp) .arg(contextHelp.helpIds().join(", ")) .arg(HelpPlugin::tr("No documentation available."))); } + } else if (links.size() == 1) { + showHelpUrl(links.front().second, LocalHelpManager::contextHelpOption()); } else { - showHelpUrl(source, LocalHelpManager::contextHelpOption()); + QMap map; + for (const HelpItem::Link &link : links) + map.insert(link.first, link.second); + auto tc = new TopicChooser(ICore::dialogParent(), contextHelp.keyword(), map); + tc->setModal(true); + connect(tc, &QDialog::accepted, this, [this, tc] { + showHelpUrl(tc->link(), LocalHelpManager::contextHelpOption()); + }); + connect(tc, &QDialog::finished, tc, [tc] { tc->deleteLater(); }); + tc->show(); } } diff --git a/src/plugins/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp index 53b3422c80e..6479ba13ad1 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.cpp +++ b/src/plugins/qmljseditor/qmljshoverhandler.cpp @@ -147,7 +147,6 @@ bool QmlJSHoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Docum { QString moduleName = getModuleName(scopeChain, qmlDocument, value); - QString helpId; QStringList helpIdCandidates; QStringList helpIdPieces(qName); @@ -168,7 +167,7 @@ bool QmlJSHoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Docum helpIdCandidates += helpIdPieces.join('.'); const HelpItem helpItem(helpIdCandidates, qName.join('.'), HelpItem::QmlComponent); - const QMap urlMap = helpItem.links(); + const HelpItem::Links links = helpItem.links(); // Check if the module name contains a major version. QRegularExpression version("^([^\\d]*)(\\d+)\\.*\\d*$"); @@ -176,10 +175,10 @@ bool QmlJSHoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Docum if (m.hasMatch()) { QMap filteredUrlMap; QStringRef maj = m.capturedRef(2); - for (auto x = urlMap.begin(); x != urlMap.end(); ++x) { - QString urlModuleName = x.value().path().split('/')[1]; + for (const HelpItem::Link &link : links) { + QString urlModuleName = link.second.path().split('/')[1]; if (urlModuleName.contains(maj)) - filteredUrlMap.insert(x.key(), x.value()); + filteredUrlMap.insert(link.first, link.second); } if (!filteredUrlMap.isEmpty()) { // Use the URL, to disambiguate different versions From b71a6eec20ffca672e6b43f9eea78fd694cc3c7f Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Sat, 9 Feb 2019 07:12:06 +0100 Subject: [PATCH 09/13] ExternalToolConfig: Fix choosing executable Somehow the function to select the executable broke and changed to "Choose Directory". Fixes: QTCREATORBUG-21937 Change-Id: Ifc596df276a3e26bb063d5b856fca29f9db227df Reviewed-by: Orgad Shaneh Reviewed-by: Eike Ziller --- src/plugins/coreplugin/dialogs/externaltoolconfig.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp index 9b17d200032..9be71177294 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp @@ -402,6 +402,7 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) : m_model(new ExternalToolModel(this)) { ui->setupUi(this); + ui->executable->setExpectedKind(Utils::PathChooser::ExistingCommand); ui->scrollArea->viewport()->setAutoFillBackground(false); ui->scrollAreaWidgetContents->setAutoFillBackground(false); ui->toolTree->setModel(m_model); From e50cab50b914e7202a174f7ea5abab29fc40fcac Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Fri, 8 Feb 2019 18:14:13 +0100 Subject: [PATCH 10/13] ProjectExplorer: Remove ellipsis from Duplicate File This action does not open a dialog, it only duplicates the current file and adds it to the project. Change-Id: I9a7ba23b7168622656659ccb28a8a41b0dc7ddac Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/projectexplorer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 47164b48821..7caef6e4b37 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1176,7 +1176,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER); // duplicate file action - dd->m_duplicateFileAction = new QAction(tr("Duplicate File..."), this); + dd->m_duplicateFileAction = new QAction(tr("Duplicate File"), this); cmd = ActionManager::registerAction(dd->m_duplicateFileAction, Constants::DUPLICATEFILE, projecTreeContext); mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER); From 77392c7dea8ed5fb41618b05abb9e2ec7ba5a5c0 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Mon, 24 Apr 2017 18:01:57 +0200 Subject: [PATCH 11/13] ProWriter: constify local vars Change-Id: I4742edd3f449020c9f9be30401a9ae92f2bb81b3 Reviewed-by: Christian Kandeler --- src/shared/proparser/prowriter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shared/proparser/prowriter.cpp b/src/shared/proparser/prowriter.cpp index 3ca7220621d..5038d9652ad 100644 --- a/src/shared/proparser/prowriter.cpp +++ b/src/shared/proparser/prowriter.cpp @@ -179,7 +179,7 @@ QString ProWriter::compileScope(const QString &scope) ProFile *includeFile = parser.parsedProBlock(QStringRef(&scope), 0, QLatin1String("no-file"), 1); if (!includeFile) return QString(); - QString result = includeFile->items(); + const QString result = includeFile->items(); includeFile->deref(); return result.mid(2); // chop of TokLine + linenumber } @@ -307,7 +307,7 @@ void ProWriter::putVarValues(ProFile *profile, QStringList *lines, const QString const QString &var, PutFlags flags, const QString &scope, const QString &continuationIndent) { - QString indent = scope.isEmpty() ? QString() : continuationIndent; + const QString indent = scope.isEmpty() ? QString() : continuationIndent; const auto effectiveContIndent = [indent, continuationIndent](const ContinuationInfo &ci) { return !ci.indent.isEmpty() ? ci.indent : continuationIndent + indent; }; @@ -576,8 +576,8 @@ QStringList ProWriter::removeFiles(ProFile *profile, QStringList *lines, // maybe those files can be found via $$PWD/relativeToPriFile valuesToFind.clear(); - QDir baseDir = QFileInfo(profile->fileName()).absoluteDir(); - QString prefixPwd = QLatin1String("$$PWD/"); + const QDir baseDir = QFileInfo(profile->fileName()).absoluteDir(); + const QString prefixPwd = QLatin1String("$$PWD/"); foreach (const QString &absoluteFilePath, notYetChanged) valuesToFind << (prefixPwd + baseDir.relativeFilePath(absoluteFilePath)); From 963dc84cc5d1e412344e3a0fbf4a476541da2d19 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 11 Feb 2019 10:17:53 +0100 Subject: [PATCH 12/13] Fix some deprecation warnings in basic plugins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix warnings apppearing in 5.13, for example: warning: ‘QDir& QDir::operator=(const QString&)’ is deprecated: Use QDir::setPath() instead [-Wdeprecated-declarations] ... warning: ‘static QRgb QColorDialog::getRgba(QRgb, bool*, QWidget*)’ is deprecated: Use getColor() [-Wdeprecated-declarations] warning: ‘Qt::DropAction QDrag::start(Qt::DropActions)’ is deprecated: Use QDrag::exec() instead [-Wdeprecated-declarations] warning: ‘void QProcess::finished(int)’ is deprecated: Use QProcess::finished(int, QProcess::ExitStatus) instead [-Wdeprecated-declarations] ... warning: ‘const QRect QDesktopWidget::availableGeometry(int) const’ is deprecated: Use QGuiApplication::screens() [-Wdeprecated-declarations] ... warning: ‘const QBrush& QPalette::background() const’ is deprecated: Use QPalette::window() instead [-Wdeprecated-declarations] ... warning: ‘const QBrush& QPalette::foreground() const’ is deprecated: Use QPalette::windowText() instead [-Wdeprecated-declarations] ... warning: ‘void QTextOption::setTabStop(qreal)’ is deprecated [-Wdeprecated-declarations] warning: ‘void QList::swap(int, int) [with T = ProjectExplorer::BuildStep*]’ is deprecated: Use QList::swapItemsAt() [-Wdeprecated-declarations] warning: ‘void QProcess::setReadChannelMode(QProcess::ProcessChannelMode)’ is deprecated: Use QProcess::setProcessChannelMode() instead [-Wdeprecated-declarations] ... warning: ‘QString QFileInfo::readLink() const’ is deprecated: Use QFileInfo::symLinkTarget() instead [-Wdeprecated-declarations] Change-Id: I1d893d42d372245892f2de8406f52dbe7bbd552a Reviewed-by: Eike Ziller --- src/libs/qmljs/qmljsplugindumper.cpp | 2 +- src/libs/ssh/sftpsession.cpp | 2 +- src/libs/ssh/sftptransfer.cpp | 2 +- src/libs/ssh/sshconnection.cpp | 2 +- src/libs/utils/crumblepath.cpp | 2 +- src/libs/utils/fileutils.cpp | 2 +- src/libs/utils/qtcolorbutton.cpp | 20 ++++++------------- src/libs/utils/stylehelper.cpp | 10 +++++----- src/plugins/bookmarks/bookmarkmanager.cpp | 4 ++-- .../clangdiagnostictooltipwidget.cpp | 5 ++++- .../coreplugin/dialogs/shortcutsettings.cpp | 2 +- src/plugins/cppcheck/cppcheckrunner.cpp | 2 +- src/plugins/debugger/cdb/cdbengine.cpp | 2 +- src/plugins/debugger/debuggerruncontrol.cpp | 4 ++-- .../debugger/debuggertooltipmanager.cpp | 6 +++++- .../diffeditor/sidebysidediffeditorwidget.cpp | 2 +- src/plugins/git/changeselectiondialog.cpp | 2 +- src/plugins/git/gitclient.cpp | 2 +- src/plugins/git/mergetool.cpp | 5 +++-- .../projectexplorer/applicationlauncher.cpp | 4 ++-- src/plugins/projectexplorer/buildsteplist.cpp | 2 +- .../devicesupport/desktopdeviceprocess.cpp | 2 +- src/plugins/projectexplorer/taskwindow.cpp | 4 ++-- .../librarydetailscontroller.cpp | 2 +- src/plugins/qtsupport/baseqtversion.cpp | 2 +- .../codeassist/functionhintproposalwidget.cpp | 6 ++++-- src/plugins/texteditor/fontsettingspage.cpp | 10 +++++----- src/plugins/texteditor/texteditor.cpp | 6 +++--- .../valgrind/callgrindvisualisation.cpp | 2 +- 29 files changed, 60 insertions(+), 58 deletions(-) diff --git a/src/libs/qmljs/qmljsplugindumper.cpp b/src/libs/qmljs/qmljsplugindumper.cpp index fbfe22174ef..aeef89372fc 100644 --- a/src/libs/qmljs/qmljsplugindumper.cpp +++ b/src/libs/qmljs/qmljsplugindumper.cpp @@ -482,7 +482,7 @@ void PluginDumper::runQmlDump(const QmlJS::ModelManagerInterface::ProjectInfo &i process->setEnvironment(info.qmlDumpEnvironment.toStringList()); QString workingDir = wd.canonicalPath(); process->setWorkingDirectory(workingDir); - connect(process, static_cast(&QProcess::finished), + connect(process, QOverload::of(&QProcess::finished), this, &PluginDumper::qmlPluginTypeDumpDone); connect(process, &QProcess::errorOccurred, this, &PluginDumper::qmlPluginTypeDumpError); process->start(info.qmlDumpPath, arguments); diff --git a/src/libs/ssh/sftpsession.cpp b/src/libs/ssh/sftpsession.cpp index 91379324aab..0119bea2660 100644 --- a/src/libs/ssh/sftpsession.cpp +++ b/src/libs/ssh/sftpsession.cpp @@ -119,7 +119,7 @@ SftpSession::SftpSession(const QStringList &connectionArgs) : d(new SftpSessionP emit done(tr("sftp failed to start: %1").arg(d->sftpProc.errorString())); } }); - connect(&d->sftpProc, static_cast(&QProcess::finished), [this] { + connect(&d->sftpProc, QOverload::of(&QProcess::finished), [this] { d->state = State::Inactive; if (d->sftpProc.exitStatus() != QProcess::NormalExit) { emit done(tr("sftp crashed.")); diff --git a/src/libs/ssh/sftptransfer.cpp b/src/libs/ssh/sftptransfer.cpp index 4ba823a6eb4..57674cc94dd 100644 --- a/src/libs/ssh/sftptransfer.cpp +++ b/src/libs/ssh/sftptransfer.cpp @@ -114,7 +114,7 @@ SftpTransfer::SftpTransfer(const FilesToTransfer &files, Internal::FileTransferT if (error == QProcess::FailedToStart) emitError(tr("sftp failed to start: %1").arg(d->sftpProc.errorString())); }); - connect(&d->sftpProc, static_cast(&QProcess::finished), [this] { + connect(&d->sftpProc, QOverload::of(&QProcess::finished), [this] { if (d->sftpProc.exitStatus() != QProcess::NormalExit) { emitError(tr("sftp crashed.")); return; diff --git a/src/libs/ssh/sshconnection.cpp b/src/libs/ssh/sshconnection.cpp index 52db107dc93..fe207235ecd 100644 --- a/src/libs/ssh/sshconnection.cpp +++ b/src/libs/ssh/sshconnection.cpp @@ -202,7 +202,7 @@ SshConnection::SshConnection(const SshConnectionParameters &serverInfo, QObject break; // Cannot happen. } }); - connect(&d->masterProcess, static_cast(&QProcess::finished), [this] { + connect(&d->masterProcess, QOverload::of(&QProcess::finished), [this] { if (d->state == Disconnecting) { emitDisconnected(); return; diff --git a/src/libs/utils/crumblepath.cpp b/src/libs/utils/crumblepath.cpp index ad8c81ef0a2..f8f027d7f70 100644 --- a/src/libs/utils/crumblepath.cpp +++ b/src/libs/utils/crumblepath.cpp @@ -93,7 +93,7 @@ static QPixmap segmentPixmap(CrumblePathButton::SegmentType type, QStyle::State const QString pixmapKey = QStringLiteral("crumblePath-segment-%1-iconMode-%2-hover-%3") .arg(segmentName).arg(iconMode).arg(hover); QPixmap pixmap; - if (!QPixmapCache::find(pixmapKey, pixmap)) { + if (!QPixmapCache::find(pixmapKey, &pixmap)) { const QString maskFileName = QStringLiteral(":/utils/images/crumblepath-segment-%1%2.png") .arg(segmentName).arg(QLatin1String(hover ? "-hover" : "")); pixmap = Icon({{maskFileName, Theme::IconsBaseColor}}).pixmap(iconMode); diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index 5d20b7b8cc1..708595aa4d8 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -82,7 +82,7 @@ bool FileUtils::removeRecursively(const FileName &filePath, QString *error) QFile::setPermissions(filePath.toString(), fileInfo.permissions() | QFile::WriteUser); if (fileInfo.isDir()) { QDir dir(filePath.toString()); - dir = dir.canonicalPath(); + dir.setPath(dir.canonicalPath()); if (dir.isRoot()) { if (error) { *error = QCoreApplication::translate("Utils::FileUtils", diff --git a/src/libs/utils/qtcolorbutton.cpp b/src/libs/utils/qtcolorbutton.cpp index 5463f96ddab..4acac27ea84 100644 --- a/src/libs/utils/qtcolorbutton.cpp +++ b/src/libs/utils/qtcolorbutton.cpp @@ -58,19 +58,11 @@ public: void QtColorButtonPrivate::slotEditColor() { - QColor newColor; - if (m_alphaAllowed) { - bool ok; - const QRgb rgba = QColorDialog::getRgba(m_color.rgba(), &ok, q_ptr); - if (!ok) - return; - newColor = QColor::fromRgba(rgba); - } else { - newColor = QColorDialog::getColor(m_color, q_ptr); - if (!newColor.isValid()) - return; - } - if (newColor == q_ptr->color()) + QColorDialog::ColorDialogOptions options; + if (m_alphaAllowed) + options |= QColorDialog::ShowAlphaChannel; + const QColor newColor = QColorDialog::getColor(m_color, q_ptr, QString(), options); + if (!newColor.isValid() || newColor == q_ptr->color()) return; q_ptr->setColor(newColor); emit q_ptr->colorChanged(m_color); @@ -243,7 +235,7 @@ void QtColorButton::mouseMoveEvent(QMouseEvent *event) drg->setPixmap(d_ptr->generatePixmap()); setDown(false); event->accept(); - drg->start(); + drg->exec(Qt::CopyAction); return; } #endif diff --git a/src/libs/utils/stylehelper.cpp b/src/libs/utils/stylehelper.cpp index 628e062b3e1..e44037f5a1a 100644 --- a/src/libs/utils/stylehelper.cpp +++ b/src/libs/utils/stylehelper.cpp @@ -216,7 +216,7 @@ void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, con clipRect.height(), keyColor.rgb()); QPixmap pixmap; - if (!QPixmapCache::find(key, pixmap)) { + if (!QPixmapCache::find(key, &pixmap)) { pixmap = QPixmap(clipRect.size()); QPainter p(&pixmap); QRect rect(0, 0, clipRect.width(), clipRect.height()); @@ -274,7 +274,7 @@ void StyleHelper::horizontalGradient(QPainter *painter, const QRect &spanRect, c clipRect.height(), keyColor.rgb(), spanRect.x()); QPixmap pixmap; - if (!QPixmapCache::find(key, pixmap)) { + if (!QPixmapCache::find(key, &pixmap)) { pixmap = QPixmap(clipRect.size()); QPainter p(&pixmap); QRect rect = QRect(0, 0, clipRect.width(), clipRect.height()); @@ -312,7 +312,7 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter, QString pixmapName; pixmapName.sprintf("StyleHelper::drawArrow-%d-%d-%d-%f", element, size, enabled, devicePixelRatio); - if (!QPixmapCache::find(pixmapName, pixmap)) { + if (!QPixmapCache::find(pixmapName, &pixmap)) { QImage image(size * devicePixelRatio, size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied); image.fill(Qt::transparent); QPainter painter(&image); @@ -357,7 +357,7 @@ void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const Q clipRect.height(), StyleHelper::baseColor().rgb()); QPixmap pixmap; - if (!QPixmapCache::find(key, pixmap)) { + if (!QPixmapCache::find(key, &pixmap)) { pixmap = QPixmap(clipRect.size()); QPainter p(&pixmap); QRect rect = QRect(0, 0, clipRect.width(), clipRect.height()); @@ -396,7 +396,7 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect, QString pixmapName = QString::fromLatin1("icon %0 %1 %2 %3") .arg(icon.cacheKey()).arg(iconMode).arg(rect.height()).arg(devicePixelRatio); - if (!QPixmapCache::find(pixmapName, cache)) { + if (!QPixmapCache::find(pixmapName, &cache)) { // High-dpi support: The in parameters (rect, radius, offset) are in // device-independent pixels. The call to QIcon::pixmap() below might // return a high-dpi pixmap, which will in that case have a devicePixelRatio diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index 76e31efeefd..c3b061a05b7 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -132,8 +132,8 @@ void BookmarkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti if (!m_selectedPixmap) generateGradientPixmap(lwidth, fm.height()+1, backgroundColor, selected); } else { - painter->setBrush(opt.palette.background().color()); - backgroundColor = opt.palette.background().color(); + backgroundColor = opt.palette.window().color(); + painter->setBrush(backgroundColor); if (!m_normalPixmap) generateGradientPixmap(lwidth, fm.height(), backgroundColor, selected); } diff --git a/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp b/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp index 5f85a2e2263..8a9268ba3cb 100644 --- a/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp +++ b/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp @@ -385,7 +385,10 @@ private: static int widthLimit() { - return QApplication::desktop()->availableGeometry(QCursor::pos()).width() / 2; + auto screen = QGuiApplication::screenAt(QCursor::pos()); + if (!screen) + screen = QGuiApplication::primaryScreen(); + return screen->availableGeometry().width() / 2; } private: diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp index 16c5676e7e5..191de4a4121 100644 --- a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp +++ b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp @@ -552,7 +552,7 @@ bool ShortcutSettingsWidget::markCollisions(ShortcutItem *item) } item->m_item->setForeground(2, hasCollision ? Utils::creatorTheme()->color(Utils::Theme::TextColorError) - : commandList()->palette().foreground()); + : commandList()->palette().window()); return hasCollision; } diff --git a/src/plugins/cppcheck/cppcheckrunner.cpp b/src/plugins/cppcheck/cppcheckrunner.cpp index c7472588386..f67044cb678 100644 --- a/src/plugins/cppcheck/cppcheckrunner.cpp +++ b/src/plugins/cppcheck/cppcheckrunner.cpp @@ -53,7 +53,7 @@ CppcheckRunner::CppcheckRunner(CppcheckTool &tool) : this, &CppcheckRunner::readError); connect(m_process, &QProcess::started, this, &CppcheckRunner::handleStarted); - connect(m_process, QOverload::of(&QProcess::finished), + connect(m_process, QOverload::of(&QProcess::finished), this, &CppcheckRunner::handleFinished); m_queueTimer.setSingleShot(true); diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 28fa1bcf9ae..5e62bf5bb6d 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -203,7 +203,7 @@ CdbEngine::CdbEngine() : connect(action(CreateFullBacktrace), &QAction::triggered, this, &CdbEngine::createFullBacktrace); - connect(&m_process, static_cast(&QProcess::finished), + connect(&m_process, static_cast(&QProcess::finished), this, &CdbEngine::processFinished); connect(&m_process, &QProcess::errorOccurred, this, &CdbEngine::processError); connect(&m_process, &QProcess::readyReadStandardOutput, diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index c08e5ea471e..a664d30c406 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -105,7 +105,7 @@ public: this, &LocalProcessRunner::handleStandardOutput); connect(&m_proc, &QProcess::readyReadStandardError, this, &LocalProcessRunner::handleStandardError); - connect(&m_proc, static_cast(&QProcess::finished), + connect(&m_proc, QOverload::of(&QProcess::finished), this, &LocalProcessRunner::handleFinished); } @@ -213,7 +213,7 @@ private: } m_coreUnpackProcess.setWorkingDirectory(TemporaryDirectory::masterDirectoryPath()); - connect(&m_coreUnpackProcess, static_cast(&QProcess::finished), + connect(&m_coreUnpackProcess, QOverload::of(&QProcess::finished), this, &CoreUnpacker::reportStarted); const QString msg = DebuggerRunTool::tr("Unpacking core file to %1"); diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp index 9aba76fa88f..2f8cef1d243 100644 --- a/src/plugins/debugger/debuggertooltipmanager.cpp +++ b/src/plugins/debugger/debuggertooltipmanager.cpp @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include @@ -624,7 +625,10 @@ void DebuggerToolTipWidget::computeSize() // touch the border of the screen. QPoint pos(x(), y()); QTC_ASSERT(QApplication::desktop(), return); - QRect desktopRect = QApplication::desktop()->availableGeometry(pos); + auto screen = QGuiApplication::screenAt(pos); + if (!screen) + screen = QGuiApplication::primaryScreen(); + QRect desktopRect = screen->availableGeometry(); const int maxWidth = desktopRect.right() - pos.x() - 5 - 5; const int maxHeight = desktopRect.bottom() - pos.y() - 5 - 5; diff --git a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp index 3e9a72050b3..0975273ee26 100644 --- a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp +++ b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp @@ -396,7 +396,7 @@ void SideDiffEditorWidget::paintSeparator(QPainter &painter, if (!foreground.isValid()) foreground = m_textForeground; if (!foreground.isValid()) - foreground = palette().foreground().color(); + foreground = palette().windowText().color(); painter.setPen(foreground); diff --git a/src/plugins/git/changeselectiondialog.cpp b/src/plugins/git/changeselectiondialog.cpp index 5a46b2cbbf8..48f4cf9ccfd 100644 --- a/src/plugins/git/changeselectiondialog.cpp +++ b/src/plugins/git/changeselectiondialog.cpp @@ -248,7 +248,7 @@ void ChangeSelectionDialog::recalculateDetails() m_process->setWorkingDirectory(workingDir); m_process->setProcessEnvironment(m_gitEnvironment); - connect(m_process, static_cast(&QProcess::finished), + connect(m_process, QOverload::of(&QProcess::finished), this, &ChangeSelectionDialog::setDetails); m_process->start(m_gitExecutable.toString(), {"show", "--decorate", "--stat=80", ref}); diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 0a55e0b56dc..d28c6bb2630 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2386,7 +2386,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env, process->start(binary, arguments); success = process->waitForStarted(); if (success) - connect(process, static_cast(&QProcess::finished), + connect(process, QOverload::of(&QProcess::finished), process, &QProcess::deleteLater); else delete process; diff --git a/src/plugins/git/mergetool.cpp b/src/plugins/git/mergetool.cpp index f0f03e4ffc2..c1fd1ec2df6 100644 --- a/src/plugins/git/mergetool.cpp +++ b/src/plugins/git/mergetool.cpp @@ -60,12 +60,13 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files) m_process = new QProcess(this); m_process->setWorkingDirectory(workingDirectory); m_process->setProcessEnvironment(env); - m_process->setReadChannelMode(QProcess::MergedChannels); + m_process->setProcessChannelMode(QProcess::MergedChannels); const Utils::FileName binary = GitPlugin::client()->vcsBinary(); VcsOutputWindow::appendCommand(workingDirectory, binary, arguments); m_process->start(binary.toString(), arguments); if (m_process->waitForStarted()) { - connect(m_process, static_cast(&QProcess::finished), this, &MergeTool::done); + connect(m_process, QOverload::of(&QProcess::finished), + this, &MergeTool::done); connect(m_process, &QIODevice::readyRead, this, &MergeTool::readData); } else { delete m_process; diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp index 61a2fcb3350..3aef28f0903 100644 --- a/src/plugins/projectexplorer/applicationlauncher.cpp +++ b/src/plugins/projectexplorer/applicationlauncher.cpp @@ -127,9 +127,9 @@ ApplicationLauncherPrivate::ApplicationLauncherPrivate(ApplicationLauncher *pare : q(parent), m_outputCodec(QTextCodec::codecForLocale()) { if (ProjectExplorerPlugin::projectExplorerSettings().mergeStdErrAndStdOut){ - m_guiProcess.setReadChannelMode(QProcess::MergedChannels); + m_guiProcess.setProcessChannelMode(QProcess::MergedChannels); } else { - m_guiProcess.setReadChannelMode(QProcess::SeparateChannels); + m_guiProcess.setProcessChannelMode(QProcess::SeparateChannels); connect(&m_guiProcess, &QProcess::readyReadStandardError, this, &ApplicationLauncherPrivate::readLocalStandardError); } diff --git a/src/plugins/projectexplorer/buildsteplist.cpp b/src/plugins/projectexplorer/buildsteplist.cpp index dab8d70311a..2734f4139d7 100644 --- a/src/plugins/projectexplorer/buildsteplist.cpp +++ b/src/plugins/projectexplorer/buildsteplist.cpp @@ -185,7 +185,7 @@ bool BuildStepList::removeStep(int position) void BuildStepList::moveStepUp(int position) { - m_steps.swap(position - 1, position); + m_steps.swapItemsAt(position - 1, position); emit stepMoved(position, position - 1); } diff --git a/src/plugins/projectexplorer/devicesupport/desktopdeviceprocess.cpp b/src/plugins/projectexplorer/devicesupport/desktopdeviceprocess.cpp index e87c2ed4f4d..d57b765bb0a 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdeviceprocess.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdeviceprocess.cpp @@ -40,7 +40,7 @@ DesktopDeviceProcess::DesktopDeviceProcess(const QSharedPointer & : DeviceProcess(device, parent) { connect(&m_process, &QProcess::errorOccurred, this, &DeviceProcess::error); - connect(&m_process, static_cast(&QProcess::finished), + connect(&m_process, QOverload::of(&QProcess::finished), this, &DeviceProcess::finished); connect(&m_process, &QProcess::readyReadStandardOutput, this, &DeviceProcess::readyReadStandardOutput); diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index 9c9ca6e832d..7d8010aa270 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -758,8 +758,8 @@ void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, painter->setBrush(opt.palette.highlight().color()); backgroundColor = opt.palette.highlight().color(); } else { - painter->setBrush(opt.palette.background().color()); - backgroundColor = opt.palette.background().color(); + painter->setBrush(opt.palette.window().color()); + backgroundColor = opt.palette.window().color(); } painter->setPen(Qt::NoPen); painter->drawRect(opt.rect); diff --git a/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp b/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp index 0f0830b58eb..1d3509f8130 100644 --- a/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp +++ b/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp @@ -1098,7 +1098,7 @@ QString InternalLibraryDetailsController::snippet() const QDir rootBuildDir = rootDir; // If the project is unconfigured use the project dir if (ProjectExplorer::Target *t = project->activeTarget()) if (ProjectExplorer::BuildConfiguration *bc = t->activeBuildConfiguration()) - rootBuildDir = bc->buildDirectory().toString(); + rootBuildDir.setPath(bc->buildDirectory().toString()); // the project for which we insert the snippet inside build tree QFileInfo pfi(rootBuildDir.filePath(proRelavitePath)); diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 0bfab886b57..3790005a7c7 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -1634,7 +1634,7 @@ FileName BaseQtVersion::mkspecFromVersionInfo(const QHash &ve } if (!qt5) { //resolve mkspec link - QString rspec = mkspecFullPath.toFileInfo().readLink(); + QString rspec = mkspecFullPath.toFileInfo().symLinkTarget(); if (!rspec.isEmpty()) mkspecFullPath = FileName::fromUserInput( QDir(baseMkspecDir.toString()).absoluteFilePath(rspec)); diff --git a/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp b/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp index d673df7e081..4e72e4449bd 100644 --- a/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp +++ b/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp @@ -40,6 +40,7 @@ #include #include #include +#include namespace TextEditor { @@ -366,9 +367,10 @@ void FunctionHintProposalWidget::updateContent() void FunctionHintProposalWidget::updatePosition() { const QDesktopWidget *desktop = QApplication::desktop(); + const int screenNumber = desktop->screenNumber(d->m_underlyingWidget); + auto widgetScreen = QGuiApplication::screens().value(screenNumber, QGuiApplication::primaryScreen()); const QRect &screen = Utils::HostOsInfo::isMacHost() - ? desktop->availableGeometry(desktop->screenNumber(d->m_underlyingWidget)) - : desktop->screenGeometry(desktop->screenNumber(d->m_underlyingWidget)); + ? widgetScreen->availableGeometry() : widgetScreen->geometry(); d->m_pager->setFixedWidth(d->m_pager->minimumSizeHint().width()); diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index e9c6920b929..1a6235789e2 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -254,16 +254,16 @@ QColor FormatDescription::defaultForeground(TextStyle id) { if (id == C_LINE_NUMBER) { const QPalette palette = Utils::Theme::initialPalette(); - const QColor bg = palette.background().color(); + const QColor bg = palette.window().color(); if (bg.value() < 128) - return palette.foreground().color(); + return palette.windowText().color(); else return palette.dark().color(); } else if (id == C_CURRENT_LINE_NUMBER) { const QPalette palette = Utils::Theme::initialPalette(); - const QColor bg = palette.background().color(); + const QColor bg = palette.window().color(); if (bg.value() < 128) - return palette.foreground().color(); + return palette.windowText().color(); else return QColor(); } else if (id == C_PARENTHESES) { @@ -279,7 +279,7 @@ QColor FormatDescription::defaultBackground(TextStyle id) if (id == C_TEXT) { return Qt::white; } else if (id == C_LINE_NUMBER) { - return Utils::Theme::initialPalette().background().color(); + return Utils::Theme::initialPalette().window().color(); } else if (id == C_SEARCH_RESULT) { return QColor(0xffef0b); } else if (id == C_PARENTHESES) { diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 247fd12352e..6cf1b701366 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -431,7 +431,7 @@ struct PaintEventData , searchResultFormat(fontSettings.toTextCharFormat(C_SEARCH_RESULT)) , visualWhitespaceFormat(fontSettings.toTextCharFormat(C_VISUAL_WHITESPACE)) , ifdefedOutFormat(fontSettings.toTextCharFormat(C_DISABLED_CODE)) - , suppressSyntaxInIfdefedOutBlock(ifdefedOutFormat.foreground() != editor->palette().foreground()) + , suppressSyntaxInIfdefedOutBlock(ifdefedOutFormat.foreground() != editor->palette().windowText()) { } QPointF offset; const QRect viewportRect; @@ -4719,7 +4719,7 @@ void TextEditorWidgetPrivate::paintWidgetBackground(const PaintEventData &data, && (q->centerOnScroll() || q->verticalScrollBar()->maximum() == q->verticalScrollBar()->minimum())) { const QRect backGroundRect(QPoint(data.eventRect.left(), int(data.offset.y())), data.eventRect.bottomRight()); - painter.fillRect(backGroundRect, q->palette().background()); + painter.fillRect(backGroundRect, q->palette().window()); } } @@ -8236,7 +8236,7 @@ void TextEditorWidgetPrivate::updateTabStops() // to be set as an int. A work around is to access directly the QTextOption. qreal charWidth = QFontMetricsF(q->font()).width(QLatin1Char(' ')); QTextOption option = q->document()->defaultTextOption(); - option.setTabStop(charWidth * m_document->tabSettings().m_tabSize); + option.setTabStopDistance(charWidth * m_document->tabSettings().m_tabSize); q->document()->setDefaultTextOption(option); } diff --git a/src/plugins/valgrind/callgrindvisualisation.cpp b/src/plugins/valgrind/callgrindvisualisation.cpp index 1f25206377a..b96bdd71b84 100644 --- a/src/plugins/valgrind/callgrindvisualisation.cpp +++ b/src/plugins/valgrind/callgrindvisualisation.cpp @@ -346,7 +346,7 @@ void Visualization::setText(const QString &message) d->m_scene.clear(); QGraphicsSimpleTextItem *textItem = d->m_scene.addSimpleText(message); - textItem->setBrush(palette().foreground()); + textItem->setBrush(palette().windowText()); textItem->setPos((d->sceneWidth() - textItem->boundingRect().width()) / 2, (d->sceneHeight() - textItem->boundingRect().height()) / 2); textItem->setFlag(QGraphicsItem::ItemIgnoresTransformations); From e7ab1182a08d606d4648e66ec647cd97323e8856 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 11 Feb 2019 10:40:36 +0100 Subject: [PATCH 13/13] clangdiagnostictooltipwidget.cpp: Fix compilation Add missing include. Amends 963dc84cc5d1e412344e3a0fbf4a476541da2d19. Change-Id: Ida93a63dbc8ad3155834901ac2cdf7186bc7deb2 Reviewed-by: Nikolai Kosjar --- src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp b/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp index 8a9268ba3cb..4811e1b5431 100644 --- a/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp +++ b/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include