PDA

View Full Version : Get the name of directory from the absloutepath



kamlmish
20th January 2011, 06:30
Hi
I have a very small problem
I am able to get the absolutepath of the directory using the QFileDialog::getExistingDirectory()
i.e
QString str = QFileDialog::getExistingDirectory();
returns
str = /root/Desktop/images


Now , how can I get the "images" from the string str

schnitzel
20th January 2011, 06:37
take a look at QString::split and use '/' as the separator

or you could use QString::section, again use '/' as the separator

both of these show nice examples on how to use them.

Lesiok
20th January 2011, 07:09
Look at QDir::dirName