Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Why is there QVariant(const QModelIndex &) constructor and not QVariant(const QPersistentModelIndex &) one?
EmoBemo last edited by
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?
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...