Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Set XML data to QTableView
Qt 6.11 is out! See what's new in the release blog

Set XML data to QTableView

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.0k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    mythili
    wrote on last edited by
    #1

    Hi,
    I am having an XML file which containing titles and authors of books. I am reading the title tags alone and I want to display them in QTableView in rows. Please help me.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      If I understand you well you want to show the title from your XML file in a one column/many rows widget ?

      In that case you could simply use a "QListWidget":http://qt-project.org/doc/qt-4.8/qlistwidget.html that you fill while parsing your xml.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mythili
        wrote on last edited by
        #3

        I want to use QTableView. Can u help me with some lines of code using QStandardModelItem and QModelIndex.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          If you want to use QStandardItemModel, simply follow the example from the "documentation":http://qt-project.org/doc/qt-4.8/qstandarditemmodel.html#details or use "this":http://qt-project.org/doc/qt-4.8/qstandarditemmodel.html#appendRow-2

          The code is easy to adapt to your use case

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved