Questions tagged [qsqlquerymodel]

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.

32 questions
0
votes
0 answers

Why isn't drag&drop working with QSqlQueryModel?

I'm trying to make a interface that's easy to use. I have 2 list one of them list of device already using and the other one is unused ones. So, I'm trying to do add drag and drop feature. Like this. But mine is like this. I cannot drag or drop with…
0
votes
0 answers

qml uses C++ sqlquerymodel, when there is no data in the database table, qml shows that the property is not defined

Text { id: test1 anchors.top: test.bottom anchors.topMargin: 5 text: lat font.pixelSize: 14 } qrc:/main.qml:70: ReferenceError: lat is not defined when there is data in the database display is…
smil lee
  • 1
  • 4
0
votes
1 answer

QSqlQueryModel get blank cell for chinese charcteristic

I have a QSqlQueryModel in my GUI application retrieving data from SAP HANA Database and bind it with a QTableView widget. I have uesed QODBC driver and configured an ODBC item in ODBC datasource(64) bit in Windows.But when I set a query to select a…
Lisen
  • 168
  • 1
  • 2
  • 11
0
votes
1 answer

How to change the order of QTableView rows by dragging and store the changes to the model?

I want to know how to change the order of QTableView rows by dragging, and store the order changes to the model? I use QTableView as view and QSqlTableModel as model. I am using Qt 5.15. I…
Ginakira
  • 33
  • 5
0
votes
1 answer

I get undefined data from QSqlQueryModel in my ListView QML (SQLite database)

I am trying to display data that is in two tables in the same database. The tables in the database plan_db.sqlite were created using these queries: CREATE TABLE PlanOne (ID INTEGER NOT NULL PRIMARY KEY, Time VARCHAR(5), Name VARCHAR(50)); CREATE…
sweak
  • 1,369
  • 2
  • 6
  • 21
0
votes
1 answer

How to show last two rows only in tableview from sqlite using with QSqlQueryModel?

Below is my example code: db = QSqlDatabase.addDatabase('QSQLITE') db.setDatabaseName('book.db') db.open() model = QSqlQueryModel() model.setQuery("SELECT * FROM card") self.tableView.setModel(model) I am using QSqlQueryModel, Qtablevie, Sqlite3,…
user3030327
  • 411
  • 1
  • 7
  • 19
0
votes
1 answer

Display images from sqlite database to a column in QTableView

I stacked in a problem which is displaying images in each row in photo's column from SQLite Database Here is my code and thanks in advance: admin.cpp void Admin::on_pushButton_2_clicked() { ui->stackedWidget->setCurrentIndex(2); …
0
votes
1 answer

Adding CheckBox with QSqlQueryModel shown in QTableview and other columns are empty

I am using the code in this answer to add checkbox in tableview. I want to show it in the first column. Here is my code: mysqlquerymodel.h #ifndef MYSQLQUERYMODEL_H #define MYSQLQUERYMODEL_H #include #include #include…
0
votes
1 answer

QSqlRelationalTableModel with OnManualSubmit

I set the model of a view like this: model = QSqlRelationalTableModel() model.setEditStrategy(QSqlTableModel.OnManualSubmit) model.setTable("VoucherPos") model.setFilter("VoucherKey='" + str(parent_id) + "'") model.setRelation(10,…
vezzon
  • 177
  • 1
  • 11
0
votes
1 answer

In other files(except mainwindow.cpp),how to opertate on ui components?

There are three .cpp files in my project: Now, i reimplmented QSqlQueryModel to make it editable which means i reimplemented function QSqlQueryModel::setData() and function QSqlQueryModel::flags() and i use a QTableview to show the data. In the end…
chaotetung
  • 61
  • 1
  • 8
0
votes
0 answers

QSqlQueryModel for dynamically changed information

Trying to build an application with a UI in QML and accessing data from a Sqlite database. The QML view has a TableView to display information in a data grid with a model in C++. The model is a class inheriting from QSqlQueryModel with a query to…
Javier De Pedro
  • 2,219
  • 4
  • 32
  • 49
0
votes
1 answer

Qt Custom Multi-Select QComboBox from SQL Model

I want a drop-down category selection box which allows the user to click multiple selections, and which preferably is connected to an SQL query. I'm not attached to the Combobox in particular (disappearing on each click isn't helpful), whatever can…
user26472
  • 97
  • 1
  • 10
0
votes
0 answers

Calculated amount in Interface aren't not saved into SQLlite DB, only different amount is being saved

I'm having problem with the calculations. When build the system and test it, the correct amount showed in the interface isn't showing up/saved in database. The amount is something different than the one in the interface. Note: SELECT…
joeBoy69
  • 21
  • 3
0
votes
1 answer

Print QSqlModel's SQL code

Is there a way to print a QSqlTableModel/QueryModel's SQL code that is sent to the database? (I am working with filters and would like to use this for debugging purposes) Something like: self.model =…
Rhdr
  • 387
  • 4
  • 22
-1
votes
1 answer

Python: PyQt5 table with SQL - Postgrees

im writing a code in python and i need to fil a table with a database select, and also refresh it every 5 minutes, dos anyone can help me with it? i already tryied alot of ways, but none was right. Any tip for doing it? MainWindow > def…