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

  • 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?


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

Log in to reply