browse into QUrl
-
Hi,
I Wonder how to extract subpath from a QUrl.
For instance, I have a path /A/B/C/D then I want only the path of the second upper directory: /A/BIs there an elegant way to do it without string manipulation?
Something working like cd .. bash ommand? -
Hi and welcome
If there is always at least 2 paths you could just split it to a list
QString input = your QUrl;
QStringList lines = input.split('/');
then you can get the parts using lines list.Not super elegant. but better than hardcore string manipulation :)
-
@mrjj But it is not cross platform.. Windows use " \ " and linux " / " .
So, I can use QDir::seperator ... Or split using a regular expression .Thanks for your reply
-
Just a note.
you can use c:/somepath/blabla in windows too :)
(from within Qt)But yes, you are correct, using seperator is needed for external coming paths.