开发者

QFileDialog alternative that uses default file dialog defined by OS?

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:

QFileDialog alternative that uses default file dialog defined by OS?

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;
开发者_JS百科


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


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜