Qt-interest Archive, February 2007
[4.2.2] QFileDialog setViewMode broken?
Message 1 in thread
Behold this prosaic fragment:
QFileDialog itOpen;
itOpen.setViewMode( QFileDialog::Detail );
QString fn = itOpen.getOpenFileName(this,
tr("Open File..."),
QString(),
tr("All Files (*)") );
When the dialog appears, it's in List mode and so I have to
click the Detail View button.
(This is on Linux; maybe the Windows/Mac native dialogs work.)
--
[ signature omitted ]
Message 2 in thread
On 06.02.07 07:15:43, Forrest wrote:
> Behold this prosaic fragment:
>
> QFileDialog itOpen;
> itOpen.setViewMode( QFileDialog::Detail );
> QString fn = itOpen.getOpenFileName(this,
> tr("Open File..."),
> QString(),
> tr("All Files (*)") );
>
> When the dialog appears, it's in List mode and so I have to
> click the Detail View button.
No wonder, you're using the static getOpenFileName method, which means
it doesn't use the instance you used to call it so its taking the
default settings and the ones you provide as arguments.
What you want to do is use the setFilter and setWindowTitle with the
arguments you used on the static method and then call itOpen.exec() or
itOpen.show(). After the dialog is closed you can fetch the selected
files and go on.
Andreas
--
[ signature omitted ]
Message 3 in thread
Andreas Pakulat wrote:
>> When the dialog appears, it's in List mode and so I have to
>> click the Detail View button.
> What you want to do is use the setFilter and setWindowTitle with the
> arguments you used on the static method and then call itOpen.exec() or
> itOpen.show().
Grazie! That's much better.
--
[ signature omitted ]