Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Selection in a QFileSystemModel and QTreeView
sheehan1234 last edited by
I've created a QTreeView with a QFileSystemModel for the user to select a file to be used by the rest of the program. I'm having trouble obtaining the selected file as a QString. Currently I have this function:
file = "";
Where model is the QFileSystemModel and tree is the QTreeView
leon.anavi last edited by
bq. Note: If you do not have a value to return, return an invalid QVariant instead of returning 0.
This note is taken from "the official documentation of QAbstractItemModel which is inherited by QFileSystemModel ":http://doc.qt.nokia.com/4.7-snapshot/qabstractitemmodel.html#data Do you get invalid QVariant in your case?