Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QCalendarWidget select wrong Day



  • I use a QCalendarWidget in my Program to select Days and it works fine though, but i have one Problem i dont understand. I use Manjaro KDE Linux with Qt 5.9.5.

    When i start my Application the wrong Day is selected in my Calendar. In the Calendar always yesterday is selected like here
    0_1528185318138_Unbenannt.png

    Today is the 5th June and he selects yesterday at Startup. First i try to set SelectedDate at Startup in my Code, but then i noticed that the Widget returns the correct Date. So the Widget has always the correct Date, but the Widget only selects the wrong Date.

    How can this happen?



  • @Fuel-0
    I use QCalendarWidget in Qt 5.7 and it works fine on initial day selection.

    I can only wonder/guess: are you sitting in a non-UTC timezone, and testing this when your timezone is "yesterday" compared to UTC (e.g. you're in EDT and it's 10PM type of thing)?

    I am not clear: have you tried setting the widget's initial date explicitly from calling code, rather than relying on it to set to "today"? Does that work? If not, show code where you set it.



  • Oh... i set the Locales of the Application to English and my Country was set to United States. I set it now to Germany and it works. The Point why i did that is, that i want to localize my Application in different Languages later. So i set it to English.

    I hope the Application later detects the right Locales, when someone will use it in different Countrys. Is there maybe an option to set Locales automatically on Startup? I mean only the Country. The User has later the Option to change Language.



  • @Fuel-0 said in QCalendarWidget select wrong Day:

    Oh... i set the Locales of the Application to English and my Country was set to United States. I set it now to Germany and it works.

    That does sound like what I said about timezone, then? In which case, I expect your app to now pick the wrong date on the calendar if you try it at, say, 00:30 German time?


Log in to reply