Reputation: 32805
I tried using a QFileDialog
in a program of mine, but I prefer the default file dialog that is used by the host's OS. In my case, since I use Windows 7, it should look like this:
Is there a way to make Qt use the default file dialog that is used by the host's OS?
My code:
QFileDialog saveDialog(this);
saveDialog.setAcceptMode(QFileDialog::AcceptSave);
if (!saveDialog.exec())
return;
Upvotes: 4
Views: 5550
Reputation: 2769
Use the static functions for it and it will work.
QString filename = QFileDialog::getOpenFileName(this, ... vars);
It will use the native dialogs for OSX and Windows, but if you don't use one of the static functions to show it, it will use the QT one.
It was written in the docs for those different static functions.
http://doc.qt.io/qt-4.8/qfiledialog.html
Upvotes: 3
Reputation: 17046
Unless you've told it not to, Qt tries to use the native file dialogs. If it isn't with windows7, that's a bug.
Show us some testcase code, it should be working. Are you subclassing your own QFileDialog instead of using the builtin static method?
Upvotes: 0