Important: Please read the Qt Code of Conduct -

Pause and restart timerEvent

  • I see some example codes to pause the timer in Snake game such as:

    void pause() {
        int remaining = dataTimer.remainingTime();
    void resume() {

    Since I use timerEvent, I use

    timerId = startTimer(DELAY)

    Is there anyway to convert the 1st code for timerEvent? Any hint?

  • @antran96

    I don't think so, QObject class only provides the basic of timer supports. If you need to set Interval or other features of QTimer, you should use a QTimer Object instead of use QObject Timer.

Log in to reply