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:
parent
4a271d358f
commit
b5adbaef78
@ -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;
|
||||
|
@ -37,8 +37,6 @@
|
||||
#include <QBitArray>
|
||||
#include <QVector>
|
||||
|
||||
#define BAR_HEIGHT 18
|
||||
|
||||
class DownloadedPiecesBar: public QWidget {
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(DownloadedPiecesBar)
|
||||
|
@ -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;
|
||||
|
@ -35,9 +35,6 @@
|
||||
#include <QPainter>
|
||||
#include <QImage>
|
||||
|
||||
#define BAR_HEIGHT 18
|
||||
|
||||
|
||||
class PieceAvailabilityBar: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -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()));
|
||||
|
Loading…
Reference in New Issue
Block a user