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. Why is there QVariant(const QModelIndex &) constructor and not QVariant(const QPersistentModelIndex &) one?
Forum Updated to NodeBB v4.3 + New Features

Why is there QVariant(const QModelIndex &) constructor and not QVariant(const QPersistentModelIndex &) one?

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

    The documentation of QModelIndex says: "Model indexes should be used immediately and then discarded. You should not rely on indexes to remain valid after calling model functions that change the structure of the model or delete items. If you need to keep a model index over time use a QPersistentModelIndex. "
    What good is a QVariant for keeping a QModelIndex? And why there is no QVariant for keeping QPersistentModelIndex?

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      i can't answer your question why there is no such constructor, but you may want to report a "feature request":https://bugreports.qt-project.org/?

      Nevertheless the missing of this constructor doesn't prevent you from using QPersistentModelIndex in QVariant...

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      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