summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/styles/qstylehelper.cpp23
1 files changed, 3 insertions, 20 deletions
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index 823d29bc83..8f2d7364c1 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -46,17 +46,13 @@
#include <private/qstyle_p.h>
#include <qmath.h>
-#if defined(Q_WS_WIN)
-#include "qt_windows.h"
-#elif defined(Q_WS_MAC)
-#include <private/qt_cocoa_helpers_mac_p.h>
-#endif
-
#include "qstylehelper_p.h"
#include <qstringbuilder.h>
QT_BEGIN_NAMESPACE
+Q_GUI_EXPORT int qt_defaultDpiX();
+
namespace QStyleHelper {
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
@@ -81,20 +77,7 @@ QString uniqueName(const QString &key, const QStyleOption *option, const QSize &
qreal dpiScaled(qreal value)
{
- static qreal scale = -1;
- if (scale < 0) {
- scale = 1.0;
-#if defined(Q_WS_WIN)
- {
- HDC hdcScreen = GetDC(0);
- int dpi = GetDeviceCaps(hdcScreen, LOGPIXELSX);
- ReleaseDC(0, hdcScreen);
- scale = dpi/96.0;
- }
-#elif defined(Q_WS_MAC)
- scale = qt_mac_get_scalefactor();
-#endif
- }
+ static const qreal scale = qreal(qt_defaultDpiX()) / 96.0;
return value * scale;
}