The Table class inherits QTableView Qt class.
Widget's input value
The input value of the Table widget is an XML string in the form :
<table> <header> <column>Label</column> <column>Label</column> ... </header> <row> <column>Value</column> <column>Value</column> ... </row> <row></row> ... <template> <column>Value</column> <column>Value</column> ... </template> </table>
Warning | |
---|---|
Unlike the example, the XML input value must not contain spaces between tags. |
The template tag is used to specify the content of new rows. You should have only one template tag. The content of the template tag is the same as row tag.
The following attributes can be specified in the different tags, see Table 4.2, “Table widget XML attributes” to know where you can put each attribute.
This table defines in which tag attributes can be specified :
Attribute | <table> tag | <header> tag | header's <column> tag | <row> tag | row's <column> tag |
---|---|---|---|---|---|
icon | X | X | X | X | X |
color | X | X | X | X | X |
bg | X | X | X | X | X |
font | X | X | X | X | X |
size | X | X | X | X | X |
decoration | X | X | X | X | X |
txt_color | X | X | X | X | X |
align | X | X | X | X | X |
ro | X | X | X | ||
editor | X | X | X | ||
id | X | X | X | ||
data | X | ||||
width | X | ||||
height | X | ||||
label | X | ||||
tooltip | X | ||||
whatsthis | X | ||||
disabled | X | ||||
row_span | X | ||||
col_span | X |
Table 4.2. Table widget XML attributes
Widget's attributes
Widget's functions
Widget's signals
Widget's output value
The output value of a Table widget depends on two attributes : verbose and return.
If return is dict, the output value is a bi-dimensional dict where each cell's value can be accessed like this : output_value[row_id][column_id]. cell's value is a dict in the form : {'column':INDEX, 'editor':EDITOR, 'selected':BOOL, 'value':VALUE, 'checked':BOOL, 'combo_id':ID}. the checked key is available only for check editor. the combo_id key is available only for combo editor. The row's index is available at output_value[row_id]['__row__'] and the row's embedded data is available at output_value[row_id]['__data__'].
If return is list, the output value is a list of rows values. Each row's value is a dict in the form : {'id':ID, 'row':INDEX, 'columns':COLUMNS, 'data':DATA} where COLUMNS is a list of cells values. All those elements follows the screen order.
If verbose is True all rows are returned otherwise only selected rows are returned.