Cayan
23rd April 2009, 03:05
How can I simple open a program perform some actions and then close it?
Already tried:
QTimer::singleShot(10, &a, SLOT(quit()) );
Inside the mainform... but I do not have access to the application pointer...
Base code for what I want:
msgBox.setText("Bla bla bla");
QPushButton *opt1 = msgBox.addButton(tr("First One!"), QMessageBox::ActionRole);
QPushButton *opt2 = msgBox.addButton(tr("Second One!"), QMessageBox::ActionRole);
msgBox.setDefaultButton(opt2);
msgBox.setIcon(QMessageBox::Warning);
msgBox.exec();
if(msgBox.clickedButton() == opt1)
{
//some actions...
//Close the entire program!
}
Already tried:
QTimer::singleShot(10, &a, SLOT(quit()) );
Inside the mainform... but I do not have access to the application pointer...
Base code for what I want:
msgBox.setText("Bla bla bla");
QPushButton *opt1 = msgBox.addButton(tr("First One!"), QMessageBox::ActionRole);
QPushButton *opt2 = msgBox.addButton(tr("Second One!"), QMessageBox::ActionRole);
msgBox.setDefaultButton(opt2);
msgBox.setIcon(QMessageBox::Warning);
msgBox.exec();
if(msgBox.clickedButton() == opt1)
{
//some actions...
//Close the entire program!
}