Hi,

I used void setSelectionBehavior ( QAbstractItemView::SelectionBehavior 
behavior ) and set behavior to select rows and it works.

Thanks,
Jaya 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aurélien Gâteau
Sent: Monday, December 18, 2006 4:30 AM
To: Jaya Meghani
Cc: [email protected]
Subject: Re: [Wengophone-devel] Weird Problem

Jaya Meghani wrote:
> Hi,
> 
> If I add more columns in Tree Widget of Contact List then on clicking - 
> background is applied to only one column.
> Is this because in paint function of QtContact::paint() the option.rect gives 
> the rect for a particular trewidgetitem on which its clicked.
> For example if I click on row=0 and col=1, I get only that cell highlighted. 
> Whereas I want whole row (row=1) to be selected. How can I achive this?

In Qt 4.2, the QTreeView supports a new property: 
allColumnsShowFocus[1], which probably do what you want. Unfortunately it is 
not present in Qt 4.1. You will have to resort to either:

- Repaint all columns in QtContact::paint(), ignoring index.row(). Easy, but 
not sure it will work.

- Inherit from QTreeWidget to force a repaint of the full row when selection 
changes, using QTreeView::setDirtyRegion(QRegion). You need to inherit from 
QTreeWidget because setDirtyRegion is protected.

[1]: http://doc.trolltech.com/4.2/qtreeview.html#allColumnsShowFocus-prop

Aurélien

_______________________________________________
Wengophone-devel mailing list
[email protected]
http://dev.openwengo.com/mailman/listinfo/wengophone-devel
_______________________________________________
Wengophone-devel mailing list
[email protected]
http://dev.openwengo.com/mailman/listinfo/wengophone-devel

Reply via email to