Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to get value of a particular cell in QTableWidget on double clicking?

How to get value of a particular cell in QTableWidget on double clicking?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 2.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Piyush
    wrote on last edited by
    #1

    I am trying to get the value of a particular cell and store it in a variable, on double clicking a cell (itemdoubleclicked event) in QTableWidget. I know that it should be done by itemdoubleclicked event handler, but not sure how to get value of that cell. It should be something like below:

    self.ui.tableWidget.itemDoubleClicked.values()

    But, this shows an error:

    AttributeError: 'PyQt5.QtCore.pyqtBoundSignal' object has no attribute 'values'

    So, values is not an attribute for itemDoubleClicked. Could you please help with the correct way to get the value of particular cell?

    jsulmJ 1 Reply Last reply
    0
    • P Piyush

      I am trying to get the value of a particular cell and store it in a variable, on double clicking a cell (itemdoubleclicked event) in QTableWidget. I know that it should be done by itemdoubleclicked event handler, but not sure how to get value of that cell. It should be something like below:

      self.ui.tableWidget.itemDoubleClicked.values()

      But, this shows an error:

      AttributeError: 'PyQt5.QtCore.pyqtBoundSignal' object has no attribute 'values'

      So, values is not an attribute for itemDoubleClicked. Could you please help with the correct way to get the value of particular cell?

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Piyush Check the documentation http://doc.qt.io/qt-5/qtablewidget.html#itemDoubleClicked
      You get the double clicked item as signal/slot parameter:

      void QTableWidget::itemDoubleClicked(QTableWidgetItem *item)
      

      This does not make any sense:

      self.ui.tableWidget.itemDoubleClicked.values()
      

      You should have your slot connected to this signal:

      def onItemDoubleClicked(self, item):
          pass
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved