Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.4.2, 5.5.0, 5.5.1, 5.6.0, 5.6.1, 5.7.0
-
None
-
All Windows
-
9944a12a0f57087ea19ae428ffcd974ac0fed7bc
Description
Usually if someone presses the key combination it is pressed like this (for example Alt+Z):
Push Alt -> Push Z -> Release Z -> Release Alt
And the last two actions are almost simultaneous. This is the reason why sometimes the combination is press in this way:
Push Alt -> Push Z -> Release Alt -> Release Z
In this second case Editor is losing focus and it is impossible to continue typing ... you need to press Esc to continue typing. And this is VERY inconvenient because it happens not regularly!
Try to press Alt+Z 10 times (for example in test app with code given below) and see how many times you will end up in top menu selected (and editor will lose focus).
This behavior is not happening in native windows applications like office.
Menu should be activated ONLY if single Alt is pressed
Push Alt -> Release Alt
Newly created Qt Widget application which shows the behavior:
#include <QApplication> #include <QMainWindow> #include <QMenuBar> #include <QPlainTextEdit> class Window : public QMainWindow { public: Window() { QPlainTextEdit *edit = new QPlainTextEdit; setCentralWidget(edit); QMenu *menu = menuBar()->addMenu("File"); QAction *action = menu->addAction("Some Action"); action->setShortcut(QKeySequence("Alt+Z")); } }; int main(int argc, char *argv[]) { QApplication app(argc, argv); Window w; w.show(); return app.exec(); }
Moreover the discussed behavior depends on existence of Action with this combination of keys which means that widgets were designed to behave in the right manner ... but adding of Action influences that.
Try to press Alt+X 10 times in example app and you will never activate menu.
P.S.
Existence of QPlainTextEdit in the example app is not influencing the behavior so it can be commented:
//QPlainTextEdit *edit = new QPlainTextEdit; //setCentralWidget(edit);
Attachments
Issue Links
- is duplicated by
-
QTBUG-46685 Editor lost focus undesirably
-
- Closed
-
- relates to
-
QTBUG-56860 Focus is not returned to correct widget after second access to menus
-
- Closed
-