Fix availability bar & progress bar height being too small on high DPI displays

This commit is contained in:
Chocobo1 2015-06-29 02:02:58 +08:00
parent 4a271d358f
commit b5adbaef78
5 changed files with 12 additions and 9 deletions

View file

@ -33,8 +33,6 @@
DownloadedPiecesBar::DownloadedPiecesBar(QWidget *parent): QWidget(parent)
{
setFixedHeight(BAR_HEIGHT);
m_bgColor = 0xffffff;
m_borderColor = palette().color(QPalette::Dark).rgb();
m_pieceColor = 0x0000ff;

View file

@ -37,8 +37,6 @@
#include <QBitArray>
#include <QVector>
#define BAR_HEIGHT 18
class DownloadedPiecesBar: public QWidget {
Q_OBJECT
Q_DISABLE_COPY(DownloadedPiecesBar)

View file

@ -36,8 +36,6 @@
PieceAvailabilityBar::PieceAvailabilityBar(QWidget *parent)
: QWidget(parent)
{
setFixedHeight(BAR_HEIGHT);
m_bgColor = 0xffffff;
m_borderColor = palette().color(QPalette::Dark).rgb();
m_pieceColor = 0x0000ff;

View file

@ -35,9 +35,6 @@
#include <QPainter>
#include <QImage>
#define BAR_HEIGHT 18
class PieceAvailabilityBar: public QWidget
{
Q_OBJECT

View file

@ -102,12 +102,24 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, Tra
connect(filesList->header(), SIGNAL(sectionResized(int, int, int)), this, SLOT(saveSettings()));
connect(filesList->header(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), this, SLOT(saveSettings()));
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
// set bar height relative to screen dpi
int barHeight = devicePixelRatio() * 18;
#else
// set bar height relative to font height
QFont defFont;
QFontMetrics fMetrics(defFont, 0); // need to be device-dependent
int barHeight = fMetrics.height() * 5 / 4;
#endif
// Downloaded pieces progress bar
downloaded_pieces = new DownloadedPiecesBar(this);
ProgressHLayout->insertWidget(1, downloaded_pieces);
downloaded_pieces->setFixedHeight(barHeight);
// Pieces availability bar
pieces_availability = new PieceAvailabilityBar(this);
ProgressHLayout_2->insertWidget(1, pieces_availability);
pieces_availability->setFixedHeight(barHeight);
// Tracker list
trackerList = new TrackerList(this);
connect(trackerUpButton, SIGNAL(clicked()), trackerList, SLOT(moveSelectionUp()));