diff options
author | Eike Ziller <eike.ziller@qt.io> | 2019-02-11 10:48:15 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2019-02-11 10:48:15 +0100 |
commit | 46c287fee5cea9a4f83c554e2162301a8a70ae5d (patch) | |
tree | 97d391b9deec1cb0225826b1f04d6b3c4d190b71 | |
parent | 46ddfb9badb5fdda97afe4e67667ad56e5d69f35 (diff) | |
parent | e7ab1182a08d606d4648e66ec647cd97323e8856 (diff) | |
download | qt-creator-46c287fee5cea9a4f83c554e2162301a8a70ae5d.tar.gz |
Merge remote-tracking branch 'origin/4.9'
Change-Id: I5e5536a7dbaa22e94a14d371917e62fcf92bf6dc
52 files changed, 280 insertions, 146 deletions
diff --git a/src/libs/languageserverprotocol/languagefeatures.cpp b/src/libs/languageserverprotocol/languagefeatures.cpp index 6672bbc2b8..06793217f1 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<Utils::variant<Command, CodeAction>>; if (val.isArray()) { - QJsonArray array = val.toArray(); + const QJsonArray array = val.toArray(); ResultArray result; for (const QJsonValue &val : array) { Command command(val); diff --git a/src/libs/qmljs/qmljsplugindumper.cpp b/src/libs/qmljs/qmljsplugindumper.cpp index fbfe22174e..aeef89372f 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<void (QProcess::*)(int)>(&QProcess::finished), + connect(process, QOverload<int, QProcess::ExitStatus>::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 91379324aa..0119bea266 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<void (QProcess::*)(int)>(&QProcess::finished), [this] { + connect(&d->sftpProc, QOverload<int, QProcess::ExitStatus>::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 4ba823a6eb..57674cc94d 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<void (QProcess::*)(int)>(&QProcess::finished), [this] { + connect(&d->sftpProc, QOverload<int, QProcess::ExitStatus>::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 52db107dc9..fe207235ec 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<void (QProcess::*)(int)>(&QProcess::finished), [this] { + connect(&d->masterProcess, QOverload<int, QProcess::ExitStatus>::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 ad8c81ef0a..f8f027d7f7 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 5d20b7b8cc..708595aa4d 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 5463f96dda..4acac27ea8 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 628e062b3e..e44037f5a1 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 76e31efeef..c3b061a05b 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 5f85a2e226..4811e1b543 100644 --- a/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp +++ b/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp @@ -40,6 +40,7 @@ #include <QFileInfo> #include <QHash> #include <QLabel> +#include <QScreen> #include <QTextDocument> #include <QUrl> @@ -385,7 +386,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/externaltoolconfig.cpp b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp index af23aaf688..62f7030c6d 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp @@ -27,33 +27,30 @@ #include "ui_externaltoolconfig.h" #include <utils/algorithm.h> +#include <utils/environment.h> +#include <utils/environmentdialog.h> +#include <utils/fancylineedit.h> #include <utils/hostosinfo.h> #include <utils/macroexpander.h> #include <utils/qtcassert.h> #include <utils/qtcprocess.h> -#include <utils/fancylineedit.h> -#include <utils/environment.h> -#include <utils/environmentdialog.h> #include <coreplugin/coreconstants.h> #include <coreplugin/variablechooser.h> #include <QDialogButtonBox> -#include <QTextStream> -#include <QMimeData> #include <QMenu> +#include <QMimeData> #include <QPlainTextEdit> +#include <QTextStream> 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(); @@ -411,6 +406,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); @@ -433,7 +429,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 +439,30 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) : this, &ExternalToolConfig::updateCurrentItem); connect(ui->environmentButton, &QAbstractButton::clicked, this, &ExternalToolConfig::editEnvironmentChanges); - connect(ui->outputBehavior, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), + connect(ui->outputBehavior, QOverload<int>::of(&QComboBox::activated), this, &ExternalToolConfig::updateCurrentItem); - connect(ui->errorOutputBehavior, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), + connect(ui->errorOutputBehavior, QOverload<int>::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 +477,7 @@ void ExternalToolConfig::setTools(const QMap<QString, QList<ExternalTool *> > &t while (it.hasNext()) { it.next(); QList<ExternalTool *> itemCopy; - foreach (ExternalTool *tool, it.value()) + for (ExternalTool *tool : it.value()) itemCopy.append(new ExternalTool(tool)); toolsCopy.insert(it.key(), itemCopy); } @@ -648,7 +647,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 293e9c64d1..298b70c54f 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.h +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.h @@ -27,9 +27,9 @@ #include "../externaltool.h" -#include <QWidget> #include <QAbstractItemModel> #include <QDialog> +#include <QWidget> QT_FORWARD_DECLARE_CLASS(QPlainTextEdit) diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp index 16c5676e7e..191de4a412 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/coreplugin/helpitem.cpp b/src/plugins/coreplugin/helpitem.cpp index 268c00ce67..b8794481cf 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<QString, QUrl> &HelpItem::links() const +static std::pair<QUrl, int> 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<QUrl, int> va = extractVersion(a); + const std::pair<QUrl, int> 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<QString, QUrl>({{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<QString, QUrl> 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<QString, QUrl> 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<QString, QUrl> &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; - } - } +static const HelpItem::Links getBestLinks(const HelpItem::Links &links) +{ + // 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; +} + +static const HelpItem::Links getBestLink(const HelpItem::Links &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 QUrl HelpItem::bestLink() const +const QString HelpItem::keyword() const { - return findBestLink(links()); + return m_keyword; } diff --git a/src/plugins/coreplugin/helpitem.h b/src/plugins/coreplugin/helpitem.h index 5468659b2a..4d9ab153fb 100644 --- a/src/plugins/coreplugin/helpitem.h +++ b/src/plugins/coreplugin/helpitem.h @@ -29,16 +29,20 @@ #include <utils/optional.h> -#include <QMap> #include <QString> #include <QUrl> #include <QVariant> +#include <vector> + namespace Core { class CORE_EXPORT HelpItem { public: + using Link = std::pair<QString, QUrl>; + using Links = std::vector<Link>; + enum Category { ClassOrNamespace, Enum, @@ -77,15 +81,18 @@ public: QString extractContent(bool extended) const; - const QMap<QString, QUrl> &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<QMap<QString, QUrl>> m_helpLinks; // cached help links + mutable Utils::optional<Links> 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 68c976fbfa..20c6adf83b 100644 --- a/src/plugins/coreplugin/helpmanager.cpp +++ b/src/plugins/coreplugin/helpmanager.cpp @@ -91,6 +91,11 @@ QMap<QString, QUrl> linksForIdentifier(const QString &id) return checkInstance() ? m_instance->linksForIdentifier(id) : QMap<QString, QUrl>(); } +QMap<QString, QUrl> linksForKeyword(const QString &keyword) +{ + return checkInstance() ? m_instance->linksForKeyword(keyword) : QMap<QString, QUrl>(); +} + 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 0027336504..4f4484c65d 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<QString, QUrl> linksForIdentifier(const QString &id); +CORE_EXPORT QMap<QString, QUrl> 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 47afa96f34..6c160c7ce3 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<QString, QUrl> linksForIdentifier(const QString &id) = 0; + virtual QMap<QString, QUrl> 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/cppcheck/cppcheckrunner.cpp b/src/plugins/cppcheck/cppcheckrunner.cpp index c747258838..f67044cb67 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<int>::of(&QProcess::finished), + connect(m_process, QOverload<int, QProcess::ExitStatus>::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 28fa1bcf9a..5e62bf5bb6 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<void(QProcess::*)(int)>(&QProcess::finished), + connect(&m_process, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>(&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 c08e5ea471..a664d30c40 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<void (QProcess::*)(int)>(&QProcess::finished), + connect(&m_proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &LocalProcessRunner::handleFinished); } @@ -213,7 +213,7 @@ private: } m_coreUnpackProcess.setWorkingDirectory(TemporaryDirectory::masterDirectoryPath()); - connect(&m_coreUnpackProcess, static_cast<void (QProcess::*)(int)>(&QProcess::finished), + connect(&m_coreUnpackProcess, QOverload<int, QProcess::ExitStatus>::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 9aba76fa88..2f8cef1d24 100644 --- a/src/plugins/debugger/debuggertooltipmanager.cpp +++ b/src/plugins/debugger/debuggertooltipmanager.cpp @@ -62,6 +62,7 @@ #include <QDesktopWidget> #include <QFileInfo> #include <QLabel> +#include <QScreen> #include <QScrollBar> #include <QSortFilterProxyModel> #include <QStack> @@ -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/debugger/threadshandler.cpp b/src/plugins/debugger/threadshandler.cpp index 017e183962..24ec22c693 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()); } diff --git a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp index 3e9a72050b..0975273ee2 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 5a46b2cbbf..48f4cf9ccf 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<void (QProcess::*)(int)>(&QProcess::finished), + connect(m_process, QOverload<int, QProcess::ExitStatus>::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 0a55e0b56d..d28c6bb263 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<void (QProcess::*)(int)>(&QProcess::finished), + connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), process, &QProcess::deleteLater); else delete process; diff --git a/src/plugins/git/mergetool.cpp b/src/plugins/git/mergetool.cpp index bc42b24047..c1fd1ec2df 100644 --- a/src/plugins/git/mergetool.cpp +++ b/src/plugins/git/mergetool.cpp @@ -65,7 +65,8 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files) VcsOutputWindow::appendCommand(workingDirectory, binary, arguments); m_process->start(binary.toString(), arguments); if (m_process->waitForStarted()) { - connect(m_process, static_cast<void (QProcess::*)(int)>(&QProcess::finished), this, &MergeTool::done); + connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), + this, &MergeTool::done); connect(m_process, &QIODevice::readyRead, this, &MergeTool::readData); } else { delete m_process; diff --git a/src/plugins/help/helpindexfilter.cpp b/src/plugins/help/helpindexfilter.cpp index e205359cf4..42467934b7 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<QString, QUrl> &links = HelpManager::linksForKeyword(key); + const QMap<QString, QUrl> &links = HelpManager::instance()->linksForKeyword(key); emit linksActivated(links, key); } diff --git a/src/plugins/help/helpmanager.h b/src/plugins/help/helpmanager.h index 825a27d046..3a65b0f33d 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<QString> userDocumentationPaths(); - static QMap<QString, QUrl> linksForKeyword(const QString &key); QMap<QString, QUrl> linksForIdentifier(const QString &id) override; + QMap<QString, QUrl> 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 ada46f3b3e..7703541670 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<QString, QUrl> 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/projectexplorer/abi.cpp b/src/plugins/projectexplorer/abi.cpp index 131fbb33b4..0de4ea655d 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<Abi> 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 4c31ed99f5..43243847c8 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/buildsteplist.cpp b/src/plugins/projectexplorer/buildsteplist.cpp index dab8d70311..2734f4139d 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 e87c2ed4f4..d57b765bb0 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdeviceprocess.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdeviceprocess.cpp @@ -40,7 +40,7 @@ DesktopDeviceProcess::DesktopDeviceProcess(const QSharedPointer<const IDevice> & : DeviceProcess(device, parent) { connect(&m_process, &QProcess::errorOccurred, this, &DeviceProcess::error); - connect(&m_process, static_cast<void (QProcess::*)(int)>(&QProcess::finished), + connect(&m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &DeviceProcess::finished); connect(&m_process, &QProcess::readyReadStandardOutput, this, &DeviceProcess::readyReadStandardOutput); diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index 711cf30acc..8b8c571142 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/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 47164b4882..7caef6e4b3 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); diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index 9c9ca6e832..7d8010aa27 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/desktopqmakerunconfiguration.cpp b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp index 385fd54b3d..8ac2a1cd0b 100644 --- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp +++ b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp @@ -105,6 +105,14 @@ void DesktopQmakeRunConfiguration::updateTargetInformation() aspect<ExecutableAspect>()->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 ecaa1bfc6b..2a4ccd564b 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(); diff --git a/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp b/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp index 0f0830b58e..1d3509f813 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/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp index 53b3422c80..6479ba13ad 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<QString, QUrl> 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<QString, QUrl> 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 diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 9fefd8f28c..3790005a7c 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -1634,7 +1634,7 @@ FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<ProKey, ProString> &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)); @@ -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/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp b/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp index d673df7e08..4e72e4449b 100644 --- a/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp +++ b/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp @@ -40,6 +40,7 @@ #include <QDesktopWidget> #include <QKeyEvent> #include <QPointer> +#include <QScreen> 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 e9c6920b92..1a6235789e 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 247fd12352..6cf1b70136 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 1f25206377..b96bdd71b8 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); diff --git a/src/shared/proparser/prowriter.cpp b/src/shared/proparser/prowriter.cpp index 3ca7220621..5038d9652a 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)); diff --git a/tests/system/shared/suites_qtta.py b/tests/system/shared/suites_qtta.py index d465ea6aa4..79d5ee3eda 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 44e95fa787..b49594ddfb 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") diff --git a/tests/system/suite_WELP/tst_WELP01/test.py b/tests/system/suite_WELP/tst_WELP01/test.py index ce07f4fdaf..d20c5d1d91 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) diff --git a/tests/unit/mockup/projectexplorer/abi.h b/tests/unit/mockup/projectexplorer/abi.h index 25baca234a..c742567bde 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, |