[proposed PATCH] new comparison method in KConfigSkeletonItem (was: Custom-type QVariant comparison in KConfigDialogManager)

Constantin Berzan exit3219 at gmail.com
Sat Jun 16 17:39:37 BST 2007


On Saturday 16 June 2007 19:24, Andreas Pakulat wrote:
> if(  ( ( p.userType() >= QVariant::UserType 
>          || item->property.userType() >= QVariant::UserType 
>        ) && p.userType() != item->property().userType() 
>     ) 
>     || ( ( p.userType() < QVariant::UserType
>            && item->property.userType() < QVariant::UserType
>          ) && p != item->property()
>        )
>     )

As far as I can see that would just compare the *types*, not the data, in case 
the QVariants use custom types.

I already have a proposed solution, it involves adding a new function to the 
KConfigSkeletonItem class. The

isEqual(const QVariant &)

function is to be used for comparison. It is a pure virtual, implemented in 
each class derived from KConfigSkeletonItem.

Since the patch is not so small, I put it here:
http://rafb.net/p/2894Mo42.html

Tell me what to change / improve. I have compiled kdelibs with it and it seems 
to work fine.
When you feel it's ok, commit it, as I don't have svn write access. Thanks.

-- 
http://ascending.wordpress.com/




More information about the kde-core-devel mailing list