forked from qt-creator/qt-creator
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 <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
{
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user