QGridLayout
The QGridLayout class lays out widgets in a grid.
This class is a JS wrapper around Qt's QGridLayout
Example
const { QGridLayout, QWidget, QLabel } = require("@nodegui/nodegui");
const view = new QWidget();
const layout = new QGridLayout();
view.setLayout(layout);
const label = new QLabel();
label.setText("label1");
const label2 = new QLabel();
label2.setText("label2");
layout.addWidget(label);
layout.addWidget(label2);
Hierarchy
↳ QGridLayout
Index
Constructors
Properties
Methods
- _id
- activate
- addEventListener
- addLayout
- addWidget
- children
- columnCount
- columnMinimumWidth
- columnStretch
- delete
- deleteLater
- dumpObjectInfo
- dumpObjectTree
- eventProcessed
- horizontalSpacing
- inherits
- invalidate
- isEnabled
- killTimer
- objectName
- parent
- property
- removeEventListener
- removeWidget
- rowCount
- rowMinimumHeight
- rowStretch
- setColumnMinimumWidth
- setColumnStretch
- setContentsMargins
- setEnabled
- setEventProcessed
- setHorizontalSpacing
- setObjectName
- setParent
- setProperty
- setRowMinimumHeight
- setRowStretch
- setSizeConstraint
- setSpacing
- setVerticalSpacing
- sizeConstraint
- spacing
- startTimer
- update
- verticalSpacing
Constructors
constructor
+ new QGridLayout(arg?
: QWidget‹QWidgetSignals› | NativeElement): QGridLayout
Overrides QObject.constructor
Parameters:
Name | Type |
---|---|
arg? | QWidget‹QWidgetSignals› | NativeElement |
Returns: QGridLayout
Properties
native
• native: NativeElement | null
Inherited from Component.native
type
• type: string = "layout"
Methods
_id
▸ _id(): number
Get an ID identifying the underlying C++ object.
This can be useful when debugging memory problems with help from
setLogCreateQObject()
and setLogDestroyQObject()
. The number is
hash of the memory address of the C++ object.
Returns: number
a unique number which is valid for the lifetime of the C++ object.
activate
▸ activate(): boolean
Inherited from QLayout.activate
Returns: boolean
addEventListener
▸ addEventListener‹SignalType›(signalType
: SignalType, callback
: QGridLayoutSignals[SignalType], options?
: EventListenerOptions): void
Inherited from EventWidget.addEventListener
Type parameters:
▪ SignalType: keyof QGridLayoutSignals
Parameters:
Name | Type | Description |
---|---|---|
signalType | SignalType | SignalType is a signal from the widgets signals interface. |
callback | QGridLayoutSignals[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:
const button = new QPushButton();
button.addEventListener('clicked',(checked)=>console.log("clicked"));
// here clicked is a value from QPushButtonSignals interface
▸ addEventListener(eventType
: WidgetEventTypes, callback
: function, options?
: EventListenerOptions): void
Inherited from EventWidget.addEventListener
Parameters:
▪ eventType: WidgetEventTypes
▪ callback: function