33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import addon from '../../utils/addon';
|
|
import { NodeWidget } from '../QWidget';
|
|
import { NativeElement } from '../../core/Component';
|
|
import { QKeySequence } from '../../QtGui/QKeySequence';
|
|
import { ShortcutContext } from '../../QtEnums';
|
|
import { QObject } from '../../QtCore/QObject';
|
|
|
|
export const QShortcutEvents = Object.freeze({
|
|
activated: 'activated',
|
|
activatedAmbiguously: 'activatedAmbiguously',
|
|
});
|
|
|
|
export class QShortcut extends QObject {
|
|
native: NativeElement;
|
|
constructor(parent: NodeWidget) {
|
|
const native = new addon.QShortcut(parent.native);
|
|
super(native);
|
|
this.native = native;
|
|
}
|
|
setEnabled(enabled: boolean): void {
|
|
this.native.setEnabled(enabled);
|
|
}
|
|
setAutoRepeat(on: boolean): void {
|
|
this.native.setAutoRepeat(on);
|
|
}
|
|
setKey(keysequence: QKeySequence): void {
|
|
this.native.setKey(keysequence.native);
|
|
}
|
|
setContext(shortcutContext: ShortcutContext): void {
|
|
this.native.setContext(shortcutContext);
|
|
}
|
|
}
|