30 questions
1
vote
1
answer
46
views
How to restore back a null value on a column that has a relation?
In Qt 6.8.2 I subclassed QTableView in order to catch the pressing of Key_Delete:
#include <QTableView>
#include <QKeyEvent>
class TableView : public QTableView
{
Q_OBJECT
public:
...
1
vote
1
answer
36
views
How to refresh a foreign key list in QSqlRelationalTableModel
In a Qt 6.8.2 Desktop application with SQLite I have two related tables:
Table master
id
name
1
aaa
2
bbb
Table details
id
idMaster
value
1
1
foo
2
1
bar
In my QMainWindow I have two QTableView and I ...
1
vote
0
answers
41
views
Master detail with relational tables: how to properly submit new records?
I'm studying the masterdetail example but it does not fit my real case scenario.
I cannot use the same approach of retrieving the relational model like this:
QSqlTableModel *artistModel = model->...
1
vote
1
answer
93
views
PyQt6, related QComboBoxes in a QSqlRelationalDelegate
Suppose that in a QSqlRelationalDelegate we have two relation columns, country and city.
The city table has a country_id field.
By overriding the setEditorData method of QSqlRelationalDelegate, I'm ...
1
vote
0
answers
107
views
How to display data from secondary table using PyQT Relational & data mapper
I am an experienced programmer but new to Python/PyQt & just trying to get my head around how the QSqlrelationship/DataWidget mapper works.
I have a main table, Tracks which links to Album table. ...
0
votes
0
answers
48
views
Why are the rows missing? QTableView + QSqlRelationalTableModel [duplicate]
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 ...
3
votes
2
answers
530
views
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 ...
0
votes
0
answers
610
views
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, ...
1
vote
0
answers
553
views
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. ...
1
vote
1
answer
121
views
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("...
0
votes
1
answer
151
views
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-&...
0
votes
1
answer
161
views
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", "...
6
votes
0
answers
356
views
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 ...
0
votes
0
answers
82
views
Python QSqlRelation
I am using a QtableView to display data from a QSqlRelationalTableModel which seems to work fine, however when I use
self.motormodel.setRelation(1, QSqlRelation('Instruments', "Asset Tag",&...
0
votes
1
answer
739
views
QComboBox populated from a relation model and connected to a QDataWidgetMapperbehaves strangely when setEditable(True)
I have a QComboBox populated from a relationModel of a QSqlRelationalTableModel and connected to a QDataWidgetMapper.
I select a row in the QTableView, this row (record) mapped to the QLineEdit and ...
2
votes
1
answer
481
views
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 ...
0
votes
1
answer
762
views
QSortFilterProxyModel sorts only the fetched data
I have a QTableView with a QSortFilterProxyModel as its model which has a QSqlRelationalTableModel as its source model.
When I sort or filter the viewed data through the QSortFilterProxyModel, only ...
0
votes
1
answer
858
views
QSortFilterProxyModel headerData
I have 2 QTableViews connected to 2 QSortFilterProxyModels which are connected to only 1 source model (QSqlRelationalTableModel).
On sorting or filtering any of the proxy models, it is reflected in ...
0
votes
1
answer
114
views
QSqlRelationalModel: After I call setRelation(...), the column in the model seem to be replaced by the column in the foreign table
After setRelation(...), How can I get the original value of the column which seems have already been replaced by the column in the foreign table?
Here's my code:
Table "record" contains "recordId ...
2
votes
1
answer
566
views
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" ...
0
votes
0
answers
177
views
Update related table in QSqlRelationalTableModel
I have a QSqlRelationalTableModel like this:
rel_model = QSqlRelationalTableModel(self, connectDB)
rel_model.setTable("main_table")
rel_model.setRelation(1, QSqlRelation("linked_table", "id", "name"))...
1
vote
1
answer
441
views
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 ...
-1
votes
4
answers
1k
views
QSqlRelationalTable How to display value from other table in a column with foreign key?
I have a SQLite database with three tables:
graph(ID int primary key, name varchar(64));
vertex(ID int primary key, graphID int references graph(ID), name varchar(64), x int default 0, y int default ...
1
vote
1
answer
621
views
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 ...
0
votes
1
answer
251
views
How to sort QTableView and pull down list that uses QSqlRelationalTableModel, QSqlRelationalDelegate, PyQt5
I need to sort records displayed in a QTableView that uses a QSqlRelationalTableModel with QSqlRelationalDelegate. I want the values in the pull down list and the table view to be sorted.
I've done a ...
1
vote
0
answers
419
views
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 ...
0
votes
1
answer
922
views
Commit QSqlRelationalTableModel model changes to database
I've modified the relational table model at
https://doc.qt.io/qt-5/qtsql-relationaltablemodel-relationaltablemodel-cpp.html
I want to be able to save my changes to my database, but it only saves the ...
0
votes
1
answer
315
views
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(...
0
votes
1
answer
130
views
QSqlRelationalTableModel displaying an icon instead of data
I'm displaying a table that contains one column with a blob (pdf file). I could have hide the column for the user, but instead i wanted to show a icon in the column when it was a document on file. I ...
2
votes
1
answer
224
views
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 ...