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

QCalendarWidget does not correctly handle input by keyboard

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.3.2, 5.4.0 Beta, 5.7.0
    • None
    • Win7 / Ubuntu 12.04,14.03,16.04 / Windows 10

    Description

      When entering a date by keyboard in a QCalendarWidget the month is not correctly
      handled when the month starts with 0. (01-01-2014). You can reproduce this with de calendarwidget example.

      The problem is in the QCalendarMonthValidator class in function applyToDate:

      QDate QCalendarMonthValidator::applyToDate(const QDate &date)
      {
      int month = m_month;
      if (month < 1)
      month = 1;
      else if (month > 12)
      month = 12;

      QDate newDate(date.year(), m_month,1);
      ....
      }

      QDate newDate(date.year(), m_month,1) should be:

      QDate newDate(date.year(), month,1);

      because if m_month = 0 an invalid date would be produced.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            chris_m3 Chris
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes