VcsRevision usage question.

Andreas Pakulat apaku at gmx.de
Wed Jun 6 16:48:18 UTC 2007


On 06.06.07 12:28:18, dukju ahn wrote:
> 2007/6/6, Andreas Pakulat <apaku at gmx.de>:
> > I'm actually wondering wether we should use QVariant as return type
> > instead of QString, that way we can return a QDateTime directly. Of
> > course any other type of revision will need to return a QString, even if
> > for example its a revision number and the VCS uses plain ints for
> > numbering.
> 
> IMHO, QVariant isn't needed. We already know the type of VcsRevision.
> And QDateTime can be directly constructed using the returned QString.

Well, but we could avoid one conversion step.

> > > > > Lastly, when revision is RevisionType::Special, what is the format of
> > > > > QString revisionValue()? Is it just int? or string such as "Head"?
> > > >
> > > > It would be e.g. "HEAD", possibly all upper case like that. Again we
> > > > should standardize this.
> > >
> > > Oh no. If RevisionType is Special, QString revisionValue() should return
> > > the RevisionSpecialType enum value, which would be int.
> >
> > Wrong, it would be RevisionSpecialType, but if we do that and we do the
> > above (which makes sense for me) then RevisionSpecialType needs to be
> > registered as metatype.
> 
> Yes. it would be RevisionSpecialType. BTW, I don't understand what is
> metatype. We already defined RevisionSpecialType. Why do we need
> additional type?

See the QVariant documentation, to use a custom datatype with QVariant
you need to register it using qRegisterMetaType and IIRC
Q_DECLARE_METATYPE (or similar).

Andreas

-- 
Time to be aggressive.  Go after a tattooed Virgo.




More information about the KDevelop-devel mailing list