Input chords

The InputChord type allows you to trigger an action when multiple keys are pressed at the same time:

Action {    inputs: InputChord {        timeout: 500        chords: [            ActionInput {                sourceDevice: keyboardDevice                buttons: [Qt.Key_Q]            },            ActionInput {                sourceDevice: keyboardDevice                buttons: [Qt.Key_W]            },            ActionInput {                sourceDevice: keyboardDevice                buttons: [Qt.Key_E]            }        ]    }    onActiveChanged: {        console.log("changed: ", active);    }}

The onActiveChanged handler will be called when Q, W, and E keys are pressed within 500 milliseconds and held together.

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.