O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required