Compile problem with KUrl::operator QVariant()

Andreas Pakulat apaku at gmx.de
Mon Mar 26 20:21:55 BST 2007


On 26.03.07 21:09:54, Harri Porten wrote:
> I can't compile kdelibs anymore (see attached error) since change
> 
>   http://websvn.kde.org/?view=rev&revision=644457
> 
> was applied that added a QVariant conversion operator to KUrl. Maybe my 
> compiler is too old (gcc 3.3.5) but isn't there anyway to rewrite the code? 
> After all, I find it to be a questionable design to add such operators. The 
> conversion should be done outside of the class IMO.

Well, of course the code could be changed, but that just moves the
qVariantFromValue call from KUrl to some place else
(kdecore/config/kconfiggroup). The reason to add this operator is that
then KUrl can be used with a QVariant constructor when needed. Else code
that creates QVariant's using its constructor and a template value would
need to use the qVariantFromValue(). I took extra care to not use the
template version as that seems to create problems with older compilers. 

I wonder wether KUrl now needs a .moc file... But I don't know enough
for th QVariant/QMetaType magic and it seems to work on more recent
compilers...

Andreas

-- 
You will triumph over your enemy.




More information about the kde-core-devel mailing list