EventWidget
Abstract class that adds event handling support to all widgets.
*This class implements an event emitter and merges it with Qt's event and signal system. It allows us to register and unregister event and signal listener at will from javascript**
EventWidget
is an abstract class and hence no instances of the same should be created. It exists so that we can add event handling functionalities to all widget's easily. This is an internal class.
Example
Type parameters
â–ª Signals: unknown
Hierarchy
Index
Constructors
Properties
Methods
Constructors
constructor
+ new EventWidget(native
: NativeElement): EventWidget
Overrides Component.constructor
Parameters:
Name | Type |
---|---|
native | NativeElement |
Returns: EventWidget
Properties
native
• native: NativeElement | null
Inherited from Component.native
Methods
addEventListener
▸ addEventListener‹SignalType›(signalType
: SignalType, callback
: Signals[SignalType], options?
: EventListenerOptions): void
Type parameters:
â–ª SignalType: keyof Signals
Parameters:
Name | Type | Description |
---|---|---|
signalType | SignalType | SignalType is a signal from the widgets signals interface. |
callback | Signals[SignalType] | Corresponding callback for the signal as mentioned in the widget's signal interface |
options? | EventListenerOptions | Extra optional options controlling how this event listener is added. |
Returns: void
void
For example in the case of QPushButton:
â–¸ addEventListener(eventType
: WidgetEventTypes, callback
: function, options?
: EventListenerOptions): void
Parameters:
â–ª eventType: WidgetEventTypes
â–ª callback: function
â–¸ (event?
: NativeRawPointer‹"QEvent"›): void
Parameters:
Name | Type |
---|---|
event? | NativeRawPointer‹"QEvent"› |
â–ªOptional
options: EventListenerOptions
Extra optional options controlling how this event listener is added.
For example in the case of QPushButton:
Returns: void
eventProcessed
â–¸ eventProcessed(): boolean
Get the state of the event processed flag
See setEventProcessed()
.
Returns: boolean
boolean True if the current event is flagged as processed.
removeEventListener
▸ removeEventListener‹SignalType›(signalType
: SignalType, callback
: Signals[SignalType], options?
: EventListenerOptions): void
Type parameters:
â–ª SignalType: keyof Signals
Parameters:
Name | Type |
---|---|
signalType | SignalType |
callback | Signals[SignalType] |
options? | EventListenerOptions |
Returns: void
â–¸ removeEventListener(eventType
: WidgetEventTypes, callback
: function, options?
: EventListenerOptions): void
Parameters:
â–ª eventType: WidgetEventTypes
â–ª callback: function
â–¸ (event?
: NativeRawPointer‹"QEvent"›): void
Parameters:
Name | Type |
---|---|
event? | NativeRawPointer‹"QEvent"› |
â–ªOptional
options: EventListenerOptions
Returns: void
setEventProcessed
â–¸ setEventProcessed(isProcessed
: boolean): void
Mark the current event as having been processed
This method is used to indicate that the currently dispatched event has been processed and no further processing by superclasses is required. It only makes sense to call this method from an event handler.
When set, this flag will cause NodeGui's QObject::event()
method to
return true and not call the superclass event()
, effectively preventing
any further processing on this event.
Parameters:
Name | Type | Description |
---|---|---|
isProcessed | boolean | true if the event has been processed. |
Returns: void