qsqldatabase

When or how to use fetchMore() on QSqlTableModel with a SQLite database for rowCount() to work?

末鹿安然 提交于 2019-12-21 16:47:17
问题 My class DataTable is derived from QAbstractTableModel. It uses a QSqlTableModel object internally to fetch data from a db table. It represents a record for every row in the db (it does more but the record count is always the number of rows in the db table). With MySql, my DataTable::rowCount() implementation just calls rowCount() on the QSqlTableModel, which works nicely. Now with SQLite, Qt's SQLite driver returns a row count of 256 if there are more than 256 rows in the db table, so my

QSqlRelationalTableModel with QSqlRelationalDelegate not working behind QAbstractProxyModel

十年热恋 提交于 2019-12-12 01:55:38
问题 I need to swap the rows and columns of a QSqlRelationalTableModel. After a lot of searching, I wrote a little proxymodel to flip the rows and the columns. It is partly working. The relations in the table are resolved and showed but the dropboxes to choose them gets lost. Also, how do I get them to update? Here is a little self-contained script that reproduces the behavior. Where is my error? I have strong suspicion that it has to do with the signals and slots of the models but I haven't found

When or how to use fetchMore() on QSqlTableModel with a SQLite database for rowCount() to work?

别来无恙 提交于 2019-12-04 09:59:37
My class DataTable is derived from QAbstractTableModel. It uses a QSqlTableModel object internally to fetch data from a db table. It represents a record for every row in the db (it does more but the record count is always the number of rows in the db table). With MySql, my DataTable::rowCount() implementation just calls rowCount() on the QSqlTableModel, which works nicely. Now with SQLite, Qt's SQLite driver returns a row count of 256 if there are more than 256 rows in the db table, so my DataTable class also returns 256 - which is wrong. The documentation tells me to call while (sql_model-

Is there any qt signal for sql database change?

随声附和 提交于 2019-11-29 02:42:45
I wrote a C++ program using Qt. some variables inside my algorithm are changed outside of my program and in a web page. every time the user changes the variable values in the web page I modify a pre-created SQL database. Now I want my code to change the variables value during run time without to stop the code. there is two options : Every n seconds check the database and retrieve the variables value -> this is not good since I have to check if database content is changed every n seconds (it might be without any change for years. Also I don't want to check if the database content is changed)

Is there any qt signal for sql database change?

时光毁灭记忆、已成空白 提交于 2019-11-27 21:57:02
问题 I wrote a C++ program using Qt. some variables inside my algorithm are changed outside of my program and in a web page. every time the user changes the variable values in the web page I modify a pre-created SQL database. Now I want my code to change the variables value during run time without to stop the code. there is two options : Every n seconds check the database and retrieve the variables value -> this is not good since I have to check if database content is changed every n seconds (it

QPSQL driver not loaded Qt

痞子三分冷 提交于 2019-11-27 09:45:30
I have some trouble when I want to add a database. _dataBase = QSqlDatabase::addDatabase("QPSQL"); After calling this method I have an error: QSqlDatabase: QPSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7 I include to PATH variable paths to: PostgreSQL\9.3\bin PostgreSQL\9.3\lib PostgreSQL\9.3\include Also I copy folder sqldrivers to Debug folder. Also tried to copy dlls drom this folder to Debug . Doesn't work either. I came here googling because I had the same problem in Windows. In my case to solve the issue I had to install

QPSQL driver not loaded Qt

只谈情不闲聊 提交于 2019-11-26 14:49:28
问题 I have some trouble when I want to add a database. _dataBase = QSqlDatabase::addDatabase("QPSQL"); After calling this method I have an error: QSqlDatabase: QPSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7 I include to PATH variable paths to: PostgreSQL\9.3\bin PostgreSQL\9.3\lib PostgreSQL\9.3\include Also I copy folder sqldrivers to Debug folder. Also tried to copy dlls drom this folder to Debug . Doesn't work either. 回答1: I came here