diff options
Diffstat (limited to 'src/gui/text/qfont.cpp')
-rw-r--r-- | src/gui/text/qfont.cpp | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 804d3f9e66..1ac398967d 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -138,36 +138,32 @@ extern bool qt_is_gui_used; Q_GUI_EXPORT int qt_defaultDpiX() { + if (qApp->testAttribute(Qt::AA_Use96Dpi)) + return 96; + if (!qt_is_gui_used) return 75; - int dpi; - QScreen *screen = QGuiApplication::primaryScreen(); - if (screen) { - dpi = qRound(screen->logicalDotsPerInchX()); - } else { - //PI has not been initialised, or it is being initialised. Give a default dpi - dpi = 100; - } + if (const QScreen *screen = QGuiApplication::primaryScreen()) + return qRound(screen->logicalDotsPerInchX()); - return dpi; + //PI has not been initialised, or it is being initialised. Give a default dpi + return 100; } Q_GUI_EXPORT int qt_defaultDpiY() { + if (qApp->testAttribute(Qt::AA_Use96Dpi)) + return 96; + if (!qt_is_gui_used) return 75; - int dpi; - QScreen *screen = QGuiApplication::primaryScreen(); - if (screen) { - dpi = qRound(screen->logicalDotsPerInchY()); - } else { - //PI has not been initialised, or it is being initialised. Give a default dpi - dpi = 100; - } + if (const QScreen *screen = QGuiApplication::primaryScreen()) + return qRound(screen->logicalDotsPerInchY()); - return dpi; + //PI has not been initialised, or it is being initialised. Give a default dpi + return 100; } Q_GUI_EXPORT int qt_defaultDpi() |