Hello,
I would like to present a popup at the beginning of my program, which let the user chose between 2 modes.
If the user makes his choice, then a new window shall be opened. Unfortunately, bot the popup and another window disappear after clicking on one of the pushbuttons. Can you tell me what is the reason and how to deal with this problem (see my code below)?
Thank you
best regards,
Vitali
#include <QApplication>
#include <QPushButton>
#include <QMessageBox>
#include <mainframe.h>
#include "dialog_start.h"
#include "OscillationGRN.h"
int main(int argc, char **argv)
{
// first appears a popup, which will offer to the user 2 different kinds of problems
msgBox.exec();
if(msgBox.clickedButton() == BenchmarkButton){ // if the user decide to cope with optimization of constrained benchmark problems
mainFrame mainWind;
// execute the initialization dialog
dialogStart start(0, &mainWind);
start.show(); // the mainWindow will be opened after the user click on START button within dialogStart
msgBox.hide();
}
else if(msgBox.clickedButton() == OscillationButton){ // if the user decide to cope with generation of oscillation by means of Gene Regulatory Networks
OscillationGRN evoGRN;
evoGRN.show();
msgBox.hide();
}
return app.exec();
exit(EXIT_SUCCESS);
}
#include <QApplication>
#include <QPushButton>
#include <QMessageBox>
#include <mainframe.h>
#include "dialog_start.h"
#include "OscillationGRN.h"
int main(int argc, char **argv)
{
QApplication app(argc, argv);
// first appears a popup, which will offer to the user 2 different kinds of problems
QMessageBox msgBox;
QPushButton *OscillationButton = msgBox.addButton("Sustained Oscillation", QMessageBox::ActionRole);
QPushButton *BenchmarkButton = msgBox.addButton("constrained Problems",QMessageBox::ActionRole);
msgBox.exec();
if(msgBox.clickedButton() == BenchmarkButton){ // if the user decide to cope with optimization of constrained benchmark problems
mainFrame mainWind;
// execute the initialization dialog
dialogStart start(0, &mainWind);
start.show(); // the mainWindow will be opened after the user click on START button within dialogStart
msgBox.hide();
}
else if(msgBox.clickedButton() == OscillationButton){ // if the user decide to cope with generation of oscillation by means of Gene Regulatory Networks
OscillationGRN evoGRN;
evoGRN.show();
msgBox.hide();
}
return app.exec();
exit(EXIT_SUCCESS);
}
To copy to clipboard, switch view to plain text mode
Bookmarks