Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Unknown macro: {alias}

Name

qtablewidgetitem — object contained in a QTableWidget cell

Syntax

qtablewidgetitem

qtablewidgetitem text [type]

Description

The qtablewidgetitem command creates a QTableWidgetItem object. These are used to populate a QTableWidget. The newly created object is returned to the caller. There is one table item for each cell in the table.

Arguments

text

type

Examples

Ex.1: QTableWidgetItem

set w [qwidget ]
qsetwindowtitle "Table Item"

# Create table and add to layout
set layout [qvboxlayout $w]
set table [qtablewidget 10 10]
qaddwidget $layout $table
qsethorizontalheaderlabel 0 Name
qsethorizontalheaderlabel 0 Dept

# Insert table items

set item [qtablewidgetitem John]
qsetitem $table   0 0 $item


set item [qtablewidgetitem Sales]
qsetitem $table   0 1 $item

# Get item textd
puts "Item text is [qtext $item]"

qshow $w

The above example inserts two items into the table at positions (0, 0) and (0, 1). Note how the item text is later obtained through the qtext command.

  • No labels