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

QDateTimeEdit and QTimeEdit wrong time specification when setting max time

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.12.1
    • 5.11.1
    • Core: Date/Time
    • None
    • All
    • d43ac840e5d5a0a2df9e8adce276c956c98be6aa (qt/qtbase/5.12)

    Description

      Whenever the minimum time is set the time specification is assumed to coincide with the one set in the control (i.e. ignored), which is what is described for QDateTimeEdit::setDateTime. On the contrary when setting the max time, local time is assumed in all cases.

      The relevant code is as follows for setMinimumTime:

      void QDateTimeEdit::setMinimumTime(const QTime &min)
      {
          Q_D(QDateTimeEdit);
          if (min.isValid()) {
              const QDateTime m(d->minimum.toDate(), min, d->spec);
              setMinimumDateTime(m);
          }
      }
      

      while for setMaximumTime:

      void QDateTimeEdit::setMaximumTime(const QTime &max)
      {
          Q_D(QDateTimeEdit);
          if (max.isValid()) {
              const QDateTime m(d->maximum.toDate(), max);
              setMaximumDateTime(m);
          }
      }
      

      Incidentally this makes QDateTimeEdit and QTimeEdit pretty finicky and quite frankly next to unusable in most real-world scenarios.

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes