KDateTime: revised version
David Jarvie
lists at astrojar.org.uk
Tue Nov 22 22:45:42 GMT 2005
On Tuesday 22 Nov 2005 04:08, Nicolas Goutte wrote:
> On Monday 21 November 2005 15:51, Olivier Goffart wrote:
> > Le Lundi 21 Novembre 2005 03:14, David Jarvie a ?crit?:
> > > Attached is revised code for a new KDateTime class. There are various
> > > minor changes in response to comments.
> >
> > Why are constructors explicit ?
>
> Probably to avoid conversion mess like we have in some classes in KDE3.
>
> > it may be interesting to allow implicit conversion from QDateTime to the
> > K one.
>
> Yes, but, as far as I see, the current constructors seems to drop the
> information whatever QDateTime is in local time or in UTC. So it is better
> not to have implicit conversions.
The reason I made them explicit was to prevent people accidentally changing
from local time to UTC or vice versa.
> Of course, perhaps it would be nice to have a QDateTime to KDateTime
> contructor that use the state of QDateTime instead of trying to force the
> state. (That is something that I have missed.)
Perhaps that would be a better idea - have a non-explicit constructor
KDateTime(const QDateTime& dt)
which retains dt.timeSpec(). The existing constructor
KDateTime(const QDateTime& dt, Qt::TimeSpec ts)
would then not have a default value for the ts parameter.
--
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/linux/kalarm.html
More information about the kde-core-devel
mailing list