1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 15:27:54 +00:00

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) DownloadedPiecesBar::DownloadedPiecesBar(QWidget *parent): QWidget(parent)
{ {
setFixedHeight(BAR_HEIGHT);
m_bgColor = 0xffffff; m_bgColor = 0xffffff;
m_borderColor = palette().color(QPalette::Dark).rgb(); m_borderColor = palette().color(QPalette::Dark).rgb();
m_pieceColor = 0x0000ff; m_pieceColor = 0x0000ff;

View File

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

View File

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

View File

@ -35,9 +35,6 @@
#include <QPainter> #include <QPainter>
#include <QImage> #include <QImage>
#define BAR_HEIGHT 18
class PieceAvailabilityBar: public QWidget class PieceAvailabilityBar: public QWidget
{ {
Q_OBJECT 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(sectionResized(int, int, int)), this, SLOT(saveSettings()));
connect(filesList->header(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), 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 progress bar
downloaded_pieces = new DownloadedPiecesBar(this); downloaded_pieces = new DownloadedPiecesBar(this);
ProgressHLayout->insertWidget(1, downloaded_pieces); ProgressHLayout->insertWidget(1, downloaded_pieces);
downloaded_pieces->setFixedHeight(barHeight);
// Pieces availability bar // Pieces availability bar
pieces_availability = new PieceAvailabilityBar(this); pieces_availability = new PieceAvailabilityBar(this);
ProgressHLayout_2->insertWidget(1, pieces_availability); ProgressHLayout_2->insertWidget(1, pieces_availability);
pieces_availability->setFixedHeight(barHeight);
// Tracker list // Tracker list
trackerList = new TrackerList(this); trackerList = new TrackerList(this);
connect(trackerUpButton, SIGNAL(clicked()), trackerList, SLOT(moveSelectionUp())); connect(trackerUpButton, SIGNAL(clicked()), trackerList, SLOT(moveSelectionUp()));