When does the update() method needs to be called?
Do I have to call it at all?
All I am doing with my widgets are setGeometry() and raise().
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
setGeometry()andraise()should automatically cause apaintEventon the corresponding widgets.I think most of Qt’s own widgets call
update()where appropriate. On custom widgets you callupdate()whenever something that is visible changes. For example, if you have your own Label class (that does not inherit fromQLabeland hence does not useQLabel‘s facilities to change text and/or image), you callupdate()whenever you change the content, such that the new content will be displayed on screen.Beware: You should not use
repaint()on widgets if the repainting is not really time critical.repaint()causes apaintEventto be issued to the widget at the moment it is called, whereasupdate()just queues apaintEventto be issued the next time the process reaches the main loop. This allows the paint engine to collect severalpaintEvents for the same widget and issue just one combined event. Usingrepaint()can thus really impact performance.