How to define the column order QSqlTableModel
I'm trying to display some data from the database in a table with the
possibility to edit the data, using Qt (more specific, PyQT). A
QSqlTableModel can be used for this. But with a QSqlTableModel is is not
possible to easily reorder the columns, or maybe exclude a column.
I know it is possible to move columns using
QSqlTableModel.horizontalHeader.moveSection but this function depends on
the index of the columns, and that is not really convenient, especially if
I want to add another column in the future.
What is the easiest way to accomplish this? Thanks in advance.
No comments:
Post a Comment