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

Qt-jambi-interest Archive, August 2006
QTreeView


Message 1 in thread

Hi,

I think I have found a clean way to solve my problem (about the 
QAbstractItemModel and different column counts).  My idea is instead of 
having everything in one QTreeView, use a QLabel as the header and a 
QTreeView following it in a QVBoxLayout.  This way the different columns are 
handled nicely.  

My problem is:
1) Is there any way to force the QTreeView to be expanding and not use a 
scrollbar?
2) Is it possible to put all this (the series of QLabel and QTreeView) into a 
QScrollArea?  

I have tried putting things into a QScrollArea but with little success.  
Everything bunched up and no scrollbar.  

Thank you for you previous advice: Re: QAbstractItemModel.  

Thank you

David


Message 2 in thread

David Naylor wrote:
> Hi,
> 
> I think I have found a clean way to solve my problem (about the 
> QAbstractItemModel and different column counts).  My idea is instead of 
> having everything in one QTreeView, use a QLabel as the header and a 
> QTreeView following it in a QVBoxLayout.  This way the different columns are 
> handled nicely.  
> 
> My problem is:
> 1) Is there any way to force the QTreeView to be expanding and not use a 
> scrollbar?

Hi David,

All widgets that inherit QAbstractScrollArea you can set the scrollbar 
policy.

http://doc.trolltech.com/4.1/qabstractscrollarea.html#horizontalScrollBarPolicy-prop
http://doc.trolltech.com/4.1/qabstractscrollarea.html#verticalScrollBarPolicy-prop

Here you can disable the scrollbar.

> 2) Is it possible to put all this (the series of QLabel and QTreeView) into a 
> QScrollArea?  

Sure, but I doubt this is what you want. The labels would scroll 
together with the treeview.

> I have tried putting things into a QScrollArea but with little success.  
> Everything bunched up and no scrollbar.  

You create a container widget that contains your widgets and set this on 
the scrollbar using QScrollBar.setWidget()

http://doc.trolltech.com/4.1/qscrollarea.html#setWidget

If the container widget is bigger than the scrollarea you will 
automatically get the scrollbars.

-

I do however have some problem with understanding what you're trying to 
acheive. Do you have something I can relate it to, or a mock-up 
screenshot to illustrate? Then I could probably give more precise help.

-

regards,
Gunnar