Examples: Adapt line color between title and tags to category hr color

"Welcome_ForegroundSecondaryColor" is less likely to burn a permanent,
straight line into user's retina.

Change-Id: Ie6c6f02d8b53c340b322945f0d735177f22ddd56
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Alessandro Portale
2023-05-02 12:21:43 +02:00
parent 1c2b29b31a
commit bdabb68810
2 changed files with 4 additions and 2 deletions

View File

@@ -446,6 +446,7 @@ ListItemDelegate::ListItemDelegate()
: backgroundPrimaryColor(themeColor(Theme::Welcome_BackgroundPrimaryColor)) : backgroundPrimaryColor(themeColor(Theme::Welcome_BackgroundPrimaryColor))
, backgroundSecondaryColor(themeColor(Theme::Welcome_BackgroundSecondaryColor)) , backgroundSecondaryColor(themeColor(Theme::Welcome_BackgroundSecondaryColor))
, foregroundPrimaryColor(themeColor(Theme::Welcome_ForegroundPrimaryColor)) , foregroundPrimaryColor(themeColor(Theme::Welcome_ForegroundPrimaryColor))
, foregroundSecondaryColor(themeColor(Theme::Welcome_ForegroundSecondaryColor))
, hoverColor(themeColor(Theme::Welcome_HoverColor)) , hoverColor(themeColor(Theme::Welcome_HoverColor))
, textColor(themeColor(Theme::Welcome_TextColor)) , textColor(themeColor(Theme::Welcome_TextColor))
{ {
@@ -567,7 +568,7 @@ void ListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
// The separator line below the example title. // The separator line below the example title.
const int ll = nameRect.height() + 3; const int ll = nameRect.height() + 3;
const QLine line = QLine(0, ll, textArea.width(), ll).translated(shiftedTextRect.topLeft()); const QLine line = QLine(0, ll, textArea.width(), ll).translated(shiftedTextRect.topLeft());
painter->setPen(foregroundPrimaryColor); painter->setPen(foregroundSecondaryColor);
painter->setOpacity(animationProgress); // "fade in" separator line and description painter->setOpacity(animationProgress); // "fade in" separator line and description
painter->drawLine(line); painter->drawLine(line);
@@ -586,7 +587,7 @@ void ListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
} }
// Separator line between text and 'Tags:' section // Separator line between text and 'Tags:' section
painter->setPen(foregroundPrimaryColor); painter->setPen(foregroundSecondaryColor);
painter->drawLine(QLineF(textArea.topLeft(), textArea.topRight()) painter->drawLine(QLineF(textArea.topLeft(), textArea.topRight())
.translated(0, TagsSeparatorY)); .translated(0, TagsSeparatorY));

View File

@@ -165,6 +165,7 @@ protected:
const QColor backgroundPrimaryColor; const QColor backgroundPrimaryColor;
const QColor backgroundSecondaryColor; const QColor backgroundSecondaryColor;
const QColor foregroundPrimaryColor; const QColor foregroundPrimaryColor;
const QColor foregroundSecondaryColor;
const QColor hoverColor; const QColor hoverColor;
const QColor textColor; const QColor textColor;