Best approach for xml processing using model/view



  • Hi,

    I' working on an xml app while trying to learn and practice the model/view concepts. Currently, the application uses QXmlStreamReader(Writer) to parse the xml files and loads the required element texts in a QStandardItemModel which in turn uses a QTableView for displaying the data. The model's rows and columns are added dynamically, but for the purposes of my question I'll use the most common scenario, which is 2 columns and thousand rows. The model's items consist of QStrings (first column contains a sentence, the second contains its translation).

    Now I have decided to include more items from the xml files, such as attributes. This means, for each record (columns 1 and 2) I have to find a way to populate the model with a QMap with attribute names and values for this record, and present them somehow (probably in a widget using QDataWidgetMapper). I don't think this is possible with the QStandardItemModel I have selected, and that I have to either create a custom model or switch to QsqlRelationalTableModel, but if there's any way to do that with the current approach I've followed I'll be glad to know.

    I would appreciate any advice or recommendation.

    Thanks.


Log in to reply
 

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