Creating gaps between QTreeWidgetItems
Hi there,
I'm working on a quite individual version of QTreeWidget. Certain items have certain looks, sizes and gaps between them.
I reimplemented QSyteldItemDelegate for the looks, and so far I also use it to create the gaps by adjusting the size of the item via my delegates sizeHint() to fit what my paint() implementation paints plus the gap.
That kind of works, but doesn't look good as the branches stop where the gaps begin and so on.
Is there any way to give a QTreeWidgetItem a top- and bottom-spacing, so there actually is a gap between the items?
Re: Creating gaps between QTreeWidgetItems
is there any subsection for drawing text ??
may be a proper combination of text rect, and item rect will help you achieve what you want.
Re: Creating gaps between QTreeWidgetItems
Have you tried calling setItemDelegate() on your QTreeWidget to your own subclassed ItemDelegate which has a method like
Code:
{
mysize.setHeight( /* your own height */ );
return mysize;
}
Re: Creating gaps between QTreeWidgetItems
To quote myself:
Quote:
I reimplemented QSyteldItemDelegate for the looks, and so far I also use it to create the gaps by adjusting the size of the item via my delegates sizeHint() to fit what my paint() implementation paints plus the gap.
That kind of works, but doesn't look good as the branches stop where the gaps begin and so on.
;)
Re: Creating gaps between QTreeWidgetItems
Alright, I ought to read more than the last sentence :o
But if you can control the height and have your own paint(), then surely you can make all the pixels look the way you want them to? Could you perhaps provide a drawing of what you get vs what you'd like instead?