0
votes

i am adding 2 buttons in each cell of my Qtablewidget and i want to perform a specific action for each clicked button. The problem is that i am only able to detect the click on the entire cell but not wich clicked button. I am using pyqt4 and python 3.5

Could you please help me to solve this problem? Thanks

1
If you want us to help you, you must provide a minimal reproducible exampleeyllanesc

1 Answers

0
votes

I guess you are already watching the QTableWidget::cellClicked(int row, int column)-signal with some slot, or? You could try to acquire the sender, which of both buttons it was, by something similar to this:

#include <QtCore/QMetaObject>
#include <QtCore/QMetaMethod>

{
    QMetaMethod const metaMethod = sender()->metaObject()->method(senderSignalIndex());
    qDebug() << "invoking caller: name and signature:" << metaMethod.name() << "|" << metaMethod.methodSignature();
}

(please adapt yourself to PyQt).


Or: you add connections for each of the buttons for each cell at the creation.