Qt-interest Archive, March 2007
AW: AW: Tree Item with Icon
Message 1 in thread
Hmm, QWindowsStyle should already have the behaviour that you want,
but wait, i remember it now, it is only enabled by default for list views, not tree views (as it should).
To enable this in tree views also, you need to set
myTreeView->setSelectionBehavior(QAbstractItemView::SelectItems);
Cheers,
Peter
> -----Ursprüngliche Nachricht-----
> Von: Horia Uifaleanu [mailto:uih@xxxxxxxxxxx]
> Gesendet: Dienstag, 27. März 2007 13:39
> An: Peter Prade
> Betreff: RE: AW: Tree Item with Icon
>
> Hi,
>
> Thanks for your answer.
>
> I have defined this class:
>
> class MyStyle : public QWindowsStyle
> {
> public:
> MyStyle() {}
>
> int styleHint(StyleHint hint, const QStyleOption *option,
> const QWidget *widget, QStyleHintReturn *returnData)
> const
> {
> if ( hint == SH_ItemView_ShowDecorationSelected )
> {
> return int(false);
> }
> else
> {
> QWindowsStyle::styleHint(hint, option, widget, returnData);
> }
> }
> };
>
>
> An use it like this:
>
> MyStyle *tmpStyle = new MyStyle();
> myTreeView->setStyle(tmpStyle);
>
>
> Still, the icon gets selected...:(
>
>
>
> Horia.
--
[ signature omitted ]