I used the “ischecked” function for a checkbox, it works fine for it. I used the same function for pushbutton. The default state is “unchecked” for a pushbutton, so it is working fine in that case, but when I go to the properties of pushbutton and change the state to checked and try to work on it like
if(ui->Button->isChecked()==Qt::Checked)
{
ui->label_2->setPixmap(QPixmap::fromImage(image));
ui->frame_10->setMinimumHeight(image.size().height() + 20);
}
then I can see no changes in the dialogbox. Why is this happening? What should I do inorder to make it work.
Set the “checkable” property of your button to true after it has been created:
At QAbstractButton::checkable():