LensStudio:Ui.Shortcut
ClassKeyboard shortcut bound to a widget that emits a signal when its key sequence is activated.
Index
Properties
Methods
Example
const root = new Widget(parent);
const layout = new BoxLayout();
layout.setDirection(Direction.TopToBottom);
root.layout = layout;
const status = new Label(root);
status.text = 'Press Ctrl+Shift+R';
layout.addWidgetWithStretch(status, 0, 0);
const shortcut = new Shortcut(root, 'Ctrl+Shift+R', ShortcutContext.WidgetShortcut);
this.connections.push(
shortcut.onActivated.connect(() => {
status.text = 'Ctrl+Shift+R activated';
}),
);
Extends
Constructors
Constructor
new Shortcut(
parent,keySequence,context):Shortcut
Constructs a shortcut on the parent widget for the given key sequence and activation context.
Parameters
| Parameter | Type |
|---|---|
parent | Widget |
keySequence | string |
context | ShortcutContext |
Returns
Shortcut
Overrides
ScriptObject.constructor
Properties
onActivated
readonlyonActivated:signal0<void>
Emitted when the shortcut's key sequence is pressed.
onActivatedAmbiguously
readonlyonActivatedAmbiguously:signal0<void>
Emitted when the key sequence matches multiple shortcuts and the target is ambiguous.
Methods
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean