diff options
author | Jan Kundrát <jkt@flaska.net> | 2013-04-23 16:03:36 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-24 16:24:40 +0200 |
commit | 78fc0d4872bc4908d4615c3975d566fa2e1839eb (patch) | |
tree | 3202b496142f4ccac505160e6c31f87748aecf66 /src | |
parent | 4afb128d312a7f2a1d94e2becc5aaaec47326869 (diff) |
Respond to the _NET_WM_CONTEXT_HELP WM_PROTOCOLS message
This change restores a proper function of the "(?)" button in the window
decorations which is used as a clue for the user to check what a particular
widget is supposed to do. The change is only implemented for QtWidgets because
the underlying QWhatsThis is inherently widget-specific -- which is why it sends
an event to QGuiApplication, but only processes it in the QtWidget-specific
QApplication.
Thanks to Alberto Mardegan and Gunnar Sletta for their feedback on this patch.
Change-Id: Ibb912e3960f1e9aec54c5ed77ade1c6744d6ca23
Reviewed-by: Alberto Mardegan <mardy@users.sourceforge.net>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 5 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 4090758d36..7d6d6a94b3 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1492,6 +1492,11 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even connection()->setTime(event->data.data32[1]); m_syncValue.lo = event->data.data32[2]; m_syncValue.hi = event->data.data32[3]; +#ifndef QT_NO_WHATSTHIS + } else if (event->data.data32[0] == atom(QXcbAtom::_NET_WM_CONTEXT_HELP)) { + QEvent *e = new QEvent(QEvent::EnterWhatsThisMode); + QGuiApplication::postEvent(QGuiApplication::instance(), e); +#endif } else { qWarning() << "QXcbWindow: Unhandled WM_PROTOCOLS message:" << connection()->atomName(event->data.data32[0]); } diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index d036f6bada..b8d3117a41 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -72,6 +72,9 @@ #include <QtGui/qstylehints.h> #include <QtGui/qinputmethod.h> #include <qpa/qplatformtheme.h> +#ifndef QT_NO_WHATSTHIS +#include <QtWidgets/QWhatsThis> +#endif #include "private/qkeymapper_p.h" @@ -1856,6 +1859,11 @@ bool QApplication::event(QEvent *e) } else if (te->timerId() == d->toolTipFallAsleep.timerId()) { d->toolTipFallAsleep.stop(); } +#ifndef QT_NO_WHATSTHIS + } else if (e->type() == QEvent::EnterWhatsThisMode) { + QWhatsThis::enterWhatsThisMode(); + return true; +#endif } if(e->type() == QEvent::LanguageChange) { |