0

I've created QDateTimeEdit widget in QtDesigner with calendarPopup option checked.

I need months to be shown in English language but they are shown in my system locale language.

I've tried this:

self.ui.dateTimeEdit.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))

and this:

self.ui.dateTimeEdit.setLocale(QtCore.QLocale(QtCore.QLocale.English))

...but months are still showing in my local language. What am I doing wrong?

Aleksandar
  • 3,541
  • 4
  • 34
  • 57

1 Answers1

1

You need to set locale for the calendar widget:

self.ui.dateTimeEdit.calendarWidget().setLocale(...)

It would be logical to assume that QDateTimeEdit sets locale for its internal calendar widget. It seems to be a Qt bug.

Pavel Strakhov
  • 39,123
  • 5
  • 88
  • 127
  • It's possible to set your own calendar widget for QDateTimeEdit, which Qt does not take ownership of. That possibly explains why the locale for the calendar widget needs to be set explicitly. – ekhumoro Jan 15 '14 at 18:37