Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, January 2008
multiple directory selection dialog


Message 1 in thread

I'm having a bit of trouble with one of the examples from the FAQ. I would
like a directory selection dialog that allows for the selection of multiple
directories. My solution seems to be the FAQ entry at:

http://trolltech.com/developer/knowledgebase/faq.2007-03-08.3778118820/

When I compile that example however in QT 4.3.2 under Ubuntu, only the
Detail View allows for multiple selection. The List View does not.

The specific code I'm compiling is:

http://odin.himinbi.org/tests/qt_multiple_dir_select.cpp

I was initially attempting this in PyQT and the results are the same:

http://odin.himinbi.org/tests/multiple_dir_select.py

I'm new to QT and it is easily possible I'm missing something. I did only
copy and compile the C++ code though, so there's not really all that much
room for error.

Any suggestions would be appreciated.

Will

Message 2 in thread

Hi,

> I'm having a bit of trouble with one of the examples from the FAQ. I 
> would like a directory selection dialog that allows for the selection of 
> multiple directories. My solution seems to be the FAQ entry at:
> 
> http://trolltech.com/developer/knowledgebase/faq.2007-03-08.3778118820/
> 
> When I compile that example however in QT 4.3.2 under Ubuntu, only the 
> Detail View allows for multiple selection. The List View does not.

I can reproduce that with Qt 4.3 and 4.4 as well. Maybe this FAQ was written 
and tested using some prior version of Qt 4, but it certainly doesn't apply to 
current versions of Qt. Have you reported this as a (FAQ) bug?
	http://trolltech.com/bugreport-form

The solution is simple: QFileDialog has a single QTreeView child, but many 
QListView children. You were retrieving the "sidebar" view instead of the 
"listView" view. Make sure you retrieve the correct "listView" view before 
applying setSelectionMode() to it.

Try changing from:
     QListView *l = w.findChild<QListView*>();
to:
     QListView *l = w.findChild<QListView*>("listView");

--
 [ signature omitted ]