summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-06-04 12:59:21 +0300
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-06-22 10:29:45 +0300
commita8b4b4da9db8c4bee2494157cecb2a474d92d2e3 (patch)
tree8bba55ab948c6dfded2b7f1db9800405d7975718
parentf34ed0b633f30a6871a0d82409b1490565d1c96d (diff)
Fix replacing of {external-link} tags in component tree view tooltips
Task-number: QTIFW-2264 Change-Id: Ie7191ba75d923cc8d8eb353f7fac85818b87591f Reviewed-by: Katja Marttila <katja.marttila@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r--src/libs/installer/component.cpp30
-rw-r--r--src/libs/installer/componentselectionpage_p.cpp4
2 files changed, 14 insertions, 20 deletions
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp
index cb9959ba3..5f897303d 100644
--- a/src/libs/installer/component.cpp
+++ b/src/libs/installer/component.cpp
@@ -45,6 +45,7 @@
#include <QtCore/QDirIterator>
#include <QtCore/QRegExp>
#include <QtCore/QTranslator>
+#include <QtCore/QRegularExpression>
#include <QApplication>
@@ -1628,26 +1629,23 @@ void Component::updateModelData(const QString &key, const QString &data)
setData(humanReadableSize(size), UncompressedSize);
}
+ QString tooltipText;
const QString &updateInfo = d->m_vars.value(scUpdateText);
if (!d->m_core->isUpdater() || updateInfo.isEmpty()) {
- QString tooltipText
- = QString::fromLatin1("<html><body>%1</body></html>").arg(d->m_vars.value(scDescription));
- if (isUnstable()) {
- tooltipText += QLatin1String("<br>") + tr("There was an error loading the selected component. "
- "This component can not be installed.");
- }
- setData(tooltipText, Qt::ToolTipRole);
+ tooltipText = QString::fromLatin1("<html><body>%1</body></html>").arg(d->m_vars.value(scDescription));
} else {
- QString tooltipText
- = d->m_vars.value(scDescription) + QLatin1String("<br><br>")
- + tr("Update Info: ") + updateInfo;
- if (isUnstable()) {
- tooltipText += QLatin1String("<br>") + tr("There was an error loading the selected component. "
- "This component can not be updated.");
- }
-
- setData(tooltipText, Qt::ToolTipRole);
+ tooltipText = d->m_vars.value(scDescription) + QLatin1String("<br><br>")
+ + tr("Update Info: ") + updateInfo;
}
+ if (isUnstable()) {
+ tooltipText += QLatin1String("<br>") + tr("There was an error loading the selected component. "
+ "This component can not be installed.");
+ }
+ // replace {external-link}='' fields in component description with proper link tags
+ tooltipText.replace(QRegularExpression(QLatin1String("{external-link}='(.*?)'")),
+ QLatin1String("<a href=\"\\1\">\\1</a>"));
+
+ setData(tooltipText, Qt::ToolTipRole);
}
/*!
diff --git a/src/libs/installer/componentselectionpage_p.cpp b/src/libs/installer/componentselectionpage_p.cpp
index a9f4ba134..37dc0f13e 100644
--- a/src/libs/installer/componentselectionpage_p.cpp
+++ b/src/libs/installer/componentselectionpage_p.cpp
@@ -331,10 +331,6 @@ void ComponentSelectionPagePrivate::currentSelectedChanged(const QModelIndex &cu
QString description = m_currentModel->data(m_currentModel->index(current.row(),
ComponentModelHelper::NameColumn, current.parent()), Qt::ToolTipRole).toString();
- // replace {external-link}='' fields in component description with proper link tags
- description.replace(QRegularExpression(QLatin1String("{external-link}='(.*?)'")),
- QLatin1String("<a href=\"\\1\"><span style=\"color:#17a81a;\">\\1</span></a>"));
-
m_descriptionLabel->setText(description);
Component *component = m_currentModel->componentFromIndex(current);