nodeguy/website/docs/api/generated/classes/nodelayout.md
2019-12-29 09:37:05 +05:30

7.8 KiB
Raw Blame History

id title sidebar_label
nodelayout NodeLayout NodeLayout

Abstract class to add functionalities common to all Layout.

This class implements all methods, properties of Qt's QLayout class so that it can be inherited by all layouts*

NodeLayout is an abstract class and hence no instances of the same should be created. It exists so that we can add similar functionalities to all layout's easily. Additionally it helps in typechecking process.

Example

const {
NodeLayout,
NodeWidget,
FlexLayout,
GridLayout,
QPushButton,
QWidget
} = require("@nodegui/nodegui");

// addChildToLayout can accept any layout since it expects NodeLayout
const addChildToLayout = (layout: NodeLayout, widget: NodeWidget) => {
layout.addWidget(widget);
};

addChildToLayout(new FlexLayout(), new QPushButton());
addChildToLayout(new GridLayout(), new QWidget());

Type parameters

Signals: QLayoutSignals

Hierarchy

NodeObjectSignals

NodeLayout

FlexLayout

QBoxLayout

QGridLayout

Index

Constructors

Properties

Methods

Constructors

constructor

+ new NodeLayout(native: NativeElement): NodeLayout

Inherited from EventWidget.constructor

Overrides Component.constructor

Parameters:

Name Type
native NativeElement

Returns: NodeLayout

Properties

Abstract native

native: NativeElement

Inherited from Component.native


nodeChildren

nodeChildren: SetComponent

Inherited from Component.nodeChildren


Optional nodeParent

nodeParent? : Component

Inherited from Component.nodeParent


type

type: string = "layout"

Methods

activate

activate(): boolean

Returns: boolean


addEventListener

addEventListener<SignalType>(signalType: SignalType, callback: Signals[SignalType]): void

Inherited from EventWidget.addEventListener

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

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

Parameters:

Name Type
event? NativeElement

Returns: void


Abstract addWidget

addWidget(childWidget: NodeWidgetany, ...args: any[]): void

Parameters:

Name Type
childWidget NodeWidgetany
...args any[]

Returns: void


inherits

inherits(className: string): boolean

Inherited from NodeObject.inherits

Parameters:

Name Type
className string

Returns: boolean


invalidate

invalidate(): void

Returns: void


objectName

objectName(): string

Inherited from NodeObject.objectName

Returns: string


property

property(name: string): QVariant

Inherited from NodeObject.property

Parameters:

Name Type
name string

Returns: QVariant


removeEventListener

removeEventListener<SignalType>(signalType: SignalType, callback: Signals[SignalType]): void

Inherited from EventWidget.removeEventListener

Type parameters:

SignalType: keyof Signals

Parameters:

Name Type
signalType SignalType
callback Signals[SignalType]

Returns: void

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

Inherited from EventWidget.removeEventListener

Parameters:

eventType: WidgetEventTypes

callback: function

▸ (event?: NativeElement): void

Parameters:

Name Type
event? NativeElement

Returns: void


Abstract removeWidget

removeWidget(childWidget: NodeWidgetany): void

Parameters:

Name Type
childWidget NodeWidgetany

Returns: void


setNodeParent

setNodeParent(parent?: Component): void

Inherited from Component.setNodeParent

Parameters:

Name Type
parent? Component

Returns: void


setObjectName

setObjectName(objectName: string): void

Inherited from NodeObject.setObjectName

Parameters:

Name Type
objectName string

Returns: void


setProperty

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

Inherited from NodeObject.setProperty

Parameters:

Name Type
name string
value QVariantType

Returns: boolean


update

update(): void

Returns: void