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

Changing locale of a QDateEdit does not affect its popup calendar widget

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.6.2, 5.7.1, 5.8.0, 5.9.0 Alpha
    • Fix Version/s: 5.9.0 Beta 2
    • Labels:
      None
    • Environment:
      Kubuntu 16.10, Windows 10
    • Commits:
      e5c0371d18e285d7849cbd0569970e209bd01b49

      Description

      Changing locale settings for a widget of type QDateEdit or QDateTimeEdit is not propagated to its child widgets, specifically QCalendarWidget.

      I believe this is not the expected behavior.

      Minimum test case is attached.

      #include <QApplication>
      #include <QDialog>
      #include <QDateEdit>
      #include <QCalendarWidget>
      #include <QVBoxLayout>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QLocale::setDefault(QLocale(QLocale::Persian, QLocale::Iran));
          QDialog d;
          QVBoxLayout layout(&d);
          // Persian Locale
          QDateEdit dateEdit(&d);
          layout.addWidget(&dateEdit);
          dateEdit.setLocale(QLocale(QLocale::English, QLocale::UnitedKingdom));
          dateEdit.setCalendarPopup(true);
          // Or maybe set locale after enabling popup calendar. Same as previous case
          // de.setLocale(QLocale(QLocale::English, QLocale::UnitedKingdom));
          dateEdit.setDisplayFormat("yyyy-MM-dd");
          dateEdit.setDate(QDate::currentDate());
          //
          d.show();
          /*
           * Now `dateEdit' shows a date in English (line edit),
           * and a popup calendar in Persian
           */
          return a.exec();
      }
      

        Attachments

        1. QTBUG-dateedit.tar.gz
          0.7 kB
        2. screenshot-1.png
          screenshot-1.png
          120 kB
        3. terrible.png
          terrible.png
          152 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            peppe Giuseppe D'Angelo
            Reporter:
            soroush Soroush Rabiei
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes