Sorting and displaying a custom QVariant type.

Posted by Kranar on Stack Overflow See other posts from Stack Overflow or by Kranar
Published on 2010-05-03T19:37:32Z Indexed on 2010/05/03 19:58 UTC
Read the original article Hit count: 153

Filed under:
|

Hello, I have a custom type I'd like to use with QVariant but I don't know how to get the QVariant to display in a table or have it sort in a QSortFilterProxyModel.

I register the type with Q_DECLARE_METATYPE and wrote streaming operators registered via qRegisterMetaTypeStreamOperators but for whatever reason when I use the type with a table model, it doesn't display anything and it doesn't sort.

I should specify that this custom type can not be modified. It has a copy and default constructor, but I can not go in and modify the source code to get it to work with QVariant. Is there a way of non-intrusively getting the behaviour I'd like?

© Stack Overflow or respective owner

Related posts about c++

Related posts about qt