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. QAbstractTableModel and the "QModelIndex parent" parameter
Forum Updated to NodeBB v4.3 + New Features

QAbstractTableModel and the "QModelIndex parent" parameter

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 201 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.
  • A Offline
    A Offline
    andi456
    wrote on last edited by
    #1

    Hi,

    if the custom model underlying a QTableView changes the number of rows or columns (in my rows in my case), the QTableView needs to be informed in some fashion in order to provide the display the rows correctly. The documentation says that there is the option to implement insertRows or to write custom code and calling beginInsertRows from there.

    If I chose the second option, would I have to pass the "QModelIndex parent" parameter to beginInsertRows? Apart from that, the documentation also tells me, that rowCount or columnCount should return 0, if the parent QModelIndex parameter is valid. Why?

    Kind regards,

    Andreas

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

      Hi,

      There's no reason to have a parent in a table model. Parents only have sens in a tree type model.

      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
      2

      • Login

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