Answer the question
In order to leave comments, you need to log in
How to pass value from child window to parent window?
Idea:
There is a form with a button. When the button is pressed, another form opens, with radio buttons and a button.
When you click on the button, the window closes and sends the value depending on the selected one. In the main form this value is "caught".
In C# it was done something like this:
//Нажатие на кнопку
void ButClic()
{
f1 = new CrPass();
// подписка на событие закрытия формы
f1.FormClosing += new FormClosingEventHandler(F1_FormClosing);
f1.ShowDialog();
}
void F1_FormClosing(object sender, FormClosingEventArgs e)
{
string str = (sender as Form2).ReturnZn();
if (str != "NONE")
{
// некий код
}
}
Answer the question
In order to leave comments, you need to log in
The value QRadioButton
can be returned with . In the main form, you can get it with . The code will be like this:QDialog::done(int)
QDialog::exec(int)
void ChildDialog::onOkButton()
{
int result;
// считываем значение QRadioButton
done(result);
}
void MainDialog::showChild()
{
ChildDialog dlg(this);
int radioBtn = dlg.exec();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question