Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-128144

Complete addition of Qt::TimerId

    XMLWordPrintable

Details

    • 6e2705bbc (dev), 790a52b7e (6.8), 29b98eabf (dev), 751cbbd6b (dev), 60ed64e1d (6.8), 7595c21be (dev), 91ed5ddff (6.8), c9fe636df (6.8)

    Description

      Qt::TimerId was added in https://codereview.qt-project.org/c/qt/qtbase/+/519622 as an attempt to make a strongly typed timer ID, avoiding conflicting interpretations of invalid timers as -1 or 0.

      However, the new type is used inconsistently: QTimerEvent doesn't provide a getter of that type; QObject::startTimer still returns int, while QObject::killTimer got an overload that takes a Qt::TimerId. It is not possible to use Qt::TimeId without explicitly casting from the int-ID we get from QObject::startTimer, and then it's not possible to compare it with the ID we get from QTimerEvent.

      In addition, we already have a strongly-typed int representing a timer: QBasicTimer.

      To make Qt::TimerId work, we need to add support for it to QObject::startTimer, QBasicTimer, and QTimerEvent. This might be an opportunity to replace storage of timer ID's and usage of QObject::start/killTimer in existing code with a QBasicTimer.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            vhilshei Volker Hilsheimer
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: