The bug: http://bugzilla.lyx.org/show_bug.cgi?id=3588

On MacOSX enter is no activation key for a QListWidget. Hence it does not close the command completion popup. Moreover setFocus does not focus the widget correctly, probably because the popup widget behavior is different. An activateWindow solves the problem by selecting the LyX view again as active window.

I have tested it only on OSX. Would be good if somebody confirms that it works on Windows and Linux.

Stefan

Index: src/frontends/qt4/QCommandBuffer.cpp
===================================================================
--- src/frontends/qt4/QCommandBuffer.cpp        (Revision 18815)
+++ src/frontends/qt4/QCommandBuffer.cpp        (Arbeitskopie)
@@ -66,8 +66,11 @@
                if (ev->key() == Qt::Key_Escape) {
                        hide();
                        return;
-               }
-               QListWidget::keyPressEvent(ev);
+ } else if (ev->key() == Qt::Key_Return || ev->key() == Qt::Key_Space) {
+                       // emit signal
+                       itemPressed(currentItem());
+               } else
+                       QListWidget::keyPressEvent(ev);
        }
 };

@@ -185,6 +188,7 @@
        QWidget const * widget = static_cast<QWidget const *>(sender());
        const_cast<QWidget *>(widget)->hide();
        edit_->setText(item->text() + ' ');
+       edit_->activateWindow();
        edit_->setFocus();
 }

Attachment: commandbufferfocus.patch
Description: Binary data

Attachment: PGP.sig
Description: Signierter Teil der Nachricht

Reply via email to