New AA_DisableWindowContextHelpButton to globally hide ? button
Dialogs and Sheets by default have the WindowsContextHelpButtonHint set, which adds a question mark button to dialogs on Windows. This button then triggers the 'What's this' mode by changing the cursor, and letting the user explore the UI by showing whatsThis tooltips. Anyhow, the paradigm is little used today and a lot of applications do not set any whatsThis properties, leaving the mode pretty non-functional. It's therefore common to explicitly remove the WindowsContextHelpButtonHint from dialogs. However, this has to be done for _every_ dialog. Instead, this patch adds a global application flag to not set the WindowsContextHelpButtonHint by default. This allows developers to already buy into the Qt 6 behavior, where the flag will not be set anymore by default. [ChangeLog][QtWidgets] Added AA_DisableWindowContextHelpButton attribute. Setting this attribute globally prevents the automatic "What's this" button on dialogs on Windows (WindowsContextHelpButtonHint). Change-Id: I497a79575f222c78b2d5d051a6de346b231f72d3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
9f5aec777a
commit
afb7d99af9
@ -513,6 +513,7 @@ public:
|
||||
AA_DisableShaderDiskCache = 27,
|
||||
AA_DontShowShortcutsInContextMenus = 28,
|
||||
AA_CompressTabletEvents = 29,
|
||||
AA_DisableWindowContextHelpButton = 30, // ### Qt 6: remove me
|
||||
|
||||
// Add new attributes before this line
|
||||
AA_AttributeCount
|
||||
|
@ -275,6 +275,12 @@
|
||||
\e glProgramBinary(). In the unlikely event of this being problematic,
|
||||
set this attribute to disable all disk-based caching of shaders.
|
||||
|
||||
\value AA_DisableWindowContextHelpButton Disables the WindowContextHelpButtonHint
|
||||
by default on Qt::Sheet and Qt::Dialog widgets. This hides the \gui ? button
|
||||
on Windows, which only makes sense if you use \l QWhatsThis functionality.
|
||||
This value has been added in Qt 5.10. For Qt 6, WindowContextHelpButtonHint
|
||||
will not be set by default.
|
||||
|
||||
The following values are obsolete:
|
||||
|
||||
\value AA_ImmediateWidgetCreation This attribute is no longer fully
|
||||
|
@ -1117,9 +1117,12 @@ void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w)
|
||||
}
|
||||
if (customize)
|
||||
; // don't modify window flags if the user explicitly set them.
|
||||
else if (type == Qt::Dialog || type == Qt::Sheet)
|
||||
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint;
|
||||
else if (type == Qt::Tool)
|
||||
else if (type == Qt::Dialog || type == Qt::Sheet) {
|
||||
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
|
||||
// ### fixme: Qt 6: Never set Qt::WindowContextHelpButtonHint flag automatically
|
||||
if (!QApplicationPrivate::testAttribute(Qt::AA_DisableWindowContextHelpButton))
|
||||
flags |= Qt::WindowContextHelpButtonHint;
|
||||
} else if (type == Qt::Tool)
|
||||
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
|
||||
else
|
||||
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint |
|
||||
|
Loading…
x
Reference in New Issue
Block a user