PDA

View Full Version : QWidget paintEvent update in time



ugiwgh
29th October 2014, 08:34
I draw a qpixmap in paintEvent of QWidget. When I resize QWidget, the qpixmap will be changed.
On linux, it is changed in time. But on windows, it is changed when I release mouse.
I want to change it in time on windows. I don't know how to reslove this.
Any help will be appreciated.

anda_skoa
29th October 2014, 09:39
How do you trigger the repainting?
Do you call update()? If yes, have you tried calling repaint()?

Cheers,
_

ugiwgh
30th October 2014, 02:03
I send a signal in resizeEvent, and then paintEvent will be called. And QPainter::drawPixmap() is be executed. I've tried to add update() or repaint() in resizeEvent(), but it no use.

ugiwgh
30th October 2014, 04:34
I know why this happend. I need to add Qt::DirectConnection to QOjbect::connect().
Thanks.

I know why this happend. I need to add Qt::DirectConnection to QOjbect::connect().
Thanks.

wysota
30th October 2014, 12:31
I know why this happend. I need to add Qt::DirectConnection to QOjbect::connect().
Thanks.
Are you using threads in your application? resizeEvent() will be called in the application thread so there is no need for Qt::DirectConnection unless the object you are trying to call the slot on lives in a different thread. In which case you should simply move your slot to another class.