[Qt-interest] Hiding QTreeWidget heirarchy
Sean Harmer
sean.harmer at maps-technology.com
Tue Jun 2 14:16:36 CEST 2009
Hi,
On Tuesday 02 Jun 2009 12:59:45 Santhosh Y wrote:
> Santhosh Y wrote:
> > Hi,
> >
> > By default QTreeWidget shows a QTreeWidgetItem children with hierarchy
> > levels. Please see the attached image.
> > Can I hide this.
> >
> > Any help is appreciated.
The branch lines are drawn by the current style. Check out the screen shots in
the documentation for QTreeView (from which QTreeWidget is derived). So one
option is to use a style that simply does nothing when asked to draw this type
of primitive. That is you could derive a new style from your currently used
widget style and override the drawing of that one primitive or simply find
another widget style that already does this. The call is made on line 1739 of
qtreeview.cpp (in the Qt 4.5.1 source).
Another option is to derive a new class from QTreeWidget (and hence QtreeView)
and override the drawBranches() function where the above call is made so that
is doesn't ask for that primitive to be drawn ever no matter what widget style
the user has selected to use.
Which option you go for depends on how much you as the app developer think you
know better than your users as to what they want to see. I would be tempted to
do nothing and just let the user choose a style that draws the branch lines as
they prefer.
HTH,
Sean
More information about the Qt-interest-old
mailing list