There is a bug with the new Shortcut input dialog. Namely, you can
input Alt-x, Shift-x, but not Ctrl-x (C- is displayed), despite the
fact that these modifiers are handled in the same way. I traced the
bug and find that in setKeySymbol(), QKeyEvent->text() yields 't' for
Alt-t and Shift-t, but NOT for Ctrl-t. In the mean time, getSymbolName
rely on this text() for the key name (and does not work properly for
Ctrl-x).

This is clear if you apply the attached patch, which is of course not
the best way to fix the problem. Does anyone know what is going on
here? At the very least, the qt manual says text() returns the unicode
representation of the keyevent, with no gurantee that C-t lead to 't'.

Thanks.
Bo
Index: src/frontends/qt4/GuiKeySymbol.cpp
===================================================================
--- src/frontends/qt4/GuiKeySymbol.cpp	(revision 21230)
+++ src/frontends/qt4/GuiKeySymbol.cpp	(working copy)
@@ -77,6 +77,13 @@
 void setKeySymbol(KeySymbol * sym, QKeyEvent * ev)
 {
 	sym->setKey(ev->key());
+
+	lyxerr << "Get key " << ev->key() << " text '" << fromqstr(ev->text()) << "'" << std::endl;
+	if ((ev->key() >= Qt::Key_A && ev->key() <= Qt::Key_Z)) {
+		sym->setText(docstring() + ev->key());
+		return;
+	}
+
 	if (ev->text().isNull()) {
 		LYXERR(Debug::KEY) << "keyevent has isNull() text !" << endl;
 		sym->setText(docstring());

Reply via email to