mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-05 19:34:17 +00:00
Merge pull request #12102 from Kolcha/hidpi
Delegate GUI scaling work to Qt
This commit is contained in:
commit
095ef67e30
@ -133,6 +133,12 @@ int main(int argc, char *argv[])
|
|||||||
// We must save it here because QApplication constructor may change it
|
// We must save it here because QApplication constructor may change it
|
||||||
bool isOneArg = (argc == 2);
|
bool isOneArg = (argc == 2);
|
||||||
|
|
||||||
|
#if !defined(DISABLE_GUI) && (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
// Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created
|
||||||
|
if (qgetenv("QT_ENABLE_HIGHDPI_SCALING").isEmpty() && qgetenv("QT_AUTO_SCREEN_SCALE_FACTOR").isEmpty())
|
||||||
|
Application::setAttribute(Qt::AA_EnableHighDpiScaling, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Create Application
|
// Create Application
|
||||||
const QString appId = QLatin1String("qBittorrent-") + Utils::Misc::getUserIDString();
|
const QString appId = QLatin1String("qBittorrent-") + Utils::Misc::getUserIDString();
|
||||||
|
@ -62,6 +62,10 @@ void Utils::Gui::resize(QWidget *widget, const QSize &newSize)
|
|||||||
|
|
||||||
qreal Utils::Gui::screenScalingFactor(const QWidget *widget)
|
qreal Utils::Gui::screenScalingFactor(const QWidget *widget)
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
Q_UNUSED(widget);
|
||||||
|
return 1;
|
||||||
|
#else
|
||||||
if (!widget)
|
if (!widget)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -77,6 +81,7 @@ qreal Utils::Gui::screenScalingFactor(const QWidget *widget)
|
|||||||
#else
|
#else
|
||||||
return widget->devicePixelRatioF();
|
return widget->devicePixelRatioF();
|
||||||
#endif // Q_OS_WIN
|
#endif // Q_OS_WIN
|
||||||
|
#endif // QT_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap Utils::Gui::scaledPixmap(const QIcon &icon, const QWidget *widget, const int height)
|
QPixmap Utils::Gui::scaledPixmap(const QIcon &icon, const QWidget *widget, const int height)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user