Wiki Markup |
---|
{alias:qtablewidgetitem} |
Name
qtablewidgetitem — object contained in a QTableWidget cell
...
The qtablewidgetitem command creates a QTableWidgetItem object. These are used to populate a QTableWidget qtablewidget. The newly created object is returned to the caller. There is one table item for each cell in the table.
Arguments
text
The item text.
type
An integer denoting the class to which this item will belong. This is a freely chosen number that divides conceptually similar items into groups. One can choose to have all items of the same column as having the same type identifier.
Examples
Ex.1: QTableWidgetItem
...
No Format | ||||
---|---|---|---|---|
| ||||
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
|
...