Linking QListViewItem to a struct or class

Robert-Margaret Hunt robert-margaret_hunt at sil.org
Mon Mar 19 12:58:00 GMT 2001


Hi,

The easiest way to do this is instead of having a pointer to an 
object is to derive the object from QListViewItem and then add 
the item to the list box. The derivative can contain a pointer or 
data or whatever. This way saves you a lot of type-casting.

Jonathan Hunt

______________________________ Reply Separator _________________________________
Subject: Linking QListViewItem to a struct or class
Author:  <kdevelop at kdevelop.org> at Internet
Date:    3/18/2001 6:37 PM


Hello there,

I'm working on a mySQL frontend for KDE with KDevelop 1.4 and Qt 2.2.4.
I have a QListView with databases (among other things) as QListViewItem.
I'd like to attach a pointer to a structure containing more info about the
selected item... Now in most RAD tools under Windows (Delphi for example, so
probably in Kylix too), you have a pointer to an object in the listviews
classes, but I haven't seen that in Qt...

Anyone got an idea to realize this ?

I thought about implementing a list on the side, but then how do I index it
on the listview items ? And it's boring to have to implement a complete array
architecture on the side of the ListView...

Help :)

Laurent Cortier
http://www.dsimprove.be

-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org wit
h the following body:
unsubscribe ¯your-email-address®


-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list