PDA

View Full Version : paint method



zgulser
6th April 2009, 13:23
hi

I have a statement like in the following;

if( option->state & QStyle::State_MouseOver)
{

....
}

in the paint method.

The problem is that the bitwise operation always return 0 so I couldn't go through the if. Do I need to do extra things before if?

Thanks in advance.

wysota
6th April 2009, 14:52
Obviously the state never has that flag set. Are we talking about QGraphicsItem subclass or what? Did you tell the item you want to receive hover events for it?

zgulser
7th April 2009, 06:41
Hi,

We are talking about QGraphicsItem subclass and no I didn't tell the item to receive hover events. I'am not very fimiliar with QGraphicsItem so I will be very thankful if you give me some tips about how to do it.

Thanks in advance.

talk2amulya
7th April 2009, 07:06
use setAcceptHoverEvents(bool) of QGraphicsItem..this will enable your graphics item to get the hover events..only then would the option->state variable have mouseover state.

zgulser
9th April 2009, 06:50
Hi,

Thanks both of you for your help again.

zgulser
20th July 2009, 07:42
Hi,

I have faced with another paint method problem now. How could I make the item enter its QGraphicsItem:: paint method from the outside?

update(boundingRect()) did work but I want immediate piant access.

thanks in advance.

wysota
20th July 2009, 08:57
Why do you want that?