Skip to content

QShortcut

QShortcut is a widget that provides a keyboard shortcuts that you can use in your application.

Example

example_shortcut.ts
import { QShortcut, QKeySequence, QMainWindow } from '@vixen-js/core';
const win = new QMainWindow();
const shortcut = new QShortcut(win);
shortcut.setKey(QKeySequence("Ctrl+Q"));
shortcut.setEnabled(true);
shortcut.addEventListener("onActive", () => {
console.info("Shortcut activated");
})
win.show();
// Avoid garbage collection
(global as any).win = win;
(global as any).shortcut = shortcut;

Learn more about QShortcut in: https://doc.qt.io/qt-6/qshortcut.html