Details
-
Suggestion
-
Resolution: Won't Do
-
Not Evaluated
-
None
-
6.8
-
None
Description
I have made file using abs path, so fW.fileName() returns abs path, but I want to get "W.txt" only... I suggest to add build-in mechanism of QFile to get filename only.
My example
QFile fW("/home/user/W.txt"); fW.open(QIODevice::WriteOnly); fW.close(); qDebug() << fW.fileName(); //print "/home/user/W.txt" instead of "W.txt"
Of cause I can use this code to solve my problem
qDebug() << QFileInfo(fW.fileName()).fileName(); //print "W.txt"
But why I can't use my fW object only without QFileInfo() or QString?