mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00: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
0b63f35a54
commit
f934042a98
@ -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 New Issue
Block a user