Reputation: 574
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.
Upvotes: 1
Views: 893
Reputation: 36630
Set the "checkable" property of your button to true after it has been created:
Button->setCheckable(true);
At QAbstractButton::checkable():
This property holds whether the button is checkable. By default, the button is not checkable.
Upvotes: 3