Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, February 2008
Re: Using model/view with user-type QVariant data


Message 1 in thread

Hello, Etienne !

Hi everybody,
>
> I have a model containing user-type QVariant data.
> I associated new QItemEditorCreatorBase objects to the user-types, using registerEditor.
> This works well for item edition, but not for item display, as these types cannot be converted to strings by QVariant.
> Is there a way to tell QVariant how to convert user types to QString?
>
> You have to define behavior  of your model if role==Qt::DisplayRole, and
return QVariant (your_string); and/or return value.toString();

-- 
 [ signature omitted ]