Questions tagged [qsqltablemodel]

A QSqlTableModel instance is used in the Qt framework to provide an editable data model for a single database table.

QSqlTableModel is a high-level interface for reading and writing database records from a single table. It is built on top of the lower-level QSqlQuery and can be used to provide data to view classes such as QTableView.

QSqlTableModel can also be used to access a database programmatically, without binding it to a view.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

206 questions
0
votes
3 answers

SQL Query; Search List from List

I am new at SQL, including performing queries. Everyday, our organization sends a list of employees that were terminated in a listed format. What I am looking to do is two things, search for the employee ID(s) in a column and if the employee is…
Josh
  • 19
  • 4
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

sqlite commands possibly not working in qt

I am making a library management software using Qt and Sqlite3. constructor: db = QSqlDatabase :: addDatabase("QSQLITE"); model = new QSqlTableModel(this, db); db.setDatabaseName(":/lib/libre coupe.db"); db.setHostName("Libre…
Hemil
  • 916
  • 9
  • 27
0
votes
1 answer

setHeaderData not working + qt

I am trying to make a library management software. I am using Qt and Sqlite3. In my main window constructor, i have this piece of code @ellyanesc, added this on your recommendation: db = QSqlDatabase :: addDatabase("QSQLITE"); model = new…
Hemil
  • 916
  • 9
  • 27
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
0
votes
0 answers

QSqlTableModel filter takes only the first argument

I’ve got a QTableView based on a QSqlTableModel. I want to filter displayed information: a user chooses one year in a combobox, and one or more perons in a multiple choices list. The QTableView data is filtered by these two widgets. My problem is…
V Damoy
  • 190
  • 10
0
votes
1 answer

How to insert programmatically a value in a new row of a QtableView

I'm using a QtableView to display and edit data from a QsqlTableModel. Everything's fine : data from a postgreSQL table is displayed, and user can edit it and save modifications. I want to add a row when uses click on a button. I use the…
V Damoy
  • 190
  • 10
0
votes
1 answer

Get id field as an int of a record in QSqlTableModel

I am using QSqlTableModel *modelcompleter, and then using QCompleter to load the data into the qLineEdit *search connect(ui->btnSearch, SIGNAL(clicked()), SLOT(search())); modelcompleter->setTable("cust"); …
awaisharoon
  • 463
  • 1
  • 3
  • 16
0
votes
1 answer

Unable to display info from MySQL in PyQT app using QTableView

I am busy with a university project where I need to create an SQL db and be able to work with the data through a program created in Python and PyQT. I have created the database, added tables and some data in the tables, but now I need to use the…
Leon
  • 11
  • 3
0
votes
0 answers

QSqlTableModel how to detect that there are pending changes

I am using QSqlTableModel/QTableView. editStrategy is OnManualSubmit. I have two buttons Save/Revert. Save's pressed is connected with model's submitAll and Revert's pressed is connected with revertAll. This works perfectly but I want to disable…
ArmanHunanyan
  • 905
  • 3
  • 11
  • 24
0
votes
1 answer

Python - Deleting a selected row from a QSQLRelationalTableModel / QTableView

I have a QTableView class, and a QSQLRelationalTableModel class for displaying data from within an SQLITE database. I have subclassed these myself as I need to overwrite various methods within the PyQt classes. I am trying to implement a 'Delete…
Marcel
  • 21
  • 4
0
votes
2 answers

QSqlTableModel notify on rows inserted

How do I get notified if a record has been inserted into mysql table by another database client, is this possible?
retarded
  • 127
  • 1
  • 10
0
votes
1 answer

Robot's Tracker Threads and Display

Application: The purposed application has an tcp server able to handle several connections with the robots. I choosed to work with database/ no files, so i'm using a sqlite db to save information about the robots and their full history, models of…
0
votes
1 answer

setFilterFixedString for multiple strings

my cuestion is: there is a way to search for two or more strings (the union of results) @ FILTRO->setFilterFixedString(searchText1); FILTRO->setFilterFixedString(searchText2); @ i already know how to find the intersection that have the two Qstrings,…
0
votes
2 answers

"Unable to find table" error when calling QSqlTableModel setTable method

I need to populate a QTableView by retrieving data from a QSqlTableModel object. I use following commands to make a connection to a sql server database: QSqlDatabase db = QSqlDatabase::addDatabase("QODBC"); QString connectionTemplate = "DRIVER={SQL…
m.taheri
  • 309
  • 3
  • 21