I have the following problem: I use
Q_DECLARE_METATYPE( std::shared_ptr<int> );
qRegisterMetaType< std::shared_ptr<int> >();
QMetaType::registerComparators< std::shared_ptr<int> >();
use std::shared_ptr<int>for example. QListModel. I need a behavior in which
QVariant::fromValue( std::shared_ptr<int>( new int(5) ) ) == QVariant::fromValue( std::shared_ptr<int>( new int(5) ) )
truly. My code above returns false here, as it std::shared_ptr<int>::operator== ()compares the source pointers. Is it possible to register comparators other than standard operators in QMetaType::registerComparators?
source
share