File better-hidpi-support.patch of Package qbittorrent
diff --git a/src/app/main.cpp b/src/app/main.cpp
index bf0d5c5be..a08c0ceaa 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -134,13 +134,15 @@ int main(int argc, char *argv[])
// We must save it here because QApplication constructor may change it
bool isOneArg = (argc == 2);
-#if !defined(DISABLE_GUI) && (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
+#if !defined(DISABLE_GUI)
// 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);
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
// HighDPI scale factor policy must be set before QGuiApplication is created
if (qgetenv("QT_SCALE_FACTOR_ROUNDING_POLICY").isEmpty())
Application::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
+#endif
#endif
try
diff --git a/src/gui/utils.cpp b/src/gui/utils.cpp
index 7bd1f5713..d5086a2ad 100644
--- a/src/gui/utils.cpp
+++ b/src/gui/utils.cpp
@@ -54,6 +54,7 @@
void Utils::Gui::resize(QWidget *widget, const QSize &newSize)
{
+ return;
if (newSize.isValid())
widget->resize(newSize);
else // depends on screen DPI
@@ -62,6 +63,7 @@ void Utils::Gui::resize(QWidget *widget, const QSize &newSize)
qreal Utils::Gui::screenScalingFactor(const QWidget *widget)
{
+ return 1.0;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
Q_UNUSED(widget);
return 1;
@@ -87,27 +89,29 @@ qreal Utils::Gui::screenScalingFactor(const QWidget *widget)
QPixmap Utils::Gui::scaledPixmap(const QIcon &icon, const QWidget *widget, const int height)
{
Q_ASSERT(height > 0);
- const int scaledHeight = height * Utils::Gui::screenScalingFactor(widget);
- return icon.pixmap(scaledHeight);
+// const int scaledHeight = height * Utils::Gui::screenScalingFactor(widget);
+ return icon.pixmap(height);
}
QPixmap Utils::Gui::scaledPixmap(const QString &path, const QWidget *widget, const int height)
{
const QPixmap pixmap(path);
- const int scaledHeight = ((height > 0) ? height : pixmap.height()) * Utils::Gui::screenScalingFactor(widget);
- return pixmap.scaledToHeight(scaledHeight, Qt::SmoothTransformation);
+// const int scaledHeight = ((height > 0) ? height : pixmap.height()) * Utils::Gui::screenScalingFactor(widget);
+// return pixmap.scaledToHeight(scaledHeight, Qt::SmoothTransformation);
+ QIcon ico(path);
+ return ico.pixmap(height > 0 ? height : pixmap.height());
}
QPixmap Utils::Gui::scaledPixmapSvg(const QString &path, const QWidget *widget, const int baseHeight)
{
- const int scaledHeight = baseHeight * Utils::Gui::screenScalingFactor(widget);
- const QString normalizedKey = path + '@' + QString::number(scaledHeight);
+// const int scaledHeight = baseHeight * Utils::Gui::screenScalingFactor(widget);
+ const QString normalizedKey = path + '@' + QString::number(baseHeight);
QPixmap pm;
QPixmapCache cache;
if (!cache.find(normalizedKey, &pm))
{
- pm = QIcon(path).pixmap(scaledHeight);
+ pm = QIcon(path).pixmap(baseHeight);
cache.insert(normalizedKey, pm);
}
return pm;