Alternative to QDateTime::isDateOnly ?

Christian Mollekopf chrigi_1 at
Tue Apr 28 21:11:36 BST 2015

Hey Aleix,

> What about considering the port to be like:
> QDateTime().time().isNull()?
> Even QDateTime::isValid documentation mentions that the date and the
> time need to be valid, therefore the time can be invalid.
> With that assumption, I'd say we could even implement
> QDateTime::isDateOnly() or similar.

I appreciate the pragmatism of that approach, but I just consider an
that returns an invalid QDateTime fundamentally broken (tm).
I mean, that would be like the first thing I'd check in a unittest, and
behaviour would IMO be completely unexpected.

I may be a bit extreme that way, but QDateTime::isValid() would be a
for the isDateOnly() functionality IMO.

> I would most certainly not go into template stuff (i.e. 3, 4 and 5) 2
> looks ok but if we get to add the API in Qt, we'll get to port things
> much more easily.

I agree that the Qt solution would be the easiest, but why would you not
use the template solutions?
They actually seem to be the cleanest to me.

Thanks for your input!


More information about the kde-core-devel mailing list