I have a timer and when the time is equal to a certain time, ie. 5 seconds, 10 second, 12 seconds. I want it to do something.
What is the best way of constantly checking the timers value to see if it matches my value?
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.
Polling the time of a QTime is a bad idea. You have QTimer for that, which uses the hardware timer facilities of your platform. Set up a single-shot QTimer to 5 seconds. Connect its timeout() signal to a slot, and in that slot reprogram the QTimer for your next interval. The general concept of that is: