QStringRef to QVariant (for use with QStandardItemModel/QModelIndex)



  • 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?



  • You must copy, QVariant always contains a copy of the original data as it's a value type


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.