From 76faed38181d3aead8c41076bf19d60dc9181653 Mon Sep 17 00:00:00 2001 From: Nick Korotysh Date: Wed, 2 Jan 2019 10:01:32 +0300 Subject: [PATCH] Draw progress bar in Fusion style on macOS systems Qt has a bug QTBUG-72558, which leads to incorrect progress bar position, when drawing it in delegate. Also, since OS X 10.10 Yosemite macOS default style was changed, and progress bars became very tiny and without text (percentage). These two cases make qBittorrent look pretty awful, but drawing progress bar in Fusion style solves both issues. --- src/gui/previewlistdelegate.h | 4 ++-- src/gui/properties/proplistdelegate.cpp | 4 ++-- src/gui/transferlistdelegate.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/previewlistdelegate.h b/src/gui/previewlistdelegate.h index f8dea8270..e15b857d3 100644 --- a/src/gui/previewlistdelegate.h +++ b/src/gui/previewlistdelegate.h @@ -36,7 +36,7 @@ #include #include -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) || defined(Q_OS_MACOS) #include #endif @@ -76,7 +76,7 @@ public: newopt.minimum = 0; newopt.state |= QStyle::State_Enabled; newopt.textVisible = true; -#ifndef Q_OS_WIN +#if !defined(Q_OS_WIN) && !defined(Q_OS_MACOS) QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter); #else // XXX: To avoid having the progress text on the right of the bar diff --git a/src/gui/properties/proplistdelegate.cpp b/src/gui/properties/proplistdelegate.cpp index 8549ca983..a859bd8e0 100644 --- a/src/gui/properties/proplistdelegate.cpp +++ b/src/gui/properties/proplistdelegate.cpp @@ -36,7 +36,7 @@ #include #include -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) || defined(Q_OS_MACOS) #include #endif @@ -101,7 +101,7 @@ void PropListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti newopt.state |= QStyle::State_Enabled; } -#ifndef Q_OS_WIN +#if !defined(Q_OS_WIN) && !defined(Q_OS_MACOS) QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter); #else // XXX: To avoid having the progress text on the right of the bar diff --git a/src/gui/transferlistdelegate.cpp b/src/gui/transferlistdelegate.cpp index 4500d1df4..501098891 100644 --- a/src/gui/transferlistdelegate.cpp +++ b/src/gui/transferlistdelegate.cpp @@ -33,7 +33,7 @@ #include #include -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) || defined(Q_OS_MACOS) #include #endif @@ -166,7 +166,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & newopt.minimum = 0; newopt.state |= QStyle::State_Enabled; newopt.textVisible = true; -#ifndef Q_OS_WIN +#if !defined(Q_OS_WIN) && !defined(Q_OS_MACOS) QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter); #else // XXX: To avoid having the progress text on the right of the bar