QFileDialog::getOpenFileName - change label to "import"?
Hi.
When I use QFileDialog::getOpenFileName to let user choose a file to import, the dialog's button reads "open". Is it possible to change that button to "Import" rather than open? It is not a big deal but it makes my application more in line with the action the user is doing.
Thanks!
Re: QFileDialog::getOpenFileName - change label to "import"?
Re: QFileDialog::getOpenFileName - change label to "import"?
I tried. But it does not work. Any other idea?
Re: QFileDialog::getOpenFileName - change label to "import"?
Seems to work fine for me:
Code:
#include <QApplication>
#include <QDebug>
#include <QtGui>
int main(int argc, char *argv[])
{
d.exec();
qDebug() << d.selectedFiles();
return a.exec();
}
Re: QFileDialog::getOpenFileName - change label to "import"?
I did this. Does not seem to work.
Quote:
QFileDialog d;
d.setLabelText( QFileDialog::Accept, "whatever" );
QString fileName = d.getOpenFileName(this, tr("Import File"),
importfilename,
tr("jpg (*.jpg)"));
Re: QFileDialog::getOpenFileName - change label to "import"?
getOpenFileName is static method, it will create default file dialog inside, will not use your dialog object. You need to call "exec" to use your dialog with changed label.