Browse Source

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.
adaptive-webui-19844
Nick Korotysh 6 years ago
parent
commit
bd1856594b
No known key found for this signature in database
GPG Key ID: 7D0D4117C97CCC46
  1. 4
      src/gui/previewlistdelegate.h
  2. 4
      src/gui/properties/proplistdelegate.cpp
  3. 4
      src/gui/transferlistdelegate.cpp

4
src/gui/previewlistdelegate.h

@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
#include <QStyleOptionProgressBar>
#include <QStyleOptionViewItem>
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
#include <QProxyStyle>
#endif
@ -76,7 +76,7 @@ public: @@ -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

4
src/gui/properties/proplistdelegate.cpp

@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
#include <QProgressBar>
#include <QStyleOptionProgressBar>
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
#include <QProxyStyle>
#endif
@ -101,7 +101,7 @@ void PropListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti @@ -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

4
src/gui/transferlistdelegate.cpp

@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
#include <QPainter>
#include <QStyleOptionViewItem>
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
#include <QProxyStyle>
#endif
@ -166,7 +166,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & @@ -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

Loading…
Cancel
Save