mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-12 10:07:27 +03:00
Fix GUI scaling factor on macOS
macOS seems have an unique way to handle widget size, that is, it doesn't require application to resize widgets manually, Qt will handle the resize job automatically. Closes #8841.
This commit is contained in:
parent
4168772904
commit
17c0463906
1 changed files with 6 additions and 1 deletions
|
@ -45,16 +45,21 @@ void Utils::Gui::resize(QWidget *widget, const QSize &newSize)
|
|||
|
||||
qreal Utils::Gui::screenScalingFactor(const QWidget *widget)
|
||||
{
|
||||
if (!widget)
|
||||
return 1;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
const int screen = qApp->desktop()->screenNumber(widget);
|
||||
return (QApplication::screens()[screen]->logicalDotsPerInch() / 96);
|
||||
#elif defined(Q_OS_MAC)
|
||||
return 1;
|
||||
#else
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
||||
return widget->devicePixelRatioF();
|
||||
#else
|
||||
return widget->devicePixelRatio();
|
||||
#endif
|
||||
#endif // Q_OS_WIN
|
||||
#endif
|
||||
}
|
||||
|
||||
QPixmap Utils::Gui::scaledPixmap(const QString &path, const QWidget *widget, const int height)
|
||||
|
|
Loading…
Reference in a new issue