On Thu, Jun 18, 2015 at 03:11:25AM -0400, Scott Kostyshak wrote:

> On Thu, Jun 18, 2015 at 08:51:12AM +0200, Kornel Benko wrote:
> > Am Donnerstag, 18. Juni 2015 um 08:38:28, schrieb Enrico Forestieri 
> > <for...@lyx.org>
> > > On Thu, Jun 18, 2015 at 02:24:30AM -0400, Scott Kostyshak wrote:
> > > > 
> > > > What do you mean? For me M-x does not toggle, it just opens the
> > > > mini-buffer. Actually I just tested and if I press it rapidly many times
> > > > sometimes I can get it to close the mini-buffer. Yours toggles
> > > > perfectly? I wonder if this is because I am using Qt 5.
> > > 
> > > Qt 5 here, and M-x toggles the mini-buffer. More precisely, if the
> > > mini-buffer is already open and the cursor is not in it, M-x takes
> > > the cursor there and a subsequent M-x closes it.
> 
> Enrico, which Qt 5 version are you using? That behavior is exactly the
> one that I would like, and the one I'm guessing is intended.

Self compiled Qt 5.4.2 with the attached patch that avoids the
shortcut problem.

-- 
Enrico
Index: src/widgets/kernel/qapplication.cpp
===================================================================
--- src/widgets/kernel/qapplication.cpp.old     2014-05-15 19:12:12.000000000 
+0200
+++ src/widgets/kernel/qapplication.cpp 2014-07-16 23:57:24.000000000 +0200
@@ -3137,14 +3137,15 @@
                 QKeyEvent* key = static_cast<QKeyEvent*>(e);
 #ifndef QT_NO_SHORTCUT
                 // Try looking for a Shortcut before sending key events
-                QObject *shortcutReceiver = receiver;
+                QObject *shortcutReceiver = Q_NULLPTR;
                 if (!isWidget && isWindow) {
-                    QWindow *w = qobject_cast<QWindow *>(receiver);
-                    QObject *focus = w ? w->focusObject() : 0;
-                    if (focus)
+                    QObject *focus = static_cast<QWindow 
*>(receiver)->focusObject();
+                    if (focus && !focus->isWidgetType()) // QWidgetWindow 
takes care.
                         shortcutReceiver = focus;
+                } else {
+                    shortcutReceiver = receiver;
                 }
-                if 
(qApp->d_func()->shortcutMap.tryShortcutEvent(shortcutReceiver, key))
+                if (shortcutReceiver && 
d->shortcutMap.tryShortcutEvent(shortcutReceiver, key))
                     return true;
 #endif
                 qt_in_tab_key_event = (key->key() == Qt::Key_Backtab

Reply via email to