Thanks for the feedback. We'll look into it for Qt-4.5.
-Richard
On Jan 21, 2009, at 8:42 PM, Martin Dyde wrote:
One more issue to report:
qt-all-commercial-src-4.5.0-snapshot-20090113 built with:
./configure -prefix $PWD -platform macx-g++ -arch x86_64
The dir argument of QFileDialog::getOpenFileName() and
QFileDialog::getSaveFileName() isn't quite working as documented.
Here's the relevant excerpt from the Qt (4.4): docs:
"The file dialog's working directory will be set to dir. If dir
includes a file name, the file will be selected."
This is what's actually happening:
If dir ends with a directory then:
- with Qt 4.4 (both Carbon/OS SDK 10.4u and Windows) the (native)
QFileDialog correctly opens inside that directory, regardless of
whether dir ends with a directory separator character ('/') but
- with Qt 4.5/Cocoa/OS X SDK 10.5 that only works properly if dir
explicitly ends with a directory separator.
[We can work around that one fairly easy by just explicitly
appending a directory separator character prior to calling.]
Also, if dir contains a path and ends with a filename then:
- with Qt 4.4 (both Carbon/OS SDK 10.4u and Windows) the (native)
QFileDialog correctly opens inside that specified path, and the
filename is selected (getOpenFileName) or shown as a default/
suggested filename (getSaveFileName) but
- with Qt 4.5/Cocoa/OS X SDK 10.5 the dialog opens in the wrong
directory (one level up) and the lower level directory is selected,
rather than the specified file within it. I.e. everything happens
one level too high up in the directory tree.
[This one we can't seem to work around, in that there doesn't seem
to be any way to get QFileDialog::getSaveFileName() to specify a
default filename for 'save as' actions.]
To reproduce, edit $QTDIR/examples/dialogs/standarddialogs/
dialog.cpp, find Dialog::setOpenFileName() and change the following
line (see 'changed line' comment):
void Dialog::setOpenFileName()
{
QFileDialog::Options options;
if (!native->isChecked())
options |= QFileDialog::DontUseNativeDialog;
QString selectedFilter;
QString fileName = QFileDialog::getOpenFileName(this,
tr("QFileDialog::getOpenFileName()"),
"/Developer/Tools/otest", // CHANGED
LINE
tr("All Files (*);;Text Files
(*.txt)"),
&selectedFilter,
options);
...
Then find Dialog::setSaveFileName() and change the following line:
void Dialog::setSaveFileName()
{
QFileDialog::Options options;
if (!native->isChecked())
options |= QFileDialog::DontUseNativeDialog;
QString selectedFilter;
QString fileName = QFileDialog::getSaveFileName(this,
tr("QFileDialog::getSaveFileName()"),
"/Developer/Tools/otest", // CHANGED
LINE
tr("All Files (*);;Text Files
(*.txt)"),
&selectedFilter,
options);
...
Build and run. Leave 'use native file dialog' ticked and click on
the QFileDialog::getOpenFileName() button. The dlg should open in
the /Developer/Tools dir, with the otest file selected. However, on
Qt 4.5/Cocoa it's currently incorrectly opening in the /Developer
dir with Tools dir selected.
Also click on the QFileDialog::getSaveFileName() button. The dlg
should open in the Developer/Tools dir, with otest showing as a
default (suggested) filename. However, again on Qt 4.5/Cocoa it's
instead opening in /Developer, with Tools selected as a suggested
filename. There doesn't seem to be a way to get it show a suggested/
default filename properly.
Thanks and best regards,
Martin Dyde.
Martin Dyde,
Milan Digital Audio LLC.
http://www.crumhorn-labs.com/
http://www.milandigitalaudio.com/
_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback
_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback