diff options
author | Alessandro Portale <[email protected]> | 2024-10-14 15:01:54 +0200 |
---|---|---|
committer | Alessandro Portale <[email protected]> | 2024-10-14 14:48:37 +0000 |
commit | 1dc7d69e25d43d4708c70c2ea38594cacbe281ac (patch) | |
tree | f0cfb477612c8b891817f8b901829c41fd3b67fc /src | |
parent | 9f08d874b6b3081d8708b884e6082397eb02f872 (diff) |
ExtensionManager: Change position of the short description
The short description is currently shown as initial part of the
description, followed by the long description.
With this change, the long description is shown by its own. And the
short description moves to other places: on the bottom of the card
(replacing the tags) and on the bottom of the details-top element.
Fixes: QTCREATORBUG-31813
Change-Id: I927573b9699ad830896fdebec4077aadf2df7b9e
Reviewed-by: Marcus Tillmanns <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/extensionmanager/extensionmanagerwidget.cpp | 22 | ||||
-rw-r--r-- | src/plugins/extensionmanager/extensionsbrowser.cpp | 25 |
2 files changed, 17 insertions, 30 deletions
diff --git a/src/plugins/extensionmanager/extensionmanagerwidget.cpp b/src/plugins/extensionmanager/extensionmanagerwidget.cpp index 4550778270d..8bf7360fc80 100644 --- a/src/plugins/extensionmanager/extensionmanagerwidget.cpp +++ b/src/plugins/extensionmanager/extensionmanagerwidget.cpp @@ -147,7 +147,7 @@ public: static const TextFormat dlTF {Theme::Token_Text_Muted, vendorTF.uiElement}; static const TextFormat detailsTF - {Theme::Token_Text_Default, UiElementBody2}; + {titleTF.themeColor, Utils::StyleHelper::UiElementCaption}; m_title = tfLabel(titleTF); m_vendor = new Button({}, Button::SmallLink); @@ -229,14 +229,8 @@ public: m_dlCount->setText(QString::number(dlCount)); m_dlCountItems->setVisible(showDlCount); - const QStringList plugins = current.data(RolePlugins).toStringList(); - if (current.data(RoleItemType).toInt() == ItemTypePack) { - const int pluginsCount = plugins.count(); - const QString details = Tr::tr("Pack contains %n plugins.", nullptr, pluginsCount); - m_details->setText(details); - } else { - m_details->setText({}); - } + const QString description = current.data(RoleDescriptionShort).toString(); + m_details->setText(description); const ItemType itemType = current.data(RoleItemType).value<ItemType>(); const bool isPack = itemType == ItemTypePack; @@ -907,14 +901,8 @@ void ExtensionManagerWidget::updateView(const QModelIndex ¤t) m_currentId = current.data(RoleVendorId).toString() + "." + current.data(RoleId).toString(); { - const QStringList description = { - "# " + m_currentItemName, - current.data(RoleDescriptionShort).toString(), - "", - current.data(RoleDescriptionLong).toString() - }; - const QString descriptionMarkdown = description.join("\n"); - setMarkdown(m_description->document(), descriptionMarkdown); + const QString description = current.data(RoleDescriptionLong).toString(); + setMarkdown(m_description->document(), description); } { diff --git a/src/plugins/extensionmanager/extensionsbrowser.cpp b/src/plugins/extensionmanager/extensionsbrowser.cpp index f18bfc33aea..4e5b1ab85e8 100644 --- a/src/plugins/extensionmanager/extensionsbrowser.cpp +++ b/src/plugins/extensionmanager/extensionsbrowser.cpp @@ -181,8 +181,8 @@ public: Qt::AlignVCenter | Qt::TextDontClip}; constexpr static TextFormat stateTF {vendorTF.themeColor, UiElement::UiElementCaption, vendorTF.drawTextFlags}; - constexpr static TextFormat tagsTF - {Theme::Token_Text_Default, UiElement::UiElementCaption}; + constexpr static TextFormat descriptionTF + {itemNameTF.themeColor, UiElement::UiElementCaption}; explicit ExtensionItemDelegate(QObject *parent = nullptr) : QItemDelegate(parent) @@ -203,7 +203,7 @@ public: // | |(50x50)| +---------------------+--------+--------------+--------+--------+---------+---------+ | | // | | | | (VGapXxs) | | | // | | | +-----------------------------------------------------------------------------------+ | | - // | | | | <tags> | | | + // | | | | <shortDescription> | | | // | | | +-----------------------------------------------------------------------------------+ | | // | | | | (ExPaddingGapL) | | | // +---------------+-------+---------------+-----------------------------------------------------------------------------------+---------------+---------+ @@ -244,9 +244,9 @@ public: QRect vendorR = vendorRowR; y += vendorRowR.height() + VGapXxs; - const QRect tagsR(x, y, middleColumnW, tagsTF.lineHeight()); + const QRect descriptionR(x, y, middleColumnW, descriptionTF.lineHeight()); - QTC_CHECK(option.rect.height() - 1 == tagsR.bottom() + ExPaddingGapL + gapSize); + QTC_CHECK(option.rect.height() - 1 == descriptionR.bottom() + ExPaddingGapL + gapSize); painter->save(); painter->setRenderHint(QPainter::Antialiasing); @@ -366,13 +366,12 @@ public: painter->drawText(vendorR, vendorTF.drawTextFlags, vendorElided); } { - const QStringList tagList = index.data(RoleTags).toStringList(); - const QString tags = tagList.join(", "); - painter->setPen(tagsTF.color()); - painter->setFont(tagsTF.font()); - const QString tagsElided - = painter->fontMetrics().elidedText(tags, Qt::ElideRight, tagsR.width()); - painter->drawText(tagsR, tagsTF.drawTextFlags, tagsElided); + const QString description = index.data(RoleDescriptionShort).toString(); + painter->setPen(descriptionTF.color()); + painter->setFont(descriptionTF.font()); + const QString descriptionElided = painter->fontMetrics() + .elidedText(description, Qt::ElideRight, descriptionR.width()); + painter->drawText(descriptionR, descriptionTF.drawTextFlags, descriptionElided); } painter->restore(); @@ -391,7 +390,7 @@ public: + VGapXxs + vendorRowHeight() + VGapXxs - + tagsTF.lineHeight(); + + descriptionTF.lineHeight(); const int height = ExPaddingGapL + qMax(iconBgSizeSmall.height(), middleColumnH) |