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>
This commit is contained in:
parent
e7cd32274e
commit
f8f3f0fbd4
@ -131,7 +131,7 @@ extern bool qt_is_gui_used;
|
|||||||
|
|
||||||
Q_GUI_EXPORT int qt_defaultDpiX()
|
Q_GUI_EXPORT int qt_defaultDpiX()
|
||||||
{
|
{
|
||||||
if (qApp->testAttribute(Qt::AA_Use96Dpi))
|
if (QCoreApplication::instance()->testAttribute(Qt::AA_Use96Dpi))
|
||||||
return 96;
|
return 96;
|
||||||
|
|
||||||
if (!qt_is_gui_used)
|
if (!qt_is_gui_used)
|
||||||
@ -146,7 +146,7 @@ Q_GUI_EXPORT int qt_defaultDpiX()
|
|||||||
|
|
||||||
Q_GUI_EXPORT int qt_defaultDpiY()
|
Q_GUI_EXPORT int qt_defaultDpiY()
|
||||||
{
|
{
|
||||||
if (qApp->testAttribute(Qt::AA_Use96Dpi))
|
if (QCoreApplication::instance()->testAttribute(Qt::AA_Use96Dpi))
|
||||||
return 96;
|
return 96;
|
||||||
|
|
||||||
if (!qt_is_gui_used)
|
if (!qt_is_gui_used)
|
||||||
|
Loading…
Reference in New Issue
Block a user