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. [SOLVED] Issue on dynamically added columns/rows to QStandardItemModel
QtWS25 Last Chance

[SOLVED] Issue on dynamically added columns/rows to QStandardItemModel

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.8k Views
  • 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
    marcus.fr
    wrote on last edited by
    #1

    Hi

    I have a QStandardItemModel set on a QTreeView. I dynamically add rows with different number of columns.

    If I add a row with more columns than the current model's column count, the other rows are not filled with QStandardItem(s) objects in the gap to the additional columns. Those "empty" cells in the other rows cannot be selected or used because there is no QStandardItem object associated with them. I need all cells in the model to have QStandardItem object whenever I add row with number of columns over the current column count. What would be a solution?

    Thanks!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      marcus.fr
      wrote on last edited by
      #2

      I guess it is how it should work, so I use a workaround: loop in all rows recursively to create missing columns/items.

      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