Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.8
-
None
-
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
For Gerrit Dashboard: QTBUG-128144 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
587129,2 | RFC: Long live QT_DECLARE_COMPAT_RETURN_TYPE_SINCE()! | dev | qt/qtbase | Status: NEW | 0 | 0 |
584234,15 | QObject: port to Qt::TimerId | dev | qt/qtbase | Status: ABANDONED | +1 | 0 |
584235,6 | QBasicTimer: port to Qt::TimerId | dev | qt/qtbase | Status: MERGED | +2 | 0 |
586575,3 | Register Qt::TimerId with the meta-object system | dev | qt/qtbase | Status: MERGED | +2 | 0 |
587143,2 | Register Qt::TimerId with the meta-object system | 6.8 | qt/qtbase | Status: MERGED | +2 | 0 |
587168,3 | QTimerEvent: port to Qt::TimerId | dev | qt/qtbase | Status: MERGED | +2 | 0 |
587417,3 | QObject: use Qt::TimerId in the code snippets and API docs | dev | qt/qtbase | Status: MERGED | +2 | 0 |
587450,2 | QTimerEvent: port to Qt::TimerId | 6.8 | qt/qtbase | Status: MERGED | +2 | 0 |
587456,2 | QBasicTimer: port to Qt::TimerId | 6.8 | qt/qtbase | Status: MERGED | +2 | 0 |
587557,2 | QObject: use Qt::TimerId in the code snippets and API docs | 6.8 | qt/qtbase | Status: MERGED | +2 | 0 |