In my scenario widget is visible ,as i havent made it unvisible so i suppose it is visible by default.. i think my problem is regarding the second point i.e
actually i am repainting continuously because i want to draw a progress bar which moves continuously but if the button is clicked then i want that progress bar to stop there and instead draw a progress status which means repaint again...When a repaint is already scheduled, there is no point in scheduling another one.
so how to solve this ..??
There is no such thing as doing something continuously in computers. Everything is digitized and quantified.
When you change the value of the progress bar, call update(). When you click the button - call update(). Never call update in other circumstances. Remember to allow events to be processed in the meantime.but if the button is clicked then i want that progress bar to stop there and instead draw a progress status which means repaint again...
so how to solve this ..??
hmm...what i meant was that that it is being updated in 1 sec through timer...so that is what is continous..There is no such thing as doing something continuously in computers. Everything is digitized and quantified.
to be precise i am calling it only in these two situation ,no More no Less,so why does it not update or calls paintEvent everytime...When you change the value of the progress bar, call update(). When you click the button - call update().
So what does your code for changing the progress value and clicking the button look like? What is the timer connected to? If you have a custom paintEvent, please post it here as well.
thanks...i wasnt stopping the timer ,thats why sometime two updates() were running at the same time.....
i have one more question regarding the update and paintEvent(), my program is running fine but when i debug the code i see some unwanted behaviuor actually i want to draw one thing lets call it 'A' initially and wanted to draw other things depending on users input lets say it 'B,C,D...'..
now 'A' should always be drawn no matter what 'B' ,'C' or 'D' is drawn but when i update it redraws A again and again..which is not required ,i only want the paintEvent to draw 'B','C' or 'D' for me not 'A' again and again ..but since it updates the view so to see 'A' again i have to redraw it every time...i want to some how define it in such a way that if 'A' is drawn one time it remains on screen no matter how many other updates are done..
i hope you understand..!!
Can you post your paintEvent()?
PaintEvent Function:
-----------------------
Qt Code:
painter.drawEllipse(OUTER_ELLIPSE_X,... if(trials_completed >= 1) { if(trials_completed == 1) { qDebug() << "Draws The First Green Sequence "; ..// painting done here } else if(trials_completed == 2) { qDebug() << "Draws The First Two Green Sequence "; ..// painting done here } else if(trials_completed == 3) { qDebug() << "Draws The First Three Green Sequence "; ..// painting done here } else if(trials_completed == 4) { qDebug() << "Draws The Four Green Sequence "; .. } } if (rec_button == FALSE && accept_press == TRUE ) { ..painting done depending on the button press by the user.. }To copy to clipboard, switch view to plain text mode
if any other info is required do tell me...![]()
Why is it not required? You said it should be drawn each time.
This is not possible. You have to draw it every time.,i only want the paintEvent to draw 'B','C' or 'D' for me not 'A' again and again ..but since it updates the view so to see 'A' again i have to redraw it every time...i want to some how define it in such a way that if 'A' is drawn one time it remains on screen no matter how many other updates are done..
Bookmarks