[Development] QKeySequenceEdit questions

Laszlo Papp lpapp at kde.org
Mon May 16 19:12:36 CEST 2022


On Mon, May 16, 2022 at 2:57 PM Volker Hilsheimer <volker.hilsheimer at qt.io>
wrote:

>
>
> > On 11 May 2022, at 16:02, Laszlo Papp <lpapp at kde.org> wrote:
> >
> > Hi,
> >
> > 1. I would like QKeySequenceEdit to block the processing of hotkeys
> while recording, so that the new hotkey being recorded is not getting
> handled (e.g. cmd+q does not close the Qt app in this mode).
> >
> > Is this already possible to achieve? I think that modal dialogs work ok
> for example. But in my case, I am not using a model dialog.
> >
> > Here is a testbed where you can reproduce the issue:
> https://github.com/lpapp/examples/tree/main/qt-hotkey-editor
> >
>
> Hi Laszlo,
>
>
> I’ll have to look a bit more, but looking at the code I see that
> QKeySequenceEdit accepts both the ShortcutOverride and the Shortcut event,
> so it should take precedence over any application-defined shortcut.
> If/since that doesn’t work,
>
> But since you write cmd+q (and considering your recent patches) I think
> that perhaps you are on macOS, and it might be that our macOS shortcut code
> doesn't respect the focus widget’s override for application level shortcuts.
>
> Bottom line anyway: this should already work, so if it doesn’t, I’d
> consider that a bug.
>

Yes, it seems to work on Windows and Mac. I have not noticed until you
mentioned it. Thanks for pointing that out.

1. Is there an easy workaround until this gets fixed in Qt?
2. Where would I need to look if I wanted to help you out by sending a
patch for Qt so that future versions will work on Mac?


> > 2. Is it possible to configure QKeySequenceEdit not to support multiple
> keypresses as a shortcut for an action? It seems to be the default
> behaviour and it feels a bit odd at first. At least, not how we would like
> to use this. I am referring to the "A, B, C" setup that is possible. If
> not, is this something that should be configurable?
>
> Making it possible to configure the max length of the recorded
> QKeySequence could be a useful feature addition. I don’t see that this is
> possible today, but implementing it might not require much more than
> replacing the use of QKeySequencePrivate::MaxKeyCount with a property.
>

So, you would propose to do that in QtGui::QKeySequence then, I assume,
rather than QtWidgets::QKeySequenceEdit, right?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20220516/b33741a0/attachment.htm>


More information about the Development mailing list