As stated in the title, I would like to extract the filename of a path (I use FileDialog
to find a file). If possible without using c++ code.
I'm on Qt 5.4.2 mingw. Thank you in advance.
As stated in the title, I would like to extract the filename of a path (I use FileDialog
to find a file). If possible without using c++ code.
I'm on Qt 5.4.2 mingw. Thank you in advance.
Copyright © 2021 Jogjafile Inc.
Given how trivial it is to interface QML with any C++ class, it's not a problem that the solution is in C++.
QFileInfo(filePath).fileName()
does it, iffilePath
is the path returned from the file dialog. You only need to expose it to QML:From QML, simply invoke
appHelper.fileNameFromPath(path)
.