Account Settings: fix progress being written in white when there are errors
authorOlivier Goffart <ogoffart@woboq.com>
Wed, 17 Oct 2018 13:15:11 +0000 (15:15 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:12 +0000 (10:58 +0100)
src/gui/folderstatusdelegate.cpp

index f130ba0d489e2c0a9d0b33c0e33d60d76dbad684..2bf59fe01dd3d09d0d2783a44f6c004ef3f41452 100644 (file)
@@ -272,10 +272,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
         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->save();
         painter->setBrush(color);
         painter->setPen(QColor(0xaa, 0xaa, 0xaa));
         painter->drawRoundedRect(QStyle::visualRect(option.direction, option.rect, rect),
@@ -292,11 +289,8 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
                 subFm.elidedText(eText, Qt::ElideLeft, textRect.width()));
             textRect.translate(0, textRect.height());
         }
-
         // restore previous state
-        painter->setBrush(oldBrush);
-        painter->setPen(oldPen);
-        painter->setFont(oldFont);
+        painter->restore();
 
         h = rect.bottom() + margin;
     };