Solved How to get signal of button from QListWidgetItem
-
How to get signal of button from QListWidgetItem, that was set using setItemWidget?
I have got listWidget, that contains QListWidgetItem(s).
On each of them I have got 3 buttons.
Q. I have to distinguish what button sent the signal in mainwindow.cpp
-
@LISP
The fact that you added the buttons into aQListWidgetItem
withsetItemWidget()
is neither here nor there. You attach the buttons' signals as you would from anywhere. If you need to know which of the three buttons emitted the signal, or which list item the emitting button was in, it is up to you to pass the information in theconnect()
, e.g. by using a lambda with a suitable parameter. -
@LISP
The fact that you added the buttons into aQListWidgetItem
withsetItemWidget()
is neither here nor there. You attach the buttons' signals as you would from anywhere. If you need to know which of the three buttons emitted the signal, or which list item the emitting button was in, it is up to you to pass the information in theconnect()
, e.g. by using a lambda with a suitable parameter. -
@LISP Maybe you should use https://doc.qt.io/qt-5/qbuttongroup.html instead?
-
How many items will this
QListWidget
have, roughly?