Updating widget with QSqlTableModel
-
Hello,
I have a database that look like this :

And my goal is to make a custom widget out of each row of the database

For that I decided to use a QSqlTableModel and for each custom widget that I make, create a QWidgetMapper in whose purpose is to map a specific row to the QLabels of my custom widget like so
m_dataMapper->addMapping(m_descriptionLabel, model->fieldIndex("description"), "text"); m_dataMapper->addMapping(m_tagLabel, model->fieldIndex("tag"), "text"); m_dataMapper->setCurrentIndex(row);In my application, I allow the user to modify those label using QDialog, but one thing I am not able to do is update the database using my model and force it to update automatically the QLabels of my custom widget. Should I use a delegate ? What am I doing wrong
-
Hello,
I have a database that look like this :

And my goal is to make a custom widget out of each row of the database

For that I decided to use a QSqlTableModel and for each custom widget that I make, create a QWidgetMapper in whose purpose is to map a specific row to the QLabels of my custom widget like so
m_dataMapper->addMapping(m_descriptionLabel, model->fieldIndex("description"), "text"); m_dataMapper->addMapping(m_tagLabel, model->fieldIndex("tag"), "text"); m_dataMapper->setCurrentIndex(row);In my application, I allow the user to modify those label using QDialog, but one thing I am not able to do is update the database using my model and force it to update automatically the QLabels of my custom widget. Should I use a delegate ? What am I doing wrong
-
