[Qt-interest] How install shortcuts for multiple widgets? [Documentation unclear!]
Wilhelm
wilhelm.meier at fh-kl.de
Thu Feb 10 10:35:47 CET 2011
Hi all,
Am 09.02.2011 13:39, schrieb Frederic Tingaud:
> Le 09/02/2011 13:28, Oliver.Knoll at comit.ch a écrit :
>> But from what I understand the OP has a different use case: there are several editors, and depending which editor has the focus pressing CTRL + S should trigger the "Save action" specific to that editor, or in other words: what needs to be saved is depending on the editor and is /different/ (not the same document to be saved) each time!
> Yes, that is also what I understand.
>
>> My educated guess would be that this "shortcut context" thing might only work between "dialog and main windows", but not between common QWidgets?
>>
> From what I remember, but I could be wrong, context works well if you
> have for example two dock widgets at the same level. With a main window
> and a dock widget, however, I would like the shortcut of the main window
> to work when any child of the main window except the dock that redefines
> my shortcut has the focus, and I couldn't find a way to do this with the
> context.
>
thank you for all the valuable input!
Some further tests revealed two things I am at least unhappy with:
i) official documentation states clearly:
Qt::WidgetShortcut 0 The shortcut is active when its parent widget has
focus.
But if I set this the shortcut is *not* working at all!
ii) some Qt widgets like QTextEdit etc. look into the shortcutMap of the
QApplication-Singleton and decide to *not* install a shortcut for e.g.
QSequence::Cut if there exists one (so the shortcut-key is not shown in
the contextmenu of QTextEdit). But third-party widgets can't do that!
--
Wilhelm
More information about the Qt-interest-old
mailing list