diff options
author | Tobias Markmann <tm@ayena.de> | 2016-09-13 10:43:50 (GMT) |
---|---|---|
committer | Edwin Mons <edwin.mons@isode.com> | 2016-11-07 08:20:00 (GMT) |
commit | b55dcace49c6dc8c18c854f27fbb75f96e846f24 (patch) | |
tree | 959ed3c5f5b418271c305853fe507d613501ab26 /Swift/QtUI | |
parent | fca0cd94aa9136a58f9a76937e146048bf94811a (diff) | |
download | swift-b55dcace49c6dc8c18c854f27fbb75f96e846f24.zip swift-b55dcace49c6dc8c18c854f27fbb75f96e846f24.tar.bz2 |
Improve roster item readability for selected items
Due to the style independent fixed text color for the status
message of non-compact roster item, it was barely readable on
Windows 7. This commit has the color for the status message
in non-compact roster items depend on the used text color
for the name. It uses a brightness adjusted highlight text
color for the second line.
Test-Information:
Tested on OS X 10.11.6 with Qt 5.5.1 and Windows 8 with Qt
5.5.1.
Change-Id: I41beb0f3eaede3f9413a39662c213a4e904bdd69
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/Roster/DelegateCommons.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Swift/QtUI/Roster/DelegateCommons.cpp b/Swift/QtUI/Roster/DelegateCommons.cpp index 21d42ef..a8dd8a7 100644 --- a/Swift/QtUI/Roster/DelegateCommons.cpp +++ b/Swift/QtUI/Roster/DelegateCommons.cpp @@ -13,10 +13,6 @@ namespace Swift { -namespace { - const QColor secondLineColor = QColor(160,160,160); -} - void DelegateCommons::drawElidedText(QPainter* painter, const QRect& region, const QString& text, int flags) { QString adjustedText(painter->fontMetrics().elidedText(text, Qt::ElideRight, region.width(), Qt::TextShowMnemonic)); painter->setClipRect(region); @@ -27,11 +23,14 @@ void DelegateCommons::drawElidedText(QPainter* painter, const QRect& region, con void DelegateCommons::paintContact(QPainter* painter, const QStyleOptionViewItem& option, const QColor& nameColor, const QString& avatarPath, const QIcon& presenceIcon, const QString& name, const QString& statusText, bool isIdle, int unreadCount, bool compact) const { painter->save(); QRect fullRegion(option.rect); + QPen secondLineColor; if ( option.state & QStyle::State_Selected ) { painter->fillRect(fullRegion, option.palette.highlight()); painter->setPen(option.palette.highlightedText().color()); + secondLineColor = painter->pen().color().darker(125); } else { painter->setPen(QPen(nameColor)); + secondLineColor = painter->pen().color().lighter(); } QRect presenceIconRegion(QPoint(farLeftMargin, fullRegion.top()), QSize(presenceIconWidth, fullRegion.height() - verticalMargin)); |