[Kde-java] KListView and KListViewItem
Paul Sprakes
pauls at sprakes.co.uk
Fri Mar 12 21:21:51 CET 2004
I have subclassed KListViewItem with a class that takes a delegate object
which I can inspect when I catch the various signals from KListView. I have
found though that while items added as children to KListView will come
through the signal mechanism as the correct subclass, items added as children
of a ListViewItem always come back as QListViewItem. I cannot cast the
QListViewItem items back into my subclass and there is no way for me to get
any info about what has been selected other then the displayed text.
Can anyone shed any light on this or tell me what I am doing wrong?
//this is connected to the "executed(QListViewItem)" signal
public void treeItemSelected(QListViewItem item) {
System.out.println(item);
}
private void populateServerTree() {
Iterator servers = app.getServers().iterator();
while(servers.hasNext()) {
NewsServer server = (NewsServer)servers.next();
ListViewItem serverNode = new ListViewItem(tree, server,server.getHost());
Iterator groups = server.getSubscribedGroups().iterator();
while(groups.hasNext()) {
NewsGroup group = (NewsGroup)groups.next();
ListViewItem groupNode = new ListViewItem(serverNode, group,
group.getName());
}
}
}
More information about the Kde-java
mailing list