Windows: Ensure DPI awareness is set only once.
Fix warning: QWARN : tst_QGuiApplication::execAfterExit() SetProcessDpiAwareness failed: "COM error 0xffffffff80070005 (Unknown error 0x0ffffffff80070005)" occurring when instantiating QGuiApplication repeatedly in tests. Task-number: QTBUG-38993 Change-Id: Id6c8e915b25011bb60c2f8b1d0e4a794cd345647 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
parent
501fe9f939
commit
f6ee80912f
@ -217,6 +217,7 @@ QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList ¶mL
|
||||
: m_options(0)
|
||||
, m_fontDatabase(0)
|
||||
{
|
||||
static bool dpiAwarenessSet = false;
|
||||
int tabletAbsoluteRange = -1;
|
||||
// Default to per-monitor awareness to avoid being scaled when monitors with different DPI
|
||||
// are connected to Windows 8.1
|
||||
@ -224,7 +225,10 @@ QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList ¶mL
|
||||
m_options = parseOptions(paramList, &tabletAbsoluteRange, &dpiAwareness);
|
||||
if (tabletAbsoluteRange >= 0)
|
||||
m_context.setTabletAbsoluteRange(tabletAbsoluteRange);
|
||||
m_context.setProcessDpiAwareness(dpiAwareness);
|
||||
if (!dpiAwarenessSet) { // Set only once in case of repeated instantiations of QGuiApplication.
|
||||
m_context.setProcessDpiAwareness(dpiAwareness);
|
||||
dpiAwarenessSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
QWindowsIntegrationPrivate::~QWindowsIntegrationPrivate()
|
||||
|
Loading…
x
Reference in New Issue
Block a user