[Interest] Press and hold keyboard key to bring up menu in QML

Elvis Stansvik elvstone at gmail.com
Fri Apr 1 17:08:08 CEST 2016


2016-04-01 16:40 GMT+02:00 Jérôme Godbout <jerome at bodycad.com>:
> The hardware side should do this, you will be able to debounced the inputs,
> filter them and avoid glitch and even make repeated or inertia of those keys
> more easily.

Yes, that makes sense. Also thanks for teaching me a new word :) (debounce).

Elvis

>
> On Fri, Apr 1, 2016 at 8:33 AM, Elvis Stansvik <elvstone at gmail.com> wrote:
>>
>> 2016-04-01 12:45 GMT+02:00 Elvis Stansvik <elvstone at gmail.com>:
>> > Hi folks,
>> >
>> > I have a full screen, page based Qt Quick 2 application. Input is
>> > contstrained by the hardware to the Left/Right/Return keyboard keys,
>> > so is quite limited, and navigation between pages is done using
>> > buttons on each page which handle return presses using (most of the
>> > time) Keys.onReturnPressed and navigation between buttons and other
>> > items with KeyNavigation.left/right.
>> >
>> > I now have the need to provide a special global shortcut: On almost
>> > all of the screens, holding the Enter key for 3 seconds should bring
>> > the user immediately to a sort of start screen, where he/she can
>> > choose to go into Settings or Power Off. Kind of like how holding the
>> > power button on a phone often brings up a power off/flight mode menu.
>> >
>> > I'm struggling to find a good way to handle this centrally: since
>> > Enter presses are normally accepted (swallowed) by my various buttons
>> > and other input items on the pages, where can I put some central key
>> > press/release handler in which to start/stop a timer (to determine if
>> > it was a long 3 sec press or not)?
>> >
>> > My pages are FocusScopes stuffed in a StackView inside a Window.
>> >
>> > Many thanks for any advice. Has noone had this kind of requirement
>> > before? (Global "hold key" shortcut).
>>
>> Actually, scratch this. Our input device is a pushable wheel, and I've
>> realized now that we better re-program the Arduino we have hooked up
>> to it to have the logic to determine "long" vs "short" presses there
>> instead, and deliver these as distinct keypresses.
>>
>> Elvis
>>
>> >
>> > Elvis
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>
>



More information about the Interest mailing list