PDA

View Full Version : QFileDialog



rmagro
11th February 2010, 18:45
Is there an easy way to add a button to select all files shows in current windows dialog..

rmagro
16th February 2010, 14:50
Hey guys, is it possible to add a custom button to a QfileDialog to select all files in the current dir, with Qt4?
thx
roby

bmhautz
16th February 2010, 17:11
Hey guys, is it possible to add a custom button to a QfileDialog to select all files in the current dir, with Qt4?
thx
roby

Is there a special reason for a separate button instead of using the "Ctrl-A" shortcut key?

Lykurg
16th February 2010, 17:24
Well you can subclass QFileDialog and add a custom button to the layout which holds the other button. Then add a slot which selects all files. That's it.

rmagro
17th February 2010, 11:47
Many thx for your kind reply..

can you provide an example about how to select all file programmatrically.. it seems to me that Qt4 dos not have anymore this functionality..

rmagro
17th February 2010, 11:52
does "Ctrl-A" shortcut key work for you to select all files in a QFileDialog?

Lykurg
17th February 2010, 13:57
can you provide an example about how to select all file programmatrically.. it seems to me that Qt4 dos not have anymore this functionality..
True, I can't find such a function. Crazy. A hack inside a subclass could be:
QListView* w = qobject_cast<QListView*>(itemDelegate()->parent());
if (w)
{
w->selectAll();
}

rmagro
17th February 2010, 16:23
very kind,
thanks

bmhautz
17th February 2010, 17:57
does "Ctrl-A" shortcut key work for you to select all files in a QFileDialog?

Yes, the Ctrl-A shortcut does work in a QFileDialog (at least on Windows, but it should work on every platform, take a look at http://qt.nokia.com/doc/4.6/qkeysequence.html for more information).