Browse Source

Override progress bar on platforms with segmented progress bars

Windows & WindowsXP style have a problem with displaying the block progress.
Add a custom stylesheet as workaround, but only when one of those renderers is active,
otherwise leave the theme alone (issue #1071).
0.8
Wladimir J. van der Laan 13 years ago
parent
commit
382b75f528
  1. 10
      src/qt/bitcoingui.cpp

10
src/qt/bitcoingui.cpp

@ -53,6 +53,7 @@ @@ -53,6 +53,7 @@
#include <QTimer>
#include <QDragEnterEvent>
#include <QUrl>
#include <QStyle>
#include <iostream>
@ -148,6 +149,15 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): @@ -148,6 +149,15 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
progressBar->setAlignment(Qt::AlignCenter);
progressBar->setVisible(false);
// Override style sheet for progress bar for styles that have a segmented progress bar,
// as they make the text unreadable (workaround for issue #1071)
// See https://qt-project.org/doc/qt-4.8/gallery.html
QString curStyle = qApp->style()->metaObject()->className();
if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
{
progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
}
statusBar()->addWidget(progressBarLabel);
statusBar()->addWidget(progressBar);
statusBar()->addPermanentWidget(frameBlocks);

Loading…
Cancel
Save