[Solved] Selected item from QListWidget

  • Could any one help me fix this problem please. I want select an item (selected already from the listWidget), code returns the object rather then file name from the listWidget

    @def fileToSelect(self):
    self.listWidget = QListWidget()
    fselected = self.ui.listWidget.currentIndex()

        print (fselected)@


    <PyQt4.QtCore.QModelIndex object at 0x0000000003BA2438>

  • Lifetime Qt Champion


    That's normal, you are asking for the current index which represent a model entry.

    What you seem to be looking for is:


    Hope it helps

  • Thank you so much SGaist, that worked, thanks

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.