PDA

View Full Version : How do you synchronize GUI elements to a (non-database) data source?



SpiceWeasel
17th September 2015, 21:52
I have an array of items. An item is represented by a class that contains three string fields. I have a GUI with three line edits to display/edit the fields of an item. I also have a slider to access the items within the array.

I want to synchronize the items within the array with any changes made to the line edits. Is there a way to do that automatically, such that a change to the line edit updates the data? (And vice-versa?)

Infinity
18th September 2015, 00:51
Your data structure seems like a table (rows are the elements in your array, columns are the three string values). Hence you might want to subclass the QAbstractTableModel.

I don't think what you want to do can be done automatically.

anda_skoa
18th September 2015, 09:40
I'd say maybe QAbstractTableModel with a QDataWidgetMapper

Cheers,
_