From: Michael Schuster Date: Mon, 23 Dec 2019 13:29:34 +0000 (+0100) Subject: Fix issue #1237: White text on almost-white background X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~463 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ccd20f01728eb4f73f83142446f749aff300ebfc;p=nextcloud-desktop.git Fix issue #1237: White text on almost-white background Signed-off-by: Michael Schuster --- diff --git a/src/gui/folderstatusdelegate.cpp b/src/gui/folderstatusdelegate.cpp index 5cd2ed118..4b8899a05 100644 --- a/src/gui/folderstatusdelegate.cpp +++ b/src/gui/folderstatusdelegate.cpp @@ -273,6 +273,11 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem & rect.setHeight(texts.count() * subFm.height() + 2 * margin); rect.setRight(option.rect.right() - margin); + // save previous state to not mess up colours with the background (fixes issue: https://github.com/nextcloud/desktop/issues/1237) + auto oldBrush = painter->brush(); + auto oldPen = painter->pen(); + auto oldFont = painter->font(); + painter->setBrush(color); painter->setPen(QColor(0xaa, 0xaa, 0xaa)); painter->drawRoundedRect(QStyle::visualRect(option.direction, option.rect, rect), @@ -290,6 +295,11 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem & textRect.translate(0, textRect.height()); } + // restore previous state + painter->setBrush(oldBrush); + painter->setPen(oldPen); + painter->setFont(oldFont); + h = rect.bottom() + margin; };