QPushButton::setDown() doesn't stay down
Hello.
Sometimes I would like to programmatically set a button down and keep it in a pushed state. This has no other than visual reasons, it shows that there is a process running that can be stopped by the same button that started it.
I just discovered that it actually doesn't work.
Code:
void MyWidget::on_Button_clicked()
{
if (ui.Button->isDown())
return;
ui.Button->setDown(true);
}
After I click the button, it stays down like it should. But when the button loses focus, it comes back up. Another thing is that despite the check if the button is down already, wild clicking can also bring it back up again. Is there anything I can do about this? I know I could disable a button instead of downing it, but I'm already using that for when a button should be really disabled.
Re: QPushButton::setDown() doesn't stay down
would setCheckable() work for you..it will make the button toggle..so when u click, it'll stay in down state until u click it again or emit clicked() urself
Re: QPushButton::setDown() doesn't stay down
Thanks mate! It works totally awesome.