diff options
author | Alessandro Portale <[email protected]> | 2024-06-27 16:50:49 +0200 |
---|---|---|
committer | Alessandro Portale <[email protected]> | 2024-06-27 15:23:26 +0000 |
commit | 5960bb33ef79c29d6c23e9dd7ba34b01ebec7e7a (patch) | |
tree | 26df30fbd9e6bf9a3569f1f92909541e184dd5ec /src/plugins/extensionmanager/extensionmanagerwidget.cpp | |
parent | 7c4fec664ce5c192e20138ca136afdcf26165f53 (diff) |
ExtensionManager: Draw icon of disabled items with less intensity
Since recently, the green background is used for enabled plugins and
grey is for disabled ones. With that change comes the requirement to
draw the icon for disabled icons with less intensity, to make it really
appear disabled.
I took this opportunity to unify the drawing of small/big enabled/
disabled pack/extension icon variants in a central helper function.
Change-Id: Ia68218c774ccb8e9e7ed48620ac36f4bca0724fd
Reviewed-by: Cristian Adam <[email protected]>
Diffstat (limited to 'src/plugins/extensionmanager/extensionmanagerwidget.cpp')
-rw-r--r-- | src/plugins/extensionmanager/extensionmanagerwidget.cpp | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/src/plugins/extensionmanager/extensionmanagerwidget.cpp b/src/plugins/extensionmanager/extensionmanagerwidget.cpp index 5ab0126a94b..429d9a241f3 100644 --- a/src/plugins/extensionmanager/extensionmanagerwidget.cpp +++ b/src/plugins/extensionmanager/extensionmanagerwidget.cpp @@ -113,7 +113,6 @@ private: class HeadingWidget : public QWidget { - static constexpr QSize iconBgS{68, 68}; static constexpr int dividerH = 16; Q_OBJECT @@ -123,7 +122,7 @@ public: : QWidget(parent) { m_icon = new QLabel; - m_icon->setFixedSize(iconBgS); + m_icon->setFixedSize(iconBgSizeBig); static const TextFormat titleTF {Theme::Token_Text_Default, UiElementH4}; @@ -200,7 +199,7 @@ public: if (!current.isValid()) return; - m_icon->setPixmap(icon(current)); + m_icon->setPixmap(itemIcon(current, SizeBig)); const QString name = current.data(RoleName).toString(); m_title->setText(name); @@ -236,32 +235,6 @@ signals: void vendorClicked(const QString &vendor); private: - static QPixmap icon(const QModelIndex &index) - { - const qreal dpr = qApp->devicePixelRatio(); - QPixmap pixmap(iconBgS * dpr); - pixmap.fill(Qt::transparent); - pixmap.setDevicePixelRatio(dpr); - const QRect bgR(QPoint(), pixmap.deviceIndependentSize().toSize()); - - QPainter p(&pixmap); - QLinearGradient gradient(bgR.topRight(), bgR.bottomLeft()); - gradient.setStops(iconGradientStops(index)); - constexpr int iconRectRounding = 4; - WelcomePageHelpers::drawCardBackground(&p, bgR, gradient, Qt::NoPen, iconRectRounding); - - // Icon - constexpr Theme::Color color = Theme::Token_Basic_White; - static const QIcon pack = Icon({{":/extensionmanager/images/packbig.png", color}}, - Icon::Tint).icon(); - static const QIcon extension = Icon({{":/extensionmanager/images/extensionbig.png", - color}}, Icon::Tint).icon(); - const ItemType itemType = index.data(RoleItemType).value<ItemType>(); - (itemType == ItemTypePack ? pack : extension).paint(&p, bgR); - - return pixmap; - } - QLabel *m_icon; QLabel *m_title; Button *m_vendor; |