Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QStringRef to QVariant (for use with QStandardItemModel/QModelIndex)
utcenter last edited by
I changed from using QString to using QStringRef, since I keep the original string, however QStringRef doesn't "cast" to QVariant, which is needed to use with QStandardItemModel/QModelIndex, forcing me to use QStringRef::toString() and making the entire optimization pointless.
I am not that familiar with QVariant, so my question is who can I proceed in order to avoid the unnecessary duplication of memory?
twsimpson last edited by
You must copy, QVariant always contains a copy of the original data as it's a value type