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

What happens to QTimer and QChronoTimer in Qt7

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 7.0 (Next Major Release)
    • Core: Event loop
    • None

    Description

      (Continuing the discussion from QTBUG-128426)

      QChronoTimer can't replace QTimer, and no one wants to maintain two almost-identical classes at the same time, so they shouldn't coexist in Qt 7.

      General plan:

      • In Qt 7 QTimer's interval shall be stored as chrono::nanoseconds (not qint64, this is the main timer class in Qt and it should be using chrono durations by default in 2032)
      • setters/getters are added for qint64 to keep existing code working; taking qint64 instead of int isn't an issue, however returning qint64 when user code expect int is narrowing, but that's something that has to be changed in user code to prevent overflow anyway (like int -> qsizetype)
      • the qint64 setters/getters shall be deprecated on arrival; i.e. port your code at the Qt 7 gate, or live with the deprecation warnings, chrono::duration is the state of the art type for time intervals
      • QChronoTimer becomes a typedef `using QChronoTimer = QTimer`, the API is very similar, so it can be almost drop-in
      • We shall be careful not to make the API of either class diverge too much from the other

      Attachments

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

        Activity

          People

            ahmad.samir Ahmad Samir
            ahmad.samir Ahmad Samir
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes