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

QDateEdit shows day as number when format includes ddd or dddd

    XMLWordPrintable

Details

    • I558ee13b224707d22b26c2ec2c045f96118bd5a1

    Description

      As a result of testing QTBUG-26847, it was found that QDateEdit will also temporarily display a short or long day name as its numerical value under the same circumstances as the aforementioned bug.

      1. QDateEdit has the display format set to 'yyyy/MM/ddd' (or any format with a short or long day name)
      2. The date value is edited to '31' (cycle through the days by holding the up key)
      3. The focus is changed to month with Shift + Tab
      4. The month value is edited to '2'
      5. The date value shows '29' until cursor is moved or focus changed (or 291 if https://codereview.qt-project.org/#change,33204 is not applied)

      The reason this happens is because QDateTimeParser doesn't distinguish between day names and numbers:

      qdatetime.cpp:5082
      if (sectionType(i) & (DaySection|DayOfWeekSection)) {
         input.replace(sectionPos(i), sectionSize(i), loc.toString(day));
      }
      

      Attached is a patch (to go on top of the aforementioned change) which contains unit tests demonstrating the issue.

      Attachments

        Issue Links

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

          Activity

            People

              mitch_curtis Mitch Curtis
              mitch_curtis Mitch Curtis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes