Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] Push Button Issue
I have created a pushButton in Qt Designer and two signals-slots connections like the following:
Sender Signal Receiver Slot
pushButtonStart pressed MyClass StartPressed()
pushButtonStop released MyClass StartReleased()
However I can see in a log file that whenever I click the pushButton, both signals get called.
Do I need to create the pushButton with some extra option that allows the pressed/released behaviour to work?
I've just discovered what the problem is.
pushButton pressed/released actually refer to the mouse!
Is there a way then to define what I need, which is to assign one behavior to when the button is pressed and a different behavior to when the button is released?
Are you thinking about something like toggling ?
If I link the pushButton to a Radio button (this would show the user the status of the button better) then the SLOT for clicking the button is toggle().
Can I then read a TRUE/FALSE status of the radio button from here?
NicuPopescu last edited by
for a QPushButton use setCheckable to make it toggling and connect it toggled ( bool checked ) signal to fetch its status
click= press + release cycle
toggling happens every click :)