PDA

View Full Version : extract item from QListWidget



impeteperry
13th May 2006, 18:53
In Qt3 I had a QListView and
connect( lbCurrentList, SIGNAL( selected( int ) ), this, SLOT( slotFromListBox( int ) ) ); Now I have a QListWidget in Qt4 and I want to extract either the index of an item or the item itself with a dbl mouse click on the item.

I am overwhelmed by all the documentation.

Help would be appreciated.

jacek
13th May 2006, 18:59
Use QListWidget::itemDoubleClicked( QListWidgetItem * item ) signal --- it will give you a pointer to the clicked item.

connect( lbCurrentList, SIGNAL( itemDoubleClicked( QListWidgetItem* ) ), this, SLOT( slotFromListWidget( QListWidgetItem* ) ) );

PS. QListWidget from Qt4 is an equivalent of QListBox from Qt3, you probably want to use QTreeWidget instead.

impeteperry
13th May 2006, 19:41
Thanks for very rapid responce, much appreciated.
Will look at QTreeWidget as you suggest.