0

i have connected a function to a QListWidget's itemDoubleClicked. as far as i know it passes two arguments to the function (self, item). i want to get the index of this item so that i can access an item from another list which has the same indexes.

self.ResultList.itemDoubleClicked.connect(self.switch_image)

the function

def switch_image(self, item):
    #temp = QtWidgets.QListWidgetItem
    #t = temp.text()

    ''' what should be here '''

    # ind = item.index
    print(t)
Eshaka
  • 974
  • 1
  • 14
  • 38
  • 1
    use `print(self.ResultList.row(item))` – eyllanesc May 17 '19 at 07:14
  • itemDoubleClicked just passes an argument: the item. The self is not because of the itemDoubleClicked but because it belongs to a class. Read https://stackoverflow.com/questions/2709821/what-is-the-purpose-of-self – eyllanesc May 17 '19 at 07:16
  • @eyllanesc, thanks, exactly what i was looking for. – Eshaka May 17 '19 at 07:20

0 Answers0