[Qt-interest] Fwd: QFileSystemModel some questions
Alex Custov
alex.custov at gmail.com
Sat Apr 4 13:10:09 CEST 2009
---------- Forwarded message ----------
From: Alex Custov <alex.custov at gmail.com>
Date: 2009/4/4
Subject: Re: [Qt-interest] QFileSystemModel some questions
To: Alexis Ménard <alexis.menard at trolltech.com>
2009/4/3 Alexis Ménard <alexis.menard at trolltech.com>:
> On Friday 03 April 2009 21:34:32 Alex Custov wrote:
>> 2009/4/3 Alexis Ménard <alexis.menard at trolltech.com>:
>> > On Friday 03 April 2009 19:56:14 Alex Custov wrote:
>> >> Hi.
>> >>
>> >> I'd like to try QFileSystemModel with different views. It seems to
>> >> work, but it misses several important features. Well,
>> >>
>> >> 1) How to show system-wide MIME icons for files? Currently all of them
>> >> are blank. Directory icons seems to work, but all files have blank
>> >> icons.
>> >
>> > If you want to be able to see that then you can create you own
>> > fileiconprovider that do this job. Be carefull of performance.
>> > You can set it to the model using setFileIconProvider. On Windows and
>> > Mac
>> > we query the OS to get the icon. On Linux not so we display the default
>> > blank icon.
>> >
>> >> 2) How to always show directories first (say in QTreeView)?
>> >
>> > It is always like that if you use the default sorting. At least in
>> > 4.5.0,
>> > i am sure.
>>
>> I use 4.4.3 in Debian Lenny, and it mixes directories and files. For
>> example:
>>
>> model = new QFileSystemModel;
>> model->setResolveSymlinks(true);
>>
>> root = model->setRootPath(QDir::rootPath());
>>
>> view->setModel(model);
>> view->setRootIndex(model->index(root));
>>
>> "view" is a QTreeView with "sortingEnabled" set to "true".
>
> So it is perhaps a bug in 4.4.3 i remember a task for that but don't know it
> pushed the patch in 4.4.3. Here in 4.5 how i construct the view for the
> QFileDialog :
>
> void QFileDialogTreeView::init(QFileDialogPrivate *d_pointer)
> {
> d_ptr = d_pointer;
> setSelectionBehavior(QAbstractItemView::SelectRows);
> setRootIsDecorated(false);
> setItemsExpandable(false);
> setSortingEnabled(true);
> header()->setSortIndicator(0, Qt::AscendingOrder);
> header()->setStretchLastSection(false);
> setTextElideMode(Qt::ElideMiddle);
> setEditTriggers(QAbstractItemView::EditKeyPressed);
> setContextMenuPolicy(Qt::CustomContextMenu);
> }
>
> Nothing special. And if i had an seticonsize in this part then it works.
Yeah, the bug was found at least in 4.4.0:
http://www.qtsoftware.com/developer/task-tracker/index_html?id=214108&method=entry.
Please try to compile and run small attached project against 4.5. Does
it work correctly?
>>
>> Result: http://img261.imageshack.us/img261/7807/view1r.png
>>
>> >> 3) How to use 48x48 icons in QListView with QFileSystemModel? I set
>> >> "iconSize" to 48x48 and "gridSize" to 60x60, but the icons are still
>> >> 16x16 (the grid became bigger, but MIME icons are still 16x16).
>> >
>> > Works here if i set the iconSize on the view directly on the QFileDialog
>> > (internally :)) it works perfectly so something wrong happen in your
>> > QListView that makes the problem happen
>>
>> QListView settings: http://img230.imageshack.us/img230/5845/view2.png
>> Result: http://img230.imageshack.us/img230/2724/view3.png
>>
>> Maybe I missed some setting?
>
> --
>
> Alexis Ménard
> Software Engineer, Widgets Team 1
> Qt Software, Nokia Norge AS, Sandakerveien 116, 0484 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fl.tar.gz
Type: application/x-gzip
Size: 669 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090404/f60e7773/attachment.gz
More information about the Qt-interest-old
mailing list