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

QTimeEdit sets "UTC" timeSpec even the configured time value is "Qt::LocalTime" timeSpec

XMLWordPrintable

    • Windows

      Issue :
      When calling setDateTime() to set a time value to a QTimeEdit, the timeSpec is set as "UTC" regardless of the timeSpec of the received QDateTime.
      In Qt 6.2, it was reflected from the QDateTime.
      timeSpec can be updated afterwords, by calling setTimeSpec(Qt::LocalTime).

      Steps to reproduce :
      1. Run the attached example app with Qt 6.2 and Qt 6.5, respectively.
      2. The debug messages in the Application Output will be as follows.
      It shows, in Qt 6.5, QTimeEdit's timeSpec is set as "UTC" regardless of QDateTime's timeSpec.

       

      Qt version :  6.2.12
      ----- before setTimeSpec(Qt::LocalTime) -----
      QDateTime timeSpec : Qt::LocalTime
      QTimeEdit timeSpec : Qt::LocalTime
      QTimeEdit dateTime : QDateTime(2024-06-06 21:24:12.000 Tokyo Standard Time Qt::LocalTime)
      ----- after setTimeSpec(Qt::LocalTime) -----
      QDateTime timeSpec : Qt::LocalTime
      QTimeEdit timeSpec : Qt::LocalTime
      QTimeEdit dateTime : QDateTime(2024-06-06 21:24:12.000 Tokyo Standard Time Qt::LocalTime)

       

      Qt version :  6.5.6
      ----- before setTimeSpec(Qt::LocalTime) -----
      QDateTime timeSpec : Qt::LocalTime
      QTimeEdit timeSpec : Qt::UTC
      QTimeEdit dateTime : QDateTime(2024-06-06 12:24:12.000 UTC Qt::UTC)
      ----- after setTimeSpec(Qt::LocalTime) -----
      QDateTime timeSpec : Qt::LocalTime
      QTimeEdit timeSpec : Qt::LocalTime
      QTimeEdit dateTime : QDateTime(2024-06-06 21:24:12.000 Tokyo Standard Time Qt::LocalTime)

       

      Side note :
      The result from Qt 6.7.2 is as follows.

      Qt version : 6.7.2
      ----- before setTimeSpec(Qt::LocalTime) -----
      QDateTime timeSpec : Qt::LocalTime
      QTimeEdit timeSpec : Qt::UTC
      QTimeEdit dateTime : QDateTime(2024-06-06 12:24:12.000 UTC Qt::UTC)
      ----- after setTimeSpec(Qt::LocalTime) -----
      QDateTime timeSpec : Qt::LocalTime
      QTimeEdit timeSpec : Qt::LocalTime
      QTimeEdit dateTime : QDateTime(2024-06-06 21:24:12.000 ?? (???) Qt::LocalTime)

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

            Eddy Edward Welbourne
            hitoshiito Hitoshi Ito
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes