Qt-interest Archive, February 2007
Beginner - List view and model - item data
Message 1 in thread
I have a list view (a QTreeView) connected to a QStandardItemModel. Each
row of the list view shows several fields of an object - for example an
employee
record. I want to associate a pointer to an employee record with each
row in the model/list view, so that when I click on a row, I can retrieve
the entire empolyee record and do something with it.
But I don't want a visible column for this pointer - I want it to be
hidden from the user.
Is there any way to do this? In other words, associate a
hidden pointer with each row of a list/tree view and/or model?
QComboBox does something like this - insertItem(...)
will take a QVariant which can hold additional data.
--
[ signature omitted ]
Message 2 in thread
Use QStandardItem::data/setData with a user specific role.
-K
On 2/9/07, John Smith <invalid@xxxxxxxxxxx> wrote:
> I have a list view (a QTreeView) connected to a QStandardItemModel. Each
> row of the list view shows several fields of an object - for example an
> employee
> record. I want to associate a pointer to an employee record with each
> row in the model/list view, so that when I click on a row, I can retrieve
> the entire empolyee record and do something with it.
>
> But I don't want a visible column for this pointer - I want it to be
> hidden from the user.
>
> Is there any way to do this? In other words, associate a
> hidden pointer with each row of a list/tree view and/or model?
>
> QComboBox does something like this - insertItem(...)
> will take a QVariant which can hold additional data.
>
>
>
>
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]