mirror of
https://github.com/QuasarApp/installer-framework.git
synced 2025-05-08 11:09:33 +00:00
Enable links and text selection in component description fields
External links can now be included in component description by specifying a proper URL address like this: {external-link}='https://www.qt.io/'. The link fields can be placed anywhere inside package <Description> tags. Task-number: QTIFW-1292 Change-Id: I1d916a58224bdfb6e885445873bf541fad3cf834 Reviewed-by: Tarja Sundqvist <tarja.sundqvist@qt.io> Reviewed-by: Katja Marttila <katja.marttila@qt.io>
This commit is contained in:
parent
aba1d564ce
commit
04a3e32784
@ -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:
|
||||
|
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user