PDA

View Full Version : paintEvent - execute four times



pajczur
20th May 2017, 14:31
Hello,
I have some strange problem.
I have empty project, just clicked "New QT Widget Application", and after I execute that code:


void MainWindow::paintEvent(QPaintEvent *e)
{
cout << 1 << endl;
}

I get result like:
1
1
1
1

So it looks like paintEvent function is repeated 4 times automaticaly. Why does it work like that? Can't I change it in some way to just one execution?

For any help thanks in advance.
Best Regards

wysota
21st May 2017, 22:15
It might be caused by the way your desktop works.

Corny
23rd May 2017, 00:11
It might be helpful if you post more or all of your code. I attempted to re-create your situation and after a bit of juggling I was able to reproduce part of the problem. It displayed two lines of 1's (not 4).