[Qt-interest] qtreewidget and iconview

Girish Ramakrishnan girish at forwardbias.in
Tue Apr 28 05:32:30 CEST 2009


Puneet Bisht wrote:
> hi all,
> 
> i am using a custom widget which is inherited by QTreeWidget.Basically i
> am using it for showing contents of a diectory.
> the code is working fine , but now my requirement is that i can show the
> items of a particular directory in iconview mode.as in QListView,s
> QListView::IconMode .i dont want to change the entire code coz it will
> take time .
> is there any solution so that i can show contents in iconmode .
>  i am using qt 4.5 with mac.
> 

There is no quick fix for this. The layouting algorith of a tree view
and a list view are fundamentally different. You will have to switch to
QListView. I think you are finding it difficult to switch because by
using a QTreeWidget the model code is probably right in the widget code
itself. Maybe you can split out the model and view for ease of changing
the view in the future.

Girish



More information about the Qt-interest-old mailing list