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 catch a QPushButton signal from a QTableWidget?

How to catch a QPushButton signal from a QTableWidget?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 13.5k 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.
  • X Offline
    X Offline
    xtingray
    wrote on last edited by A Former User
    #1

    Hi, This is my problem: Within a QTableWidget I had a column of QPushButton objects. Every button has the signal clicked connected to the table, the point is: How could I get the corresponding row of the table when a button is clicked?

    I tried many signals from the class QTableWidget: currentCellChanged/currentItemChanged/cellClicked but nothing works because the table ignores any event from the buttons, so I guess the signal must come from the QPushButton object... but, how to connect them to get that specific data?

    Thanks for any hint.


    Qt Developer

    1 Reply Last reply
    0
    • X Offline
      X Offline
      xtingray
      wrote on last edited by
      #2

      I found an interesting solution right here (check the last post):

      http://www.qtcentre.org/threads/37856-QtableWidget-With-Pushutton-get-row-error


      Qt Developer

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vishwajeet
        wrote on last edited by
        #3

        Have a look at this class QSignalMapper

        You need to have same mechanism which is mentioned in its reference document in Qt Assistant

        Born To Code !!!

        1 Reply Last reply
        0
        • D Offline
          D Offline
          Darryl DSouza
          wrote on last edited by
          #4

          Qre you setting the buttons using void QTableWidget::setCellWidget ( int row, int column, QWidget * widget ) ?

          Darryl D'Souza

          vishnuV 1 Reply Last reply
          0
          • X Offline
            X Offline
            xtingray
            wrote on last edited by
            #5

            Yes, I used the method void QTableWidget::setCellWidget ( int row, int column, QWidget * widget ).

            PD: I already resolved the problem extending the class QPushButton, but it's nice to know another possible solutions.


            Qt Developer

            1 Reply Last reply
            0
            • D Darryl DSouza

              Qre you setting the buttons using void QTableWidget::setCellWidget ( int row, int column, QWidget * widget ) ?

              vishnuV Offline
              vishnuV Offline
              vishnu
              wrote on last edited by
              #6

              @Darryl-DSouza
              yes. I have used QTableWidget::setCellWidget ( int row, int column, QWidget * widget ) .

              IS there any signal I can get from the QTablewidget?

              1 Reply Last reply
              0

              • Login

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