Unsolved How to convert Calendar.selectedDate to QDate
-
Hello,
I try to convert a date selected by QtQuick.Controls 1.4 calendar to a QDate. My function is:void Unlock::setLimitDate(const QString &limitDate) { QDate date = QDate::fromString(limitDate, "ddd MMM d hh:mm:ss YYYY Z"); ... }
When I enter in the function, limitDate is: "ven. déc. 27 12:00:00 2019 GMT+0100" and created date is invalid.
I though it could come from the localisation despite the doc says it should work or maybe from the timezone but even if I write:QDate date = QDate::fromString("mon. dec. 23 12:00:00 2019", "ddd MMM d hh:mm:ss YYYY");
I cannot get it working. What's wrong?
-
Why do you pass it as QString instead a QDate/QDateTime which for sure is provided to you from QtLabs Calendar
-
I do not use qtlabs calendar because I wasn't able to instantiate it in Qt Design, I always get "Invalid property name 'x' (M16) (line 117)".
So I use QtQuick.Controls 1.4 calendar isntead which only provides the date in that format AFAIK. -
@AlainBo said in How to convert Calendar.selectedDate to QDate:
which only provides the date in that format AFAIK.
No: https://doc.qt.io/qt-5/qml-qtquick-controls-calendar.html#selectedDate-prop
-
I found my way.
I don't know where is the doc about calendar.selectedDate but I found what I need in the QtQuickControls 1 - Calendar example.