A map of QStandardItemModel or QTablView



  • i want to store tableviews in a map which way is better to keep all the information about the table
    like (rowcounts,values in the cells,h/v headerlabels,.....)
    should i do this
    @QMap<QString,QStandardItemModel*> tables;@
    or
    @QMap<QString,QTableView*> tables;@
    or
    maybe a whole other way



  • The table information should be within your model, not your view. Your view is just a "dumb" view widget that doesn't hold the represented data itself. However if you have multiple views that work differently (on the same model?) you could use the qmap<QString, QTableView*>. On the other hand, what does the QString hold? Isn't a simple QList<QTableView> not more easy?



  • hi,thanks for the reply
    the QString will hold the table's name,i need to reserve each table and it's
    name "like a tag" for save/open,and in searching for a certain table
    so,if there is a better way to that,that you know of, let me know


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.