PDA

View Full Version : Issue with custom delegate in tableview



alizadeh91
10th April 2013, 08:41
Hi,
I have issue with Highlighting cell of tableView with my own delegate (checkbox), i used this code :



if(option.state & QStyle::State_Selected)
{
painter->fillRect(option.rect,option.palette.highlight());
}

this works but the problem is that when the focus of table is changed the color of selected row have to be gray but in my table the color of my delegate cells will stay dark blue(state_selected).
How to fix that?
thanks

ChrisW67
10th April 2013, 08:52
At a guess, paint it differently when the state is not QStyle::State_Active or Style::State_HasFocus or QStyle::State_Enabled

alizadeh91
10th April 2013, 08:59
thanks, I think so but with which palette i should paint it? (which palette is inactive cells in table view. I've seek it in QPalette but nothing found!)

alizadeh91
13th April 2013, 09:17
Anyone knows how to deal with it?! Whats the palette of unfocused cells?

wysota
13th April 2013, 09:39
QPalette::ColorGroup