| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 4 | |
Hi I've figured that QTreeView is not sufficient for my purposes, so I need a view ;) If anybody has a custom implementation of QAbstractItemView which functions on the lines of QTreeView, then I could try to extend it, it will save precious time. Thanks -- [ signature omitted ]
It might help if you described what functionality QTreeView doesn't do for you.... > -----Original Message----- > From: Mr.YogeshM [mailto:mr.yogeshm@xxxxxxxxx] > Sent: Tuesday, June 19, 2007 8:11 AM > To: qt-interest@xxxxxxxxxxxxx > Subject: In need of building block for replacement of QTreeView > > Hi > > I've figured that QTreeView is not sufficient for my purposes, so I > need a view ;) > > If anybody has a custom implementation of QAbstractItemView which > functions on the lines of QTreeView, then I could try to extend it, it > will save precious time. > > Thanks > > -- > Yogesh M > Chandigarh, India > http://mr-yogi.blogspot.com/ > > -- > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with > "unsubscribe" in the subject or the body. > List archive and information: http://lists.trolltech.com/qt-interest/ -- [ signature omitted ]
On 6/19/07, Scott Aron Bloom <scott@xxxxxxxxxxxx> wrote: > It might help if you described what functionality QTreeView doesn't do > for you.... > > > -----Original Message----- > > From: Mr.YogeshM [mailto:mr.yogeshm@xxxxxxxxx] > > Sent: Tuesday, June 19, 2007 8:11 AM > > To: qt-interest@xxxxxxxxxxxxx > > Subject: In need of building block for replacement of QTreeView > > > > Hi > > > > I've figured that QTreeView is not sufficient for my purposes, so I > > need a view ;) > > > > If anybody has a custom implementation of QAbstractItemView which > > functions on the lines of QTreeView, then I could try to extend it, it > > will save precious time. > Above all, I need that the decoration of tree be always drawn at the first visible row. Thanks -- [ signature omitted ]
"Mr.YogeshM" <mr.yogeshm@xxxxxxxxx> wrote on 06/19/2007 09:58:48 AM: # Above all, I need that the decoration of tree be always drawn at the # first visible row. Could you not simply inherit from and override the existing QTreeView class? -- [ signature omitted ]
On 6/19/07, Gordon.Schumacher@xxxxxxxxxxx <Gordon.Schumacher@xxxxxxxxxxx> wrote: > "Mr.YogeshM" <mr.yogeshm@xxxxxxxxx> wrote on 06/19/2007 09:58:48 AM: > > # Above all, I need that the decoration of tree be always drawn at the > # first visible row. > > Could you not simply inherit from and override the existing QTreeView > class? > > I have already tried it, but it seems that QTreeView, in its current form, cannot be extended to achieve this. Regards -- [ signature omitted ]
>> # Above all, I need that the decoration of tree be always drawn at the
>> # first visible row.
>>
>> Could you not simply inherit from and override the existing QTreeView
>> class?
>>
>>
>
> I have already tried it, but it seems that QTreeView, in its current
> form, cannot be extended to achieve this.
I did something similar in Qt 4.1; it boiled down to reimplement
drawPrimitive() to call a custom drawIndicatorBranch() in QWindowsStyle
(or whatever style(s) you're using). In drawIndicatorBranch() you can
then use the copy/pasted code from the original drawPrimitve() to render
the tree decorators, and tweak it according to your needs. The extended
style then gets assigned to your treeview (or perhaps the whole
application right from the start).
--8><--
void QWindowsStyleExt::drawPrimitive(PrimitiveElement elem, const
QStyleOption* option,
QPainter* painter, const QWidget* widget) const
{
//Draw treeview branches
if(elem == PE_IndicatorBranch)
{
drawIndicatorBranch(elem, option, painter, widget);
}
//All other primitves use the original implementation
else
{
QWindowsStyle::drawPrimitive(elem, option, painter, widget);
}
}
--><8--
HTH, Martin
--
[ signature omitted ]
> > Above all, I need that the decoration of tree be always drawn at the > first visible row. > Actually... this can be done with QTreeView... Look into the Style system, as well as the Decoration Role for the model Scott -- [ signature omitted ]
On 6/19/07, Scott Aron Bloom <scott@xxxxxxxxxxxx> wrote: > > > > Above all, I need that the decoration of tree be always drawn at the > > first visible row. > > > > Actually... this can be done with QTreeView... Look into the Style > system, as well as the Decoration Role for the model > > Scott > I stressed on "decoration of tree", please see the attached image for description. Regards -- [ signature omitted ]
Attachment:
decoration.png
Description: PNG image
> > Actually... this can be done with QTreeView... Look into the Style > > system, as well as the Decoration Role for the model > > > > Scott > > > I stressed on "decoration of tree", please see the attached image for > description. > Regards And I stressed it "can be done" with QTreeView... Nothing you showed could not be done... It's a combination of a QStyle + Model Roles... The + symbol, the "tree line", and the text of the treeview are ALL modifiable. Scott -- [ signature omitted ]