Re: How to connect QTimer with QPaintEvent?
some more points:
connect(timer, SIGNAL(timeout()), this,SLOT(paintEvent1(QPaintEvent*)));
you cant connect signals with X number of arguments to to slots with more than X arguments.
You shouldn't be making multiple paint event methods. THE paintEvent will always get called on update, YOUR paint event will only get called on timeout. Why should there be two? (There definitely should not be)
You don't need to 'destroy' anything in paint event - paint event always starts with a clean canvas.
But Qt started to ignore qtimer, 2nd ellipse is drowing immediately.
It is only doing what you tell it to do. You call update() in paintevent. Your misguided addition of your own update() method draws the second ellipse at the same time as the first. Please read your own code more carefully.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
Bookmarks