QBoxLayout

Lines up child widgets horizontally or vertically.

This class is a JS wrapper around Qt's QBoxLayout class

Example

// This example arranges two calendars horizontally.
const { QBoxLayout, QCalendarWidget } = require("@nodegui/nodegui");
const centralWidget = new QWidget();
const boxLayout = new QBoxLayout(0);
boxLayout.addWidget(new QCalendarWidget());
boxLayout.addWidget(new QCalendarWidget());
centralWidget.setLayout(boxLayout);

Hierarchy

NodeLayoutQBoxLayoutSignals

QBoxLayout

Index

Constructors

Properties

Methods

Constructors

constructor

+ new QBoxLayout(dir: Direction): QBoxLayout

Overrides EventWidget.constructor

Parameters:

NameType
dirDirection

Returns: QBoxLayout

+ new QBoxLayout(dir: Direction, parent: NodeWidget‹any›): QBoxLayout

Overrides EventWidget.constructor

Parameters:

NameType
dirDirection
parentNodeWidget‹any›

Returns: QBoxLayout

Properties

childLayouts

childLayouts: Set‹NodeLayout‹any››


native

native: NativeElement

Overrides Component.native


nodeChildren

nodeChildren: Set‹Component

Inherited from Component.nodeChildren


Optional nodeParent

nodeParent? : Component

Inherited from Component.nodeParent


type

type: string = "layout"

Inherited from NodeLayout.type

Methods

activate

activate(): boolean

Inherited from NodeLayout.activate

Returns: boolean


addEventListener

addEventListenerSignalType›(signalType: SignalType, callback: QBoxLayoutSignals[SignalType]): void

Inherited from EventWidget.addEventListener

Type parameters:

SignalType: keyof QBoxLayoutSignals

Parameters:

NameTypeDescription
signalTypeSignalTypeSignalType is a signal from the widgets signals interface.
callbackQBoxLayoutSignals[SignalType]Corresponding callback for the signal as mentioned in the widget's signal interface

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): void

Inherited from EventWidget.addEventListener

Parameters:

eventType: WidgetEventTypes

callback: function

For example in the case of QPushButton:

const button = new QPushButton();
button.addEventListener(WidgetEventTypes.HoverEnter,()=>console.log("hovered"));

▸ (event?: NativeRawPointer‹"QEvent"›): void

Parameters:

NameType
event?NativeRawPointer‹"QEvent"›

Returns: void


addLayout

addLayout(layout: NodeLayout‹any›, stretch: number): void

Parameters:

NameTypeDefault
layoutNodeLayout‹any›-
stretchnumber0

Returns: void


addSpacing

addSpacing(size: number): void

Parameters:

NameType
sizenumber

Returns: void


addStretch

addStretch(stretch: number): void

Parameters:

NameTypeDefault
stretchnumber0

Returns: void


addStrut

addStrut(size: number): void

Parameters:

NameType
sizenumber

Returns: void


addWidget

addWidget(widget: NodeWidget‹any›, stretch: number): void

Overrides NodeLayout.addWidget

Parameters:

NameTypeDefault
widgetNodeWidget‹any›-
stretchnumber0

Returns: void


count

count(): number

Returns: number


direction

direction(): Direction

Returns: Direction


inherits

inherits(className: string): boolean

Inherited from NodeObject.inherits

Parameters:

NameType
classNamestring

Returns: boolean


insertLayout

insertLayout(index: number, layout: NodeLayout‹any›, stretch: number): void

Parameters:

NameTypeDefault
indexnumber-
layoutNodeLayout‹any›-
stretchnumber0

Returns: void


insertSpacing

insertSpacing(index: number, size: number): void

Parameters:

NameType
indexnumber
sizenumber

Returns: void


insertStretch

insertStretch(index: number, stretch: number): void

Parameters:

NameTypeDefault
indexnumber-
stretchnumber0

Returns: void


insertWidget

insertWidget(index: number, widget: NodeWidget‹any›, stretch: number): void

Parameters:

NameTypeDefault
indexnumber-
widgetNodeWidget‹any›-
stretchnumber0

Returns: void


invalidate

invalidate(): void

Inherited from NodeLayout.invalidate

Returns: void


isEnabled

isEnabled(): boolean

Inherited from NodeLayout.isEnabled

Returns: boolean


objectName

objectName(): string

Inherited from NodeObject.objectName

Returns: string


property

property(name: string): QVariant

Inherited from NodeObject.property

Parameters:

NameType
namestring

Returns: QVariant


removeEventListener

removeEventListenerSignalType›(signalType: SignalType, callback: QBoxLayoutSignals[SignalType]): void

Inherited from EventWidget.removeEventListener

Type parameters:

SignalType: keyof QBoxLayoutSignals

Parameters:

NameType
signalTypeSignalType
callbackQBoxLayoutSignals[SignalType]

Returns: void

removeEventListener(eventType: WidgetEventTypes, callback: function): void

Inherited from EventWidget.removeEventListener

Parameters:

eventType: WidgetEventTypes

callback: function

▸ (event?: NativeRawPointer‹"QEvent"›): void

Parameters:

NameType
event?NativeRawPointer‹"QEvent"›

Returns: void


removeWidget

removeWidget(widget: NodeWidget‹any›): void

Overrides NodeLayout.removeWidget

Parameters:

NameType
widgetNodeWidget‹any›

Returns: void


setContentsMargins

setContentsMargins(left: number, top: number, right: number, bottom: number): void

Inherited from NodeLayout.setContentsMargins

Parameters:

NameType
leftnumber
topnumber
rightnumber
bottomnumber

Returns: void


setDirection

setDirection(dir: Direction): void

Parameters:

NameType
dirDirection

Returns: void


setEnabled

setEnabled(enable: boolean): void

Inherited from NodeLayout.setEnabled

Parameters:

NameType
enableboolean

Returns: void


setNodeParent

setNodeParent(parent?: Component): void

Inherited from Component.setNodeParent

Parameters:

NameType
parent?Component

Returns: void


setObjectName

setObjectName(objectName: string): void

Inherited from NodeObject.setObjectName

Parameters:

NameType
objectNamestring

Returns: void


setProperty

setProperty(name: string, value: QVariantType): boolean

Inherited from NodeObject.setProperty

Parameters:

NameType
namestring
valueQVariantType

Returns: boolean


setSizeConstraint

setSizeConstraint(constraint: SizeConstraint): void

Inherited from NodeLayout.setSizeConstraint

Parameters:

NameType
constraintSizeConstraint

Returns: void


setSpacing

setSpacing(spacing: number): void

Inherited from NodeLayout.setSpacing

Parameters:

NameType
spacingnumber

Returns: void


setStretch

setStretch(index: number, stretch: number): void

Parameters:

NameType
indexnumber
stretchnumber

Returns: void


sizeConstraint

sizeConstraint(): SizeConstraint

Inherited from NodeLayout.sizeConstraint

Returns: SizeConstraint


spacing

spacing(): number

Inherited from NodeLayout.spacing

Returns: number


update

update(): void

Inherited from NodeLayout.update

Returns: void