QSqlQueryModel is a high-level interface for executing SQL statements and traversing the result set. It is built on top of the lower-level QSqlQuery and can be used to provide data to view classes such as QTableView.
Questions tagged [qsqlquerymodel]
32 questions
10
votes
0 answers
Implementing setEditStrategy in editable QSqlQueryModel
This is a follow-up to this question. In there, we created an editable subclass of QSqlQueryModel, to use with complex queries.
Now I need to add a functionality like QTableModel's setEditStrategy so I can cache all changes and accept or revert…

CodingCat
- 4,999
- 10
- 37
- 59
3
votes
1 answer
Qt-How to implement a read-write QSqlQueryModel?
I have subclassed and reimplemented QSqlQueryModel::setData() and QSqlQueryModel::flags() and now I can edit this model but something gonna be wrong here:
I edit the fourth field in the record,but subsequently,the fourth field and latters all…

chaotetung
- 61
- 1
- 8
2
votes
1 answer
Output data from mysql table using QSqlQueryModel
I am using the following example https://wiki.qt.io/How_to_Use_a_QSqlQueryModel_in_QML. It uses QSqlQueryModel and has select list of column names.
But in my case, I do not know the table column names in the output as I am using * query "Select *…

Chilarai
- 1,842
- 2
- 15
- 33
2
votes
1 answer
QML Combobox with QSqlModel
I'm currently facing problems with populating a QML Combobox with a QSqlTableModel.
Example Database:
Table Customer Table Project
| id | name | | id | name | fk_customer |
|........|..........| …

Stephan
- 143
- 1
- 8
2
votes
1 answer
Filtering query by QLineEdit and updating QSqlQueryModel
I got a lineExdit and a tableView i want live update tableView base on typing text in lineEdit.
void updateTableView(QString *st)
{
QSqlQuery * qry = new QSqlQuery(mydb);
qry->prepare("select * from Poems where Title like ?%");
…

behruz montazeri
- 106
- 2
- 13
2
votes
1 answer
QTableView not showing all of the data from an SQLite database
I have a simple application with a QTableView and a QLineEdit and I'm using QSqlQueryModel and QSortFilterProxyModel to get the data from a table in a SQLite3 database and filter the results (with setFilterFixedString(the text from the QLineEdit)).…

pr.nizar
- 641
- 6
- 20
1
vote
1 answer
QTableView with a QSortFilterProxyModel seted on, based on a QSqlQueryModel doesn't update when the data in the database change
I have a complex software that has several tables and forms.
I need to join some tables in a QSqlQueryModel and show the result into a QTableView
I use a QSortFilterProxyModel to have the ability to search in the QTableView that contain the…

GAL
- 21
- 3
1
vote
1 answer
How to edit selected data/row in QTableView?
I have a QTableView and if a user selected a row, i want to change the data in the table by clicking a button. So my problem is, that I don't know how to get the rowindex of the selected row, to give this to the button.
I have this…

Margit
- 11
- 1
1
vote
1 answer
QSqlQueryModel TableView custom delegate
I have a QSqlQueryModel and a TableView to display the data from the model. The code and output data results are fine. But, I just want to display an image in front of each row in the TableView. However, with my current QML code, the image is…

Chilarai
- 1,842
- 2
- 15
- 33
1
vote
1 answer
Conditional Group By on Selected rows in KDB/Q-Sql
I have a requirement where I have to execute multiple queries and perform group by on a column with where clause , group by column is fixed and where condition will be perform on fixed column with variable criteria . Only Column name and …

sam
- 47
- 6
1
vote
2 answers
KDB/Q-sql Dynamic Grouping and con-canting columns in output
I have a table where I have to perform group by on dynamic columns and perform aggregation, result will be column values concatenating group-by tables and aggregations on col supplied by users.
For example :
g1 g2 g3 g4 col1 col2
A D F …

sam
- 47
- 6
1
vote
2 answers
Converting KDB Table to dictionary in special format
I am quiet new to KDB/Q , I have table having two columns only like below:
id value
100 a
101 b
100 c
102 d
103 e
100 f
102 g
101 e
I need to convert this table in form of dictionary group by id…

sam
- 47
- 6
1
vote
1 answer
How to show QSqlQueryModel in QML?
I want to show QSqlQueryModel in qml TableView but I don't Wan't to create separate QML file for each new query cause I can't create infinite qml files as given here . Also question is not working for me for dynamic number of columns (could be…

너를 속였다
- 899
- 11
- 26
1
vote
2 answers
Editable QTableView of complex SQL query
How can I make an editable QTableView displaying data from a complex SQLite query?
I need to fill a QTableView with data from several SQLite tables. This needs to be editable by the user.
As the queries are a bit complex (including JOINs and CASE…

CodingCat
- 4,999
- 10
- 37
- 59
1
vote
1 answer
Qt and SQLite: filter using the elements of an array
I'm currently working on a project and I'm quite new to Qt and SQLITE. I currently have an integer array and would like to use it to obtain data linked to the elements in the array. For example, if the data is 61616, it will output…

sharr
- 13
- 5