I'm sure you'll find an example here.
In a place that will allow you to see the output and at the same time will guarantee that the return values are the same as the ones used in the if statement.
The screenshot is useless. I asked you to select all the contents or better yet just add the following to your code:
Qt Code:
qDebug() << "Line edit value:" << ui.fromLineEdit->text();To copy to clipboard, switch view to plain text mode
I reached: Line edit value: "0" But doing that doesn't make sense, my problem is that
doesn't return true (of course I selected this radiobuttons before) and I don't know why. In my code after user selects radiobuttons, all radiobuttons areQt Code:
if (ui.beaufortBox->isChecked() && ui.knotBox_2->isChecked())To copy to clipboard, switch view to plain text mode
But the real mistery is when user selected two checkboxes (ui.beaufortBox and ui.knotBox_2) and clicked next step button, it sets up labels correctly (which means that this radiobuttons are checked) and after they are set to checkable(false) if clause with
doesn't return true. RegardsQt Code:
if (ui.beaufortBox->isChecked() && ui.knotBox_2->isChecked())To copy to clipboard, switch view to plain text mode
Are both buttons checked? Radio buttons are by default mutual exclusive...
Yes, they are both checked, they are in two different groupBoxes. But before setting it to setCheckable(false) the same if clause but in different function returned true!! Strange, isn't it? Regards
I've got it now! I deleted setCheckable(false) and it works. It means, that setCheckable(false) deletes current checked status.
If you change the buttons not to be checkable then no wonder they are not checked... If you want to prevent the user from changing their value, use QWidget::setDisabled() instead.
Marcel told me, that it saves checked() value... However, problem solved![]()
Bookmarks