Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Best approach for xml processing using model/view

    General and Desktop
    1
    1
    1355
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      panosk last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post