[Qt-interest] Selecting multiple files on different locations using QFileDialog
Andre Somers
andre at familiesomers.nl
Fri Dec 31 12:17:49 CET 2010
Op 31-12-2010 12:13, hi schreef:
> Hi Andre,
>
> I think you might be displaying tree view where 'List view' or 'Detail
> view' show the content, right? But in this case it would be displaying
> only currently dir's tree view and when you switch over to other dir
> it would have flushed the previous selection.
No, I (can) just display a complete tree, with directories _and_ files,
with a checkbox in front of all of them. And selections in that scenario
do not get flushed when you change to another directory. The only
extension to what I already wrote would, IMHO, be that you need to
handle directories a bit different from files: selecting a directory
would select all files and subdirectories inside it, and a directory
with both selected and unselected files would get an intermediate
checkstate. But it depends on what you are selecting _for_, I guess.
André
> Thank you.
> -Hiral
>
> On 12/31/10, Andre Somers<andre at familiesomers.nl> wrote:
>> Op 31-12-2010 10:17, Jeffery MacEachern schreef:
>>> On Fri, Dec 31, 2010 at 01:07, Onur Tugcu<onur.tugcu at gmail.com> wrote:
>>>> I've seen a tree view with checkboxes used for such scenarios.
>>> Ah, good point - that didn't occur to me due to the context in which
>>> I've seen it. That would also nicely avoid the problem (or annoyance,
>>> at least) of the user selecting a superset of another selection.
>> Such a thing can be easily achieved by creating a proxy model that sets
>> the appropriate flag to make an item checkable and outputs the right
>> checkstate from data() and sets it from setData(). I have just created
>> one a week or two ago (sorry, can not share) which was quite simple. I
>> abused a QItemSelectionModel inside my QSortFilterProxyModel subclass to
>> keep track of what items were checked, which works well and results in
>> remarkably little code. I use it on a QFileSystemModel and that works
>> just fine.
>>
>> André
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>
More information about the Qt-interest-old
mailing list