I have a problem with QTableView not showing fractional part of a floating point number retrieved from sqlite query (i.e. QSqlQueryModel).
I've tested it with QSqlQuery - q.value(0).toDouble() returns correct floating point value. Yet QTableView shows only integer part.
How can I change QTableView or QSqlQueryModel column type?
edit: Here is sample code. Requires tableView object on MainWindow.
Qt Code:
ui(new Ui::MainWindow) { ui->setupUi(this); db.setDatabaseName(":memory:"); db.open(); QSqlQuery q; q.exec("create table t (col1)"); q.exec("insert into t (col1) values (161726.36)"); m->setQuery("select col1 from t"); ui->tableView->setModel(m); }To copy to clipboard, switch view to plain text mode
Bookmarks