When a QPushButton
is clicked, I want it to remain pressed down until clicked again.
void MainWindow::itemClicked(){
QPushButton *clickedItem = qobject_cast<QPushButton *>(sender());
qDebug() << clickedItem->isDown();
if(!clickedItem->isDown())
clickedItem->setDown(true);
else
clickedItem->setDown(false);
}
This doesn't seem to work. It will cause the button to be pressed down indefinitely.
clickedItem->isDown()
is always false.
setCheckable
. I'm wondering whyisDown
doesn't work as expected. – Scrapple