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

QDateTimeEdit::setDateTime should take time specification into account

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.11.1
    • Fix Version/s: 6.0.0
    • Labels:
      None
    • Platform/s:
      All
    • Commits:
      2a653fde48f7312ccd2f792d72d305061b410ae3 (qt/qtbase/dev)

      Description

      When setting a QDateTime object to a QDateTimeEdit control the latter completely ignores the time spec of the argument (as documented). Here's the suspect code:
      https://code.woboq.org/qt5/qtbase/src/widgets/widgets/qdatetimeedit.cpp.html#246

      What any reasonable person would expect, however, is to have the date-time converted to the proper specification that was set to the edit, as this relates to the display only, not to the actual point in time. This all means that the following code:

      QDateTimeEdit edit;
      edit.setDateTime(QDateTime::currentDateTimeUtc());
      edit.setDateTime(QDateTime::currentDateTime());

       

      produces different result for the two calls to QDateTimeEdit::setDateTime, which it should not as both arguments point to the same point in time.

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              Eddy Edward Welbourne
              Reporter:
              kshegunov Konstantin Shegunov
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes