[Qt-jambi-interest] How NOT to draw lines connecting parent nodes and children nodes in QTreeView?
hAmmeRoL
hammerol at gmail.com
Thu Jul 24 09:30:05 CEST 2008
Thanks Eskil, again.
The style sheet trick works smoothly.
And now I am subclassing QTreeView and all seem to work.
Thanks again!
2008/7/24 Eskil Abrahamsen Blomfeldt <eblomfel at trolltech.com>:
> hAmmeRoL wrote:
>
>> I wanted the QTreeView in my application not to draw lines connecting
>> parent nodes and children nodes. But I failed to find any methods provided
>> by QTreeView and wondered how it should be done?
>>
>> Anyone has an idea about how to get this done?
>>
>
> The indicator branch is painted by the current style. One way of making
> sure it's not shown is by overriding the style's drawPrimitive() method and
> returning without painting anything when the selected element is
> PE_IndicatorBranch:
>
> @Override
> public void drawPrimitive(PrimitiveElement element, QStyleOption option,
> QPainter painter, QWidget widget) {
> if (element != PrimitiveElement.PE_IndicatorBranch)
> super.drawPrimitive(element, option, painter, widget); }
>
> A simpler solution might be to override the painting of the branch in the
> stylesheet and have it do nothing, with something like this:
>
> QTreeView myTreeView = new QTreeView();
> myTreeView.setStyleSheet("::branch { background: transparent; }");
>
>
> How to customize the treeview in order to show three different icons and
>> two different font types together in a same node. Currently, there are only
>> one icon for each node and the text in a node is rendering using the same
>> font.
>>
>
> You will need to extend QTreeView and implement this behavior yourself.
>
> -- Eskil
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-jambi-interest/attachments/20080724/d032e846/attachment.html
More information about the Qt-jambi-interest
mailing list