Solved Take an index and get a real path
-
Team,
Program lays out the files.
I click one; the index changes.It outputs something like this
QModelIndex(1,0,0x561bc4b7f970,QFileSystemModel(0x561bc46ac870))
Is it possible to convert the above and turn it to ---
/home/User/Desktop/file.txt
Just curious. If I can't I'll keep plugging away.
-
Hi,
Do you mean QFileSystemModel::filePath ?
-
I would assume so - however I am such a noob I can't figure out how to take the selection from treeview and pull the fully qualified path. All I can get is the signal from ui->treeView->currentIndex();
-
What exactly are you trying to achieve ?
-
Pick a file from treeview- on mainwindow, take the path of file from qtreeview; turn it into a string and perform functions on the file.
Lost on
ui->treeview->//do I use currentIndex() ? Or is there a filepath function specifically for this?
I havent tried to modify with the index output. I figured You had to have the correct path.
-
You should use your view's selection model and connect the currentChanged signal to the slot where you want to do the processing you need. In that slot, use the QFileSystemModel::filePath method I suggested earlier.