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
1 answer

Database not being displayed after build

I'm using cx_Freeze to build my executable. I used Pyqt4 and the QtSql modules to display my database, the problem is when running through the python script, the database is displayed and the table works fine but when i run it as an executable the…
Inthu
  • 1,009
  • 1
  • 8
  • 16
0
votes
1 answer

How to use QSqlTableModel along with QTreeView

I am using sqlite database (webscrap.db). I want to make the model to display the data in the field "name" of the database table "userin". How can i fetch data using QSqlTableModel and display it with QTreeView ?
amg
  • 45
  • 1
  • 8
0
votes
1 answer

pyqt4 dateedit delegate don't want to display time

I have am trying to let my user pick a date and enter into the datebase using the dateedit widget and im doing this by using a delegate but for some reason it attaches the time aswell class ProductDelegate(QtSql.QSqlRelationalDelegate): def…
Inthu
  • 1,009
  • 1
  • 8
  • 16
0
votes
2 answers

Custom QAbstractItemDelegate with regex for QSqlTableModel

I'm trying to create a custom delegate so I can use Regex to verify the data that's being entered into the table but for some reason, my code keeps throwing errors, is there a good structured example? These are the two errors I'm currently getting,…
Inthu
  • 1,009
  • 1
  • 8
  • 16
0
votes
1 answer

pyqt relational table not updating when foreign key is updated

I have a window with a splitter, inside the two frames there are two different tables, and the product type has a relation with product and the GUI runs and works fine but when I change a name on product type it doesn't update on the product table,…
Inthu
  • 1,009
  • 1
  • 8
  • 16
0
votes
1 answer

How to display table a relational sql table in QT QSqlRelationalTableModel?

I am trying to work with QSql Relational TableModel of QT. I am new to Pyqt and the sql table relationship does not display my database, why is that? I have a db file with a database that has relational tables in the same directory.…
Inthu
  • 1,009
  • 1
  • 8
  • 16
0
votes
1 answer

qsqltablemodel incompatible data types

I have a simple form with button and some line edits and listview. In listview users can select items and in line edits edit their parameters. int row = listView->selectionModel()->currentIndex().row(); QString text =…
0
votes
1 answer

undelete row from QTableView

I am new to PyQt5, I am working with a QTableView. After successfuly knew how te delete selected rows.. I have googled a lot to know ho to undelete a selected deleted row from the table (& by sequence from the TableModel) with no result... So far, I…
0
votes
0 answers

QTableView does not display database in release mode

I have written an application in C++ using Qt 4.8 in Visual Studio 2010 and I try to make .exe with dlls. Everything seems to work just fine, but when I run my program on another computer without any VS or Qt installed there, nothing gets…
Uylenburgh
  • 1,277
  • 4
  • 20
  • 46
0
votes
2 answers

Splitting PyQt Code - Passing Main App By Reference Or Import

Am having much trouble splitting PyQt code: main.py (PyQt modules) from titles import * appl = QApplication(sys.argv) from main import Ui_MainWindow class Main(QMainWindow): def __init__(self, parent=None): super(Main,…
user2422819
  • 177
  • 13
0
votes
1 answer

Refreshing QListView not working

Need some help finding why my QListView will not refresh. I'm using QListView with a QSqlTableModel. I implement the model in the following function. I call this function from the class' constructor. void myclass::refresh() { model_path = new…
David
  • 47
  • 9
0
votes
1 answer

How to get select item data from QComboBox populated with QSqlTableModel

I have a basic combo box populated with data from an sqlite3 database table: self.langModel = QSqlTableModel(self) self.langModel.setTable("languages") self.langModel.setSort(self.langModel.fieldIndex("label"),…
cj5
  • 785
  • 3
  • 12
  • 34
0
votes
1 answer

SubmitAll() fails on QSqlRelationalTableModel

'Hi All, I have a form with a tableview representing a QSqlRelationalTableModel and widgets linked to the same model via QDataWidgetMapper. Here is the table structure: queryString = QString("CREATE TABLE t100000_Stations (" …
0
votes
1 answer

How to query a local QSqlQueryModel?

I am displaying a QSqlTableModel in QSqlTableModel::OnManualSubmit mode. I want to run SQL style queries on my local copy, for example I have a getMax function that changes as I add new rows. If my user locally changes the QSqlTableModel during…
Mikhail
  • 7,749
  • 11
  • 62
  • 136
0
votes
1 answer

How to get the executed SQL statement associated with QSqlTableModel::setData()?

I am inserting/updating a database table from a Qt application using QSqlTableModelmethods setData, submitAll and commit. For logging purposes, I need to record the corresponding SQL statements. How can I do that? (I am looking at…
fortytwo
  • 491
  • 1
  • 5
  • 16
1 2 3
13
14