Dialog Box return values
Unsolved
General and Desktop
-
wrote on 3 Jun 2022, 04:23 last edited by
How can I make a dialog box return different values (0, 1, 2, 3), on the click of the same button depending on different conditions.
For example:on_startButton_clicked(){ if(condition 1){ dialog returns 0 } else if(condition 2){ dialog returns 1 } else if(condition 3){ dialog returns 2 } ....
-
You can't - add a custom functio to your class which returns your value so you can use it later on.
-
How can I make a dialog box return different values (0, 1, 2, 3), on the click of the same button depending on different conditions.
For example:on_startButton_clicked(){ if(condition 1){ dialog returns 0 } else if(condition 2){ dialog returns 1 } else if(condition 3){ dialog returns 2 } ....
wrote on 3 Jun 2022, 06:36 last edited by@BigBen
Assuming you are wanting to return those values as soon as thestartButton
is clicked, you can just call void QDialog::done(int r) with the desired value. Or do that later with the value if you want it returned later.
3/3