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. Lifetime of QStandardItem objects from QStandardItemModel

Lifetime of QStandardItem objects from QStandardItemModel

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.6k 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.
  • T Offline
    T Offline
    toralf
    wrote on last edited by
    #1

    Does anyone know when QStandardItem objects/pointers from QStandardItemModel methods like item() and itemFromIndex() should no longer be considered valid? I mean, I'm assuming they will be gone if the rows/columns in question are removed, but can they also be invalidated on other events, like when data items are inserted or removed elsewhere in the model?

    And how about the objects passed to insertRow() or similar. It looks like these will initially used directly (data is not copied), but for how long are they kept?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Santosh Reddy
      wrote on last edited by
      #2

      As long as the item is in the view (doesn't matter if it is moved around)

      EDIT: I meant model (not view)

      SS

      1 Reply Last reply
      0
      • T Offline
        T Offline
        toralf
        wrote on last edited by
        #3

        And what if there isn't a view?

        I have a setup where a certain model and its data always exists througout the lifetime of the application, but the view into it may be freely opened and closed by the user.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Santosh Reddy
          wrote on last edited by
          #4

          I mean model not view

          SS

          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