Questions tagged [qsqlrelationaltablemodel]
26 questions
6
votes
0 answers
Filter options provided by QSqlRelationalDelegate/QSqlRelation acourding to some WHERE close
I have a QTableView populated by QSqlRelationalTableModel.
There is a column that references another table, so when I edit/create a row, this column's editor is QCombobox which gets its data from the related table. The problem is that I want to…

Muslimbek Abduganiev
- 828
- 7
- 21
2
votes
1 answer
QSqlRelationalDelegate displays foreign_key - id of the related record instead of name/value from Combobox
I am trying to add new rows to QSqlRelationalModel which is represented in QTableView.
I have set proper QSqlRelationalDelegate and proper QSqlRelations in the model. Displaying existing data from the database works fine. Columns with related data…

Muslimbek Abduganiev
- 828
- 7
- 21
2
votes
1 answer
Insert row in QSqlRelationalTableModel while displaying two columns for a foreign key
I have two SQLite tables having the following structure:
CREATE TABLE "log" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" TEXT,
"value" INTEGER NOT NULL,
"category_id" INTEGER NOT NULL,
"date" TEXT NOT NULL,
…

Liviu
- 142
- 4
- 11
2
votes
1 answer
QSqlRelationalTableModel QTableView colorizing rows
What is the right way to color-code rows in a QTableView?
I'm developing a spreadsheet application that should color-code its rows based on a specific value set in one of the columns. I use QSqlRelationalTableModel and QSqlRelationalDelegate;…

Tylnesh
- 50
- 5
1
vote
1 answer
SQLite3 generated column does not show up in QSqlRelationalTableModel
I have a QTableView connected to a QSqlRelationalTableModel. Everything works as expected, however, it seems to be impossible to have a sqlite3 generated column in my model:
bhd [INTEGER] GENERATED ALWAYS AS (round(d_mess * 130 / bhd_hoehe))…

Oliver Bienert
- 63
- 8
1
vote
0 answers
Updating a relational column in QSqlRelationalTableModel (PyQt6)
So, I’m stumped by a problem when updating a record on a relational column in a QSqlRelationalTableModel with PyQt6.
Background:
I’m developing an app which includes a GUI to keep track of clients. The clients (companies) are stored in a…

ce.berlin
- 21
- 5
1
vote
0 answers
Pyqt6 bug with QSqlRelationalTableModel and Postgresql (version 13)
The following code works perfectly with Sqlite3 but not with Postgres.
No bug but the returned table is always empty...
self.model = QSqlRelationalTableModel(db=db)
self.model.setTable("hr_employee")
self.model.setRelation(2,…

Jean-Luc Thomas
- 11
- 1
1
vote
1 answer
map data in combobox with relation with more than 256 items
I have a QSqlRelationalTableModel with a related table with more than 256 rows.
The relation is working perfect, i have in column 1 the related values from the "relation_table"
But mapping the data in the combobox and submiting to the db by…

vezzon
- 177
- 1
- 11
1
vote
1 answer
Endless loop on QTreeView when filtering via QSortFilterProxyModel in a QSqlRelationalTableModel
Whenever I enable a filter with QSortFilterProxyModel() and insert a new record in my QSqlRelationalTableModel() which is linked to a QTreeView I get the error:
RecursionError: maximum recursion depth exceeded
Standard case is to create a new…

ProfP30
- 358
- 3
- 18
1
vote
0 answers
Signal for dataChanged with QSqlRelationalTableModel in pyqt
I'm using a QSqlRelationalTableModel with a QSqlRelationalDelegate for a simple database editing application.
I would like to create a signal when user modify a value (item) in a record with delegate editor.
codes releases: PyQt4 and python…

Simone ARAGNO
- 11
- 2
0
votes
0 answers
how to use QDialog to edit data in QTableView with QSqlRelationalTableModel
I have two QTableView
the first one with QSqlTableModel I have no probleme when I edit it s data using QDialog when double click event happened.
self.table.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
…

hamza chenni
- 146
- 2
- 18
0
votes
0 answers
Why are the rows missing? QTableView + QSqlRelationalTableModel
I can't figure out the strange display behavior of QSqlRelationalTableModel.
setEditStrategy of the model is set to OnFieldChange. I'm trying to change the values in the cells, but the whole row disappears and you can not change other cells in this…

papadulo
- 3
- 2
0
votes
0 answers
Checkbox in QTableView PyQt6
I have created a QtableView with QSqlRelationalTableModel. All works fine.
I would like add a checkbox to column.
class myQSqlRelationalDelegate(QSqlRelationalDelegate):
def __init__(self, parent=None):
…
0
votes
1 answer
Fetch entire result set at once with QSqlRelationalTableModel + QTableView
I have a QTableView with a QSqlRelationalTableModel as the model. Essentially:
QSqlRelationalTableModel *theModel = ...;
QTableView *theView = ...;
theModel->setTable("table");
theView->setModel(theModel);
theModel->select();
It seems, though,…

Jason C
- 38,729
- 14
- 126
- 182
0
votes
1 answer
How to update or insert into related table in a qsqlrelationaltablemodel
I have this relational model
rel_model = QSqlRelationalTableModel(self, connectDB)
rel_model.setTable("person")
rel_model.setRelation(1, QSqlRelation("email", "id", "emailAddres"))
rel_model.select()
Main table holds data from the person and the…

accpert.com
- 109
- 11