...
The actual cell contents may be either qtablewidgetitem or regular widgets. For simple textual contents using qtablewidgetitems is recommended. Adding and retrieving table items and widgets is done with reference to their row and column position.
Each row and column has a header that by default shows the number for that row or column. The header for a given row or column may also be set using the qsethorizontalheaderlabel and qsetverticalheaderlabel commands.
Populating the table is usually a matter of creating qtablewidgetitem and inserting them into row and column positions using qsetitem.
The table may have a so-called selection set. This is a rectangular area spanning one or more rows and columns. The selection can be created by dragging the cursor using the mouse or keyboard. A selection is identified by the coordinates of the upper left corner and the bottom right corner. This is represented in Tcl by a 4-element list returned by the qselection command:
No Format | ||||
---|---|---|---|---|
| ||||
{ top-left-row top-left-column bottom-right-row bottom-right-column } |
To retrieve the selection use the qselection command:
No Format | ||||
---|---|---|---|---|
| ||||
set table [qtable] ... set selection [qselection $table] |
...