tdf#124292 Qt5 / KDE5 disable Qt's HiDPI scaling

LO does its own layouting and also all the scaling, so disable
the automatic HiDPI scaling explicitly. Otherwise fonts will be
rendered in LoDPI and just scaled as an image, if UI scaling is
enabled in KDE, resulting in really blocky / ugly fonts.

Change-Id: I38503ce27c1671e80d0749d21c6c6dcff1a808a6
Reviewed-on: https://gerrit.libreoffice.org/69941
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
(cherry picked from commit b4698a2241ec26d796c66da3a814f7cc693785b6)
Reviewed-on: https://gerrit.libreoffice.org/69984
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
diff --git a/vcl/qt5/Qt5Graphics_GDI.cxx b/vcl/qt5/Qt5Graphics_GDI.cxx
index 90baba3..851d222 100644
--- a/vcl/qt5/Qt5Graphics_GDI.cxx
+++ b/vcl/qt5/Qt5Graphics_GDI.cxx
@@ -643,8 +643,8 @@
        return;

    QScreen* pScreen = m_pFrame->GetQWidget()->window()->windowHandle()->screen();
    rDPIX = pScreen->logicalDotsPerInchX();
    rDPIY = pScreen->logicalDotsPerInchY();
    rDPIX = pScreen->logicalDotsPerInchX() * pScreen->devicePixelRatio() + 0.5;
    rDPIY = pScreen->logicalDotsPerInchY() * pScreen->devicePixelRatio() + 0.5;
}

sal_uInt16 Qt5Graphics::GetBitCount() const { return getFormatBits(m_pQImage->format()); }
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index adbe70b..8de9fc7 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -336,6 +336,8 @@
        unsetenv("SESSION_MANAGER");
    }

    QApplication::setAttribute(Qt::AA_DisableHighDpiScaling);

    int* pFakeArgc = new int;
    *pFakeArgc = nFakeArgc;
    pQApplication = new QApplication(*pFakeArgc, pFakeArgv);
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 290127d..0b4b428 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -78,8 +78,8 @@
        return;

    QScreen* pScreen = m_pFrame->GetQWidget()->window()->windowHandle()->screen();
    rDPIX = pScreen->logicalDotsPerInchX();
    rDPIY = pScreen->logicalDotsPerInchY();
    rDPIX = pScreen->logicalDotsPerInchX() * pScreen->devicePixelRatio() + 0.5;
    rDPIY = pScreen->logicalDotsPerInchY() * pScreen->devicePixelRatio() + 0.5;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalInstance.cxx b/vcl/unx/kde5/KDE5SalInstance.cxx
index 401afbc..32998cd 100644
--- a/vcl/unx/kde5/KDE5SalInstance.cxx
+++ b/vcl/unx/kde5/KDE5SalInstance.cxx
@@ -144,6 +144,8 @@
        unsetenv("SESSION_MANAGER");
    }

    QApplication::setAttribute(Qt::AA_DisableHighDpiScaling);

    int* pFakeArgc = new int;
    *pFakeArgc = nFakeArgc;
    pQApplication = new QApplication(*pFakeArgc, pFakeArgv);