Qt 6.11 is out! See what's new in the release
blog
How to add a default value to QSqlTableModel
General and Desktop
2
Posts
2
Posters
2.3k
Views
1
Watching
-
Hi,
I need to insert a default value (say current unix time stamp), into a QSqlTableModel when a new row is created? Since this column is hidden in the QTableView, no need of delegates to setup, so please give me simple method.
Thanking you,
Ras -
There are two possibilites:
- provide a default value at database level (using a DEFAULT column constraint)
- provide a default value at code level, by connecting to "QSqlTableModel::primeInsert()":http://doc.qt.nokia.com/4.7-snapshot/qsqltablemodel.html#primeInsert