Core: Introduce WelcomePageHelpers::drawCardBackground

Pulled out of the ExtensionManager. It will also be used by
the Welcomescreen pages.

Change-Id: Ic5c67759e7f3af6a3b51968b7ae072c7058109b3
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Alessandro Portale
2024-01-26 13:28:36 +01:00
parent 9fd732712e
commit f1787812e3
3 changed files with 25 additions and 9 deletions

View File

@@ -339,19 +339,11 @@ public:
{
const bool selected = option.state & QStyle::State_Selected;
const bool hovered = option.state & QStyle::State_MouseOver;
constexpr qreal strokeWidth = 1;
constexpr qreal shrink = strokeWidth / 2;
const QRectF itemRectAdjusted = itemRect.adjusted(shrink, shrink, -shrink, -shrink);
constexpr qreal rounding = 4.5;
QPainterPath itemOutlinePath;
itemOutlinePath.addRoundedRect(itemRectAdjusted, rounding, rounding);
const QColor fillColor = creatorTheme()->color(hovered ? Theme::Token_Foreground_Muted
: Theme::Token_Background_Muted);
const QColor strokeColor = creatorTheme()->color(selected ? Theme::Token_Stroke_Strong
: Theme::Token_Stroke_Subtle);
painter->setBrush(fillColor);
painter->setPen(strokeColor);
painter->drawPath(itemOutlinePath);
WelcomePageHelpers::drawCardBackground(painter, itemRect, fillColor, strokeColor);
}
{
constexpr QRectF bigCircle(16, 16, 48, 48);