Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED]QLineEdit With Model
I need to know if there is a way to bind both QLineEdit to a model that is already assigned to a QTableView.
this was easy in C# using databinding.
Any ideas will be appreciated
DenisKormalev last edited by
Hm, can you elaborate what you mean by bind QLIneEdit (one value) to model (a lot of values)?
Yes the IDEA is just as POC (Proof of concept)
QTableView and QLineEdit in the MainWindow
There is a model that is derived from QAbstractTableModel, where I have a custom model that will be the data source (in .NET terminology) for the QTableView
When I click on one row, there should appear a specific column value in the LineEdit (lets say the first one which represent the first name),by changing the row the value should change to reflect the current row.
When changing the value of LineEdit it should also instantaneously be changed in the QTableView because they have the same source.
This was easy to do with C# by setting the datasource field name (I miss those days)
andre last edited by
I think you are looking for [[Doc:QDataWidgetMapper]].
Thanks Andre, it's really what I was looking for I've did the following and it worked
There are problem I'll try to figure out, when changing the selection on QTableView the LineEdit is not updated.
When changing the text in the lineEdit the text in the view doesn't change unless I leave the cell.
I think it needs a lot of work, anyway thank you Andre, that's what I was looking for.