]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Use backup QCommonStyle to draw progress bar on macOS to avoid bug in QMacStyle
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Thu, 4 May 2023 04:03:34 +0000 (12:03 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 8 May 2023 12:04:56 +0000 (20:04 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/folderstatusdelegate.cpp

index 8895cd40f2537a85feceaeeadf0077e09d389383..3f5ad54e488609b7ccdb5bc47be659c232ca0f01 100644 (file)
@@ -26,6 +26,7 @@
 #include <QPainter>
 #include <QApplication>
 #include <QMouseEvent>
+#include <QCommonStyle>
 
 inline static QFont makeAliasFont(const QFont &normalFont)
 {
@@ -35,6 +36,12 @@ inline static QFont makeAliasFont(const QFont &normalFont)
     return aliasFont;
 }
 
+namespace {
+#ifdef Q_OS_MACOS
+    QCommonStyle backupStyle;
+#endif
+}
+
 namespace OCC {
 
 FolderStatusDelegate::FolderStatusDelegate()
@@ -310,7 +317,11 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
         progressBarOpt.progress = overallPercent;
         progressBarOpt.orientation = Qt::Horizontal;
         progressBarOpt.rect = QStyle::visualRect(option.direction, option.rect, progressBarRect);
+#ifdef Q_OS_MACOS
+        backupStyle.drawControl(QStyle::CE_ProgressBar, &progressBarOpt, painter, option.widget);
+#else
         QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOpt, painter, option.widget);
+#endif
 
 
         // Overall Progress Text