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?
void QtContact::paint(QPainter * painter, const QStyleOptionViewItem & option,
const QModelIndex &index ) {
QMutexLocker locker(&_mutex);
QColor selectedBackground = SELECTION_BACKGROUND;
if ((option.state & QStyle::State_Selected) == QStyle::State_Selected) {
paintSelection(painter,option);
} else {
painter->setPen(option.palette.text().color());
}
Thanks
-----Original Message-----
From: Aurélien Gâteau [mailto:[EMAIL PROTECTED]
Sent: Friday, December 15, 2006 3:42 AM
To: Jaya Meghani
Cc: [email protected]
Subject: Re: [Wengophone-devel] Weird Problem
Jaya Meghani wrote:
> Hi,
>
> I basically want to add a button in Tree Widget of Contact List.
> However when I add columns in ContactList.ui, Group open and down
> arrow pixmaps start showing up for all columns.
If you add more columns then you probably need to check the column() method of
the index before calling drawGroup().
This means in QtTreeViewDelegate::paint, you should replace:
if (!index.parent().isValid()) {
drawGroup(painter, option, index);
} else {
with:
if (!index.parent().isValid() && index.column()==0) {
drawGroup(painter, option, index);
} else {
(disclaimer: I didn't try it)
> So my question is How can i add columns and add Pusbutton to it? If I
> add to QtContactManager.cpp in void QtContactManager::redrawContacts()
> function nothing shows on window after running exe.
If you look at the current implementation of QtContact::paint you will notice
that the QModelIndex parameter is currently ignored, meaning the code doesn't
use the data provided by the model. That's why your icon gets ignored.
Aurélien
_______________________________________________
Wengophone-devel mailing list
[email protected]
http://dev.openwengo.com/mailman/listinfo/wengophone-devel