[SOLVED] How to save data (e.g a path of an image) in a listwidget item?
-
we have a listwidget, and you add an image.. what i did until now was to save the path of the image as statustip withouth having statusbar, so when i needed the path i just called ui->listwidget->item(1)->statustip..
but this seems just wrong, is there anything for that purpose.. the path must not be visible to user at any time...
-
I'm not sure about the use of Qt::AccessibleTextRole (11) for this purpose. You can also define your own Role for this. See "ItemDataRole documentation":http://qt-project.org/doc/qt-4.8/qt.html#ItemDataRole-enum
bq. Qt::UserRole 32 The first role that can be used for application-specific purposes.
bq. For user roles, it is up to the developer to decide which types to use and ensure that components use the correct types when accessing and setting data.
-
No, you should use 32 or greater value. 11 is reserved for accessibility.