How to implement a TreeView whose underlying data is a qvector<qvector<CustomClass>> data and can update the view whenever data is modified?
I have a data structure QVector < QVector< CustomClass>> called raw_data and I want to show it within a QTreeView in my Qt application, like the following graph: \Index1 |- raw_data[Index1] // Assume my CustomClass can be convert ed to string |- raw_data[Index1] ... |- raw_data[Index1][N1-1] \Index2 |- raw_data[Index2] |- raw_data[Index2] ... |- raw_data[Index2][N2-1] ... Here, raw_data can be modified by many other processing functions in my project and what I want to implement is updating the QTreeView automatically whenever some function has modified raw_data. (E.g. delete/insert) I know model-view-controller is a solution for displaying underlying data in some view, but I don't really understand how to implement this.
Each views use a model to store the data. A Model is an abstraction for data in tables, lists, trees and each cell may store info of different properties like text, colors, states, etc. To customize the model, you need to extends QAbstractItemModel or any of it derived classes. You may find more info about subclassing the model in here. To indicate the View that data has changed, your model need to emit dataChanged whenever any value (with visual impact) is modified.
How to set Qmake -project default values?
Separating data and test settings in QTests
How can I expand a list in a Toolbar in QML when the user tap the title of the it?
Qt WebEngine error while using example “contentmanipulation”
How to show multiple tooltips at once
Custom winapi Window frame without DWM
QGrahpicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget), widget change to 0x0( nullptr,NULL)
How to get an auto incremented ID of a newly inserted row
Qt 5.8.0 MSVC - Getting a weird compiler error
ubuntu 16 cannot install robomongo
Appropriate technique to create new object by user on front end in Qt
Library libqtx does not show in include
ZoomIn Keyboard Controls
QLineEdit Password - Obscure All But Last Character
qmake doesn't search library path
Beaglebone black freeze at “reading u-boot.img” stage