KDateTime: revised version
nicolasg at snafu.de
Thu Nov 24 00:52:33 GMT 2005
On Tuesday 22 November 2005 23:45, David Jarvie wrote:
> 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.
Yes, I think that it is a better solution.
Have a nice day!
More information about the kde-core-devel