[Qt-interest] QDateEdit minimum date is year 100
John Layt
johnlayt at googlemail.com
Wed Mar 10 19:53:24 CET 2010
On Wednesday 10 Mar 2010 18:14:23 Maximilien Renard wrote:
> Hi John,
>
> Here is the link, you might be right about the cause of the problem but as
> you can see with link provided below, it was stated that the bug was
> related with QDateTime. I cannot figure out why it would be, since it
> works as expected but I didn't take a look so I couldn't know!
>
> http://bugreports.qt.nokia.com/browse/QTBUG-277
>
> <http://bugreports.qt.nokia.com/browse/QTBUG-277>What I'd really like would
> be a QDate(Time)Edit widget where the date would be displayed correctly
> whatever it is (not limited to 100-01-01) and that it would not display
> anything (or just the chosen separating characters) if the provided date is
> 0000-00-00.
> That way, it would be clear to the program user that when the field is left
> blank, the date is not set :)
>
> Thank you for answer and your time !
>
>
> Kind regards,
>
>
> Maximilien
OK, I was half right, the minimum date of 100AD probably is to do with the
setYMD() behaviour, but that's not the behaviour preventing this fix (and
actually I don't think it is an historic behaviour, so I don't know why that
limit is in place). What they don't want to change is the default behaviour
of converting a blank entry into the minimum date as that might break existing
apps that rely on this behaviour.
The easy and obvious solution is to keep the default behaviour, but have a
flag or enum the coder can set to AllowNullDates, which would then allow a
blank entry in the edit field and return a null date. It would be up to the
coder to convert that QDate::isNull() status into whatever database format is
required. If done as an enum, other behaviours could be possible.
Seems a pretty fundamental feature for a date entry widget to have, especially
for databases and the like where the current behaviour could cause bad data to
be stored.
John.
More information about the Qt-interest-old
mailing list