Adding widgets to qtablewidget pyqt

Viewed 25897

Is there anyway to add like a button in qtablewidget? But the date within the cell would stil have to be displaying, for example if an user double clicked a cell, could i send a signal like a button? Thanks!

edititem():

def editItem(self,clicked):
    if clicked.row() == 0:
        #go to tab1
    if clicked.row() == 1:
        #go to tab1
    if clicked.row() == 2:
        #go to tab1
    if clicked.row() == 3:
        #go to tab1

table trigger:

self.table1.itemDoubleClicked.connect(self.editItem)
2 Answers

In PyQt4 add button to qtablewidget :

btn= QtGui.QPushButton('Hello')
qtable_name.setCellWidget(0,0, btn) # qtable_name is your qtablewidget name
Related