Issue
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 which clicked button. I am using pyqt4 and Python 3.5
Could you please help me to solve this problem? Thanks
Solution
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.
Answered By - Marcel Petrick
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.