QFileDialog :: getOpenFileName不在Mac OS 10.8 Mountain Lion上设置初始目录 [英] QFileDialog::getOpenFileName doesn't set the initial directory on Mac OS 10.8 Mountain Lion

查看:119
本文介绍了QFileDialog :: getOpenFileName不在Mac OS 10.8 Mountain Lion上设置初始目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用Qt 4.8的QFileDialog更改当前目录.在Windows和Mac OS 10.6 Snow Leopard上,相同的代码也可以正常工作.如果我不使用本地Mac OS X对话框,它也可以正常工作.

I can not change the current directory with QFileDialog with Qt 4.8. The same code works fine on Windows and Mac OS 10.6 Snow Leopard. It also works fine if I don't use the native Mac OS X dialog.

这有效:

fn=QFileDialog::getOpenFileName(this,"Select File","/Users/myuser/Desktop",QString(),0,QFileDialog::DontUseNativeDialog);

这不起作用:

fn=QFileDialog::getOpenFileName(this,"Select File","/Users/myuser/Desktop");

好像大多数情况下,它打开对getOpenFileName的最后一次调用的最后一条路径.

It looks like if most of the time it opens the last path of the last call to getOpenFileName.

推荐答案

这是Qt中的错误,据报道已在Qt 5.0.1和Qt 4.8.4中修复(尽管看来它仍可在4.8.4中重现)人(包括我自己).

This is a bug in Qt that is reportedly fixed in Qt 5.0.1 and Qt 4.8.4 (though it seems that it still reproducible in 4.8.4 by people (myself included)).

此错误在JIRA中已报告为 QTBUG-20771 QTBUG-28161 ,最后是 Gerrit 中的补丁链接.

This bug has been reported in JIRA as QTBUG-20771, QTBUG-28161 and finally QTBUG-35779 (which appears to have finally fully resolved the issue in Qt 5.2.1). Here is a link to the patch in Gerrit.

这篇关于QFileDialog :: getOpenFileName不在Mac OS 10.8 Mountain Lion上设置初始目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆