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

QDateTimeEdit and QTimeEdit wrong time specification when setting max time

XMLWordPrintable

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

      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.

        For Gerrit Dashboard: QTBUG-71311
        # Subject Branch Project Status CR V

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes