Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.6.0
-
None
Description
Consider this code:
std::vector< std::vector<int> > v; v.push_back( std::vector<int>( 1, 4 ) ); v.push_back( std::vector<int>( 1, 3 ) ); QComboBox box; box.addItem( "", QVariant::fromValue<std::vector<int>>( v[0] ) ); box.addItem( "", QVariant::fromValue<std::vector<int>>( v[1] ) ); int pos = box.findData( QVariant::fromValue<std::vector<int>>(v[0]) );
pos is -1, when 0 was expected.
Manual search (for i to box.count()) is doable and works. As ( box.itemData( 0 ).value< std::vector<int> >() == v[0] ) surprisingly returns true! But findData is supposed to work too!
Note: Adding Q_DECLARE_METATYPE( std::vector<int> ); does not help