PDA

View Full Version : Get current item from a QListWidget?



Kimm
June 17th, 2007, 07:35 PM
I cant seem to find any reference on how to grab the current item in a QListWidget (Qt4) (as text).

Any help anyone? :/

msumurph
June 18th, 2007, 02:17 AM
I think it is:


widget->currnetitem()->text()

currentitem returns a QListWidgetItem, which has a method text(), which returns a QString.

I have not tried this, just read the documentation entry in QT Assistant. Hope this helps. ;)

Kimm
June 18th, 2007, 12:58 PM
I think it is:


widget->currnetitem()->text()

currentitem returns a QListWidgetItem, which has a method text(), which returns a QString.

I have not tried this, just read the documentation entry in QT Assistant. Hope this helps. ;)

I found the same solution in a discussion regarding KDE4. But it was not evident from the online documentation (http://doc.trolltech.com/4.1/qlistwidget.html)

QT Assistant eh? Sounds like a good thing to have! :D Need to get it... :D