Questions tagged [qsqlrelationaltablemodel]

26 questions
0
votes
0 answers

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","Description" ))…
0
votes
1 answer

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 QComboBox widgets then I make some changes and…
0
votes
1 answer

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 the fetched data is affected. I managed to get it…
0
votes
1 answer

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 the respective table view. BUT When I modify the…
0
votes
1 answer

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 integer, bookId integer, bookName varchar, author…
yjjj
  • 1
  • 2
0
votes
1 answer

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")) rel_model.select() But now the data in the…
vezzon
  • 177
  • 1
  • 11
0
votes
1 answer

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 lot of searching but have not found examples that…
0
votes
1 answer

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 first two columns, not the primary key lookup…
user1801060
  • 2,733
  • 6
  • 25
  • 44
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

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 subclassed QsqlRealtionalTableModel and overload…
Dan3460
  • 95
  • 3
  • 13
-1
votes
4 answers

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 0); edge(ID int primary key, graphID int…
1
2