Hello,
as the Qt docs state QVariant does not call the "operator==" when you compare two variants with custom types.
Is there any way to define a comparison method for these types? I want to put a custom type (boost::smart_ptr) into the QComboBox data which works well for enum's when you cast them to int, otherwise not - and the smart_ptr can't be casted to something else Putting this type into the ComboBox works well but i can't use QComboBox::findData() to find my items again ...
Qt Code:
v1 == v11: false v1 == v1 : trueTo copy to clipboard, switch view to plain text mode
Thanks for your help and sorry for the bad english
Edit:
One way would be to extend undocumented the QVariant::Handler like it's done in QtGui/qguivariant.cpp, but this can only be done from ::qRegisterGuiVariant() and I don't want to modify QVariant itself. Since Qt is not statically linked and qRegisterGuiVariant and qUnregisterGuiVariant are not exported from QtGui, I could "fake" them but that would be an ugly hack ...
Bookmarks