Please help with one question. I am writing a program in Qt with an interface. When you click a button, certain actions must be performed, some values are worth checking and QInputDialog to change the value during program execution. We wrote the do-while construction to check, if the value was entered incorrectly, the program works regularly again offering to enter the correct value, but when I enter the required value, the program just hangs and stops working. I do not understand why, when using exactly the same design, but in the console application everything works fine. Please tell me how to solve this problem.
void MainWindow::on_pushButton_clicked() { QLocale::setDefault(QLocale::C); .... bool bv_1 = true; bool ok; do { if (ver_1 < 0 || ver_1 > 1) { double test = QInputDialog::getDouble(this, "Ошибка ввода!", "Недопустимая вероятность смерти. Введите число от 0 до 1!", ver_1, -2147483647, 2147483647, 3, &ok ); if (ok) { ver_1 = test; } else { bv_1 = false; break; } } }while(bv_1); ....}
ver_1??? Why is this information not in question? Secondly, when you enter a value between0and1you get an infinite loop, as it is written in your code. - AnT