I have connected non-checkable push buttons from a ButtonGroup like this
connect(buttonGroupPtr, SIGNAL(buttonReleased(int)), this, SLOT(someFunction(int)));
now I want the Buttons to be checkabel and use the toggled()
signal, which emits a bool
. How do i combine the int
that is emitted by the ButtonGroup and the bool
that is emitted by the toggled()
signal?
QButtonGroup
has buttonToggled(int id, bool checked)
signal you can find here . So you can
connect(buttonGroupPtr, SIGNAL(buttonToggled(int, bool)), this, SLOT(someFunction(int, bool)));
触发信号必须在另一个connect语句中连接。
connect(buttonGroupPtr, SIGNAL(toggled(bool)), this, SLOT(mySlotToggled(bool)));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.