I am developing using the Qt Nokia SDK.
I am having trouble displaying MessageBox buttons when trying to display a message box inside a function. If I try to display it in the main window, there is no problem displaying the buttons.
The main window consists of a QStackWidget, which contains different widgets.
Here is the code that works in the main window:
QMessageBox msgBox; msgBox.setText("Name"); msgBox.setInformativeText("Do you want to save your changes?"); msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Save); int ret = msgBox.exec();
Here is the function and code that I run after receiving a response from a web request (a message box is displayed, but not a button.
void MainWindow::RequestReceived() { QMessageBox *msgBox = new QMessageBox(this); msgBox->setText("Test"); msgBox->setWindowModality(Qt::NonModal); msgBox->setInformativeText("Do you want to save your changes?"); msgBox->setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); msgBox->setDefaultButton(QMessageBox::Save); int ret = msgBox->exec(); }
Has anyone understood what is going on?
Thanks in advance!
source share