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

QTimer support chrono literals

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • Not Evaluated
    • 5.8.0
    • None
    • Core: Event loop
    • None
    • d16ba63f5cdf1e6c9dc96200bb80b2155437c4ee

    Description

      Hi,

      This works.
      QTimer::singleShot(std::chrono::milliseconds(1000), []

      { qDebug() << "1 second passed"; });

      This is not supported:
      QTimer::singleShot(1s, []{ qDebug() << "1 second passed"; }

      );

      This uses the chrono literals (new since C++14), more on that here: http://en.cppreference.com/w/cpp/chrono/duration

      Could support for these literals be added to the QTimer methods where one provides time (start, singleshot, setInterval). Big plus for also providing a getters (remainingTime, intervalAsDuration and in QElapsedTimer::elaped) as clock ticks. That would allow a chrono duration_cast to any of the chrono supported times.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            markg85 Mark
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes