diff options
-rw-r--r-- | doc/installerfw.qdoc | 5 | ||||
-rw-r--r-- | src/libs/installer/componentselectionpage_p.cpp | 13 |
2 files changed, 15 insertions, 3 deletions
diff --git a/doc/installerfw.qdoc b/doc/installerfw.qdoc index 0589c8c14..09c7e575a 100644 --- a/doc/installerfw.qdoc +++ b/doc/installerfw.qdoc @@ -585,7 +585,10 @@ Translations may be specified similarly to DisplayName tag. If a localization that matches the locale is not found and an untranslated version exists, that one will be used. Otherwise no Description will be - shown for that locale. + shown for that locale. User clickable external links, for example a component's + homepage, can be included in component description by specifying a URL + address like this: {external-link}='https://www.qt.io/'. The URL must be valid + and contain a full path to the desired resource. \row \li Version \li Version number of the component in the following format: diff --git a/src/libs/installer/componentselectionpage_p.cpp b/src/libs/installer/componentselectionpage_p.cpp index 34cd1e634..82c1b79e3 100644 --- a/src/libs/installer/componentselectionpage_p.cpp +++ b/src/libs/installer/componentselectionpage_p.cpp @@ -77,6 +77,8 @@ ComponentSelectionPagePrivate::ComponentSelectionPagePrivate(ComponentSelectionP m_descriptionLabel = new QLabel(q); m_descriptionLabel->setWordWrap(true); + m_descriptionLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); + m_descriptionLabel->setOpenExternalLinks(true); m_descriptionLabel->setObjectName(QLatin1String("ComponentDescriptionLabel")); m_descriptionLabel->setAlignment(Qt::AlignTop); m_descriptionScrollArea->setWidget(m_descriptionLabel); @@ -296,8 +298,15 @@ void ComponentSelectionPagePrivate::currentSelectedChanged(const QModelIndex &cu return; m_sizeLabel->setText(QString()); - m_descriptionLabel->setText(m_currentModel->data(m_currentModel->index(current.row(), - ComponentModelHelper::NameColumn, current.parent()), Qt::ToolTipRole).toString()); + + 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); if ((m_core->isUninstaller()) || (!component)) |