Custom-type QVariant comparison in KConfigDialogManager
Andreas Pakulat
apaku at gmx.de
Sat Jun 16 17:24:31 BST 2007
On 15.06.07 21:51:28, Constantin Berzan wrote:
> Hello list,
> I am using a KUrlRequester in a form for configuring a KConfigXT "url"
> property. The problem is that the "Default" and "Apply" buttons are always
> active. I think I got to the root of this problem, which is the way item
> values are compared in kdelibs/kdeui/dialogs/kconfigdialogmanager.cpp on line
> 480:
>
> if (p != item->property())
>
> We are comparing two QVariants which (in this case) use the custom "user" type
> KUrl. The Qt docs clearly state we can't do this: operator!= and others don't
> support custom types.
>
> I can't see a way around this problem, so please enlighten me ;)
> Many thanks in advance.
I never got around to looking at that problem :) (I was the one who
introduced the KUrl into KconfigXT). Unless I'm totally mistaken
replacing the above with:
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()
)
)
should work. Its not beautiful, but keeps duplicating code.
Andreas
--
Tuesday is the Wednesday of the rest of your life.
More information about the kde-core-devel
mailing list