Disable WindowsContextHelpButtonHint for Dialogs that are not QWidget

Do not set WindowsContextHelpButtonHint directly in Windows QPA plugin,
but instead rely on logic in QWidgetPrivate::adjustFlags for widgets.

If WindowsContextHelpButtonHint is set, a '?' button is shown in the
windows decoration. If pressed, an EnterWhatsThisMode event is generated
that is consumed in QApplication that then calls into the QWhatsThis
singleton, which changes the mouse cursor, and informs the top-level
QWidgets about the state change etc.

For QGuiApplications though the event is not generated, which makes the
button useless by default. In addition, QWhatsThis only works with top
level QWidgets, not e.g. QQuickWindows. So for apps using QApplication
and QtQuick.Controls this means that the "What's this mode" is never
exited.

Given that the paradigm is somewhat outdated on the desktop it is unlikely
that Qt Quick Controls will implement support for What's this. Anyhow,
QWidgetPrivate::adjustFlags sets the hint for Qt::Dialogs, too,
so there's no need to set it the Windows QPA plugin.

[ChangeLog][Windows] 'What's this' button is now shown by default
only for QWidget dialogs.

Task-number: QTBUG-56239
Change-Id: I1ea3e92ade723b5865c8f2e19674413433658942
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Kai Koehne 2016-10-11 11:24:37 +02:00
parent 063997f44f
commit 9d696af6cd

View File

@ -424,11 +424,9 @@ static inline void fixTopLevelWindowFlags(Qt::WindowFlags &flags)
|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint;
break;
case Qt::Dialog:
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint;
break;
case Qt::Tool:
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
break;
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
break;
default:
break;
}