diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-03-15 16:07:11 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-03-16 10:37:39 +0000 |
commit | f8f3f0fbd468feaf14adcedbccbf6b434f2e2e49 (patch) | |
tree | 7bb48d33b2492ef4e334b03014eb0a71e46fb54e /src/gui/text/qfont.cpp | |
parent | e7cd32274e144144c1630d65d09d24a1ae0af2d7 (diff) |
Correct qt_defaultDpi X/Y with just a QCoreApplication
Makes the 96DPI attribute check avoid undefined behavior by using
QCoreApplication::instance() directly, instead of calling through
qApp, which performs an invalid cast to QGuiApplication.
Change-Id: Ib86e7d2461b462a2d623f1364414f7d4d2293f22
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/gui/text/qfont.cpp')
-rw-r--r-- | src/gui/text/qfont.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 2c5a0c74fc..fe68149346 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -131,7 +131,7 @@ extern bool qt_is_gui_used; Q_GUI_EXPORT int qt_defaultDpiX() { - if (qApp->testAttribute(Qt::AA_Use96Dpi)) + if (QCoreApplication::instance()->testAttribute(Qt::AA_Use96Dpi)) return 96; if (!qt_is_gui_used) @@ -146,7 +146,7 @@ Q_GUI_EXPORT int qt_defaultDpiX() Q_GUI_EXPORT int qt_defaultDpiY() { - if (qApp->testAttribute(Qt::AA_Use96Dpi)) + if (QCoreApplication::instance()->testAttribute(Qt::AA_Use96Dpi)) return 96; if (!qt_is_gui_used) |