PDA

View Full Version : get filename from a QFileDialog



graciano
5th August 2009, 13:08
Hi,

This code gives me the full filename:

QString usersfilename = QFileDialog::getOpenFileName(this,
"Select source file",
".",
"Text files (*.txt);; All files (*.*)");

ui->users_filename->setText(usersfilename);

Is there a function to get the filename without the full path?

Thanks

spirit
5th August 2009, 13:10
take a look at QFileInfo::fileName.

Astronomy
17th November 2009, 15:57
take a look at QFileInfo::fileName.

Thanx!

QFileinfo::basename().toStdString() was exact the one i needed too (-:

greetz Astronomy