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

Qt-interest Archive, April 2007
[4.2.2] QTreeView - no horizontal scrollbar shown


Message 1 in thread

Hi there,

I've got some problem with a QTreeView here ... I can't get the
horizontal scrollbar to show up (vertical is shown as needed, works
fine).

 ...
  view = new QTreeView;
  view->header()->hide();
  view->setEditTriggers(QAbstractItemView::EditKeyPressed);    
  view->setSortingEnabled(true);
  view->setModel(someQSortFilterProxyModel);
 ...


I've tried numerous things (order of commands, "setHorizontalScrollBar",
"setHorizontalScrollBarPolicy", "setStretchLastSection", ...) but have
no idea what else could be the reason here. Any known issues with the
QSortFilterProxyModels here? 

I'd appreciate any ideas.


Tgif,
r.

--------------------------------------------------------------------
  Rene Kaiser
  Institute of Information Systems & Information Management
  JOANNEUM RESEARCH Forschungsgesellschaft mbH
  Steyrergasse 17, A-8010 Graz, AUSTRIA

  phone:  +43-316-876-1173                   fax: +43-316-876-1191
  web:    http://www.joanneum.at/iis
  e-mail: mailto:rene.kaiser@xxxxxxxxxxx
-------------------------------------------------------------------- 

--
 [ signature omitted ] 

Message 2 in thread

On Friday 20 April 2007 14:06:04 Kaiser, Rene wrote:
> Hi there,
>
> I've got some problem with a QTreeView here ... I can't get the
> horizontal scrollbar to show up (vertical is shown as needed, works
> fine).
>
>  ...
>   view = new QTreeView;
>   view->header()->hide();
>   view->setEditTriggers(QAbstractItemView::EditKeyPressed);
>   view->setSortingEnabled(true);
>   view->setModel(someQSortFilterProxyModel);
>  ...
>
>
> I've tried numerous things (order of commands, "setHorizontalScrollBar",
> "setHorizontalScrollBarPolicy", "setStretchLastSection", ...) but have
> no idea what else could be the reason here. Any known issues with the
> QSortFilterProxyModels here?
>
> I'd appreciate any ideas.
>
>
> Tgif,
> r.

Ive been having problems with this as well, and my current solution is to 
create a slot:

void
myCustomTreeView::updateScrollArea( const QModelIndex &index ) // SLOT
{
    resizeColumnToContents( index.column() );
}

and then connect the collapsed/expanded signals to it...

But this doesn't work good, for me: 
The horizontal scrollbar IS shown, but not perfect. I want it shown whenever 
text from a node gets shortened with "..." but somehow the scrollarea does 
not match ... It seems to be matched to the icons instead of the text ?? Im 
not sure, but I'd appreciate some insight in this as well!

Regards,
Stefan Vunckx

--
 [ signature omitted ]