Skip to main content

QTableWidgetItem

Creates an item for QTableWidget.

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

Example

const { QTableWidget, QMainWindow, QTableWidgetItem } = require("@nodegui/nodegui");

const win = new QMainWindow();
const table = new QTableWidget(2, 3);
table.setHorizontalHeaderLabels(['first', 'second', 'third']);

const cell00 = new QTableWidgetItem('C00');
const cell01 = new QTableWidgetItem('C01');
const cell10 = new QTableWidgetItem('C10');
const cell11 = new QTableWidgetItem('C11');

table.setItem(0, 0, cell00);
table.setItem(0, 1, cell01);
table.setItem(1, 0, cell10);
table.setItem(1, 1, cell11);

win.setCentralWidget(table);
win.show();
(global as any).win = win;

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

+ new QTableWidgetItem(): QTableWidgetItem

Overrides Component.constructor

Returns: QTableWidgetItem

+ new QTableWidgetItem(other: QTableWidgetItem): QTableWidgetItem

Overrides Component.constructor

Parameters:

NameType
otherQTableWidgetItem

Returns: QTableWidgetItem

+ new QTableWidgetItem(native: NativeElement): QTableWidgetItem

Overrides Component.constructor

Parameters:

NameType
nativeNativeElement

Returns: QTableWidgetItem

+ new QTableWidgetItem(text: string): QTableWidgetItem

Overrides Component.constructor

Parameters:

NameType
textstring

Returns: QTableWidgetItem

Properties

native

native: NativeElement | null

Inherited from Component.native

Methods

background

background(): QBrush

Returns: QBrush


checkState

checkState(): CheckState

Returns: CheckState


column

column(): number

Returns: number


data

data(role: number): QVariant

Parameters:

NameType
rolenumber

Returns: QVariant


flags

flags(): ItemFlag

Returns: ItemFlag


font

font(): QFont

Returns: QFont


foreground

foreground(): QBrush

Returns: QBrush


icon

icon(): QIcon

Returns: QIcon


isSelected

isSelected(): boolean

Returns: boolean


row

row(): number

Returns: number


setBackground

setBackground(brush: QBrush): void

Parameters:

NameType
brushQBrush

Returns: void


setCheckState

setCheckState(state: CheckState): void

Parameters:

NameType
stateCheckState

Returns: void


setData

setData(role: number, value: QVariant): void

Parameters:

NameType
rolenumber
valueQVariant

Returns: void


setFlags

setFlags(flags: ItemFlag): void

Parameters:

NameType
flagsItemFlag

Returns: void


setFont

setFont(font: QFont): void

Parameters:

NameType
fontQFont

Returns: void


setForeground

setForeground(brush: QBrush): void

Parameters:

NameType
brushQBrush

Returns: void


setIcon

setIcon(icon: QIcon): void

Parameters:

NameType
iconQIcon

Returns: void


setSelected

setSelected(select: boolean): void

Parameters:

NameType
selectboolean

Returns: void


setSizeHint

setSizeHint(size: QSize): void

Parameters:

NameType
sizeQSize

Returns: void


setStatusTip

setStatusTip(statusTip: string): void

Parameters:

NameType
statusTipstring

Returns: void


setText

setText(text: string): void

Parameters:

NameType
textstring

Returns: void


setTextAlignment

setTextAlignment(alignment: AlignmentFlag): void

Parameters:

NameType
alignmentAlignmentFlag

Returns: void


setToolTip

setToolTip(toolTip: string): void

Parameters:

NameType
toolTipstring

Returns: void


setWhatsThis

setWhatsThis(whatsThis: string): void

Parameters:

NameType
whatsThisstring

Returns: void


sizeHint

sizeHint(): QSize

Returns: QSize


statusTip

statusTip(): string

Returns: string


text

text(): string

Returns: string


textAlignment

textAlignment(): AlignmentFlag

Returns: AlignmentFlag


toolTip

toolTip(): string

Returns: string


type

type(): number

Returns: number


whatsThis

whatsThis(): string

Returns: string