[Qt-interest] Hiding QTreeWidget heirarchy

Santhosh Y santhosh at softjin.com
Tue Jun 2 14:45:09 CEST 2009


Sean Harmer wrote:
> 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
>   
Thanks a lot. I was exactly looking for this.

I have over ridden drawBranches() funciton  over MyTreeWidget. Now it is 
not drawing the branch structure.

But I dont know the side effects of it.
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>   


-- 
----------------------------------------------------
Y Santhosh Kumar
Senior Software Engineer
SoftJin Technologies Private Limited
Unit No. 102, Mobius Tower,
I Floor, SJR I - Park,
EPIP, White Field,
Bangalore - 560066, India
U : www.softjin.com
E : santhosh at softjin.com
T : +91-80-41779999
M : +91-9740535265
----------------------------------------------------



Business Disclaimer
____________________________________________________________
This e-mail message and any files transmitted with it are intended solely
for  the use  of the  individual or entity  to which they  are  addressed. It
may  contain confidential,  proprietary or legally  privileged  information.
If  you  are  not  the  intended recipient please be advised that you have
received  this  message in error and any use is strictly prohibited. Please
immediately  delete it  and all copies of it from your system, destroy any
hard  copies  of  it and  notify  the  sender  by return mail. You must not,
directly or indirectly, use,  disclose,  distribute, print, or copy any part of
this message if you are not the intended recipient.
___________________________________________________________





More information about the Qt-interest-old mailing list