Windows QPA: Improve warning about SetProcessDpiAwareness() failure
Silence warning in case DPI awareness was set externally unless debug is enabled. Task-number: QTBUG-54416 Change-Id: Id48769e3d4be3047f582e331633905c640930f21 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
parent
be6921e860
commit
596ce989b5
@ -409,7 +409,9 @@ void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiA
|
||||
qCDebug(lcQpaWindows) << __FUNCTION__ << dpiAwareness;
|
||||
if (QWindowsContext::shcoredll.isValid()) {
|
||||
const HRESULT hr = QWindowsContext::shcoredll.setProcessDpiAwareness(dpiAwareness);
|
||||
if (FAILED(hr)) {
|
||||
// E_ACCESSDENIED means set externally (MSVC manifest or external app loading Qt plugin).
|
||||
// Silence warning in that case unless debug is enabled.
|
||||
if (FAILED(hr) && (hr != E_ACCESSDENIED || lcQpaWindows().isDebugEnabled())) {
|
||||
qWarning().noquote().nospace() << "SetProcessDpiAwareness("
|
||||
<< dpiAwareness << ") failed: " << QWindowsContext::comErrorString(hr)
|
||||
<< ", using " << QWindowsContext::processDpiAwareness();
|
||||
@ -843,6 +845,9 @@ QByteArray QWindowsContext::comErrorString(HRESULT hr)
|
||||
case E_UNEXPECTED:
|
||||
result += QByteArrayLiteral("E_UNEXPECTED");
|
||||
break;
|
||||
case E_ACCESSDENIED:
|
||||
result += QByteArrayLiteral("E_ACCESSDENIED");
|
||||
break;
|
||||
case CO_E_ALREADYINITIALIZED:
|
||||
result += QByteArrayLiteral("CO_E_ALREADYINITIALIZED");
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user