title: Qt: How to display a Messagebox when you are within a function?
body: <p>I'm developing using the Qt Nokia SDK.</p>
  
  <p>I'm having trouble displaying the buttons of a MessageBox, when trying to display a messagebox within a function. If i try to display it within the main window, there is no problem showing the buttons.</p>
  
  <p>The mainwindow consist of a QStackWidget which holds different widgets.</p>
  
  <p>Here is the code that works in main window:</p>
  
  <pre><code>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();
  </code></pre>
  
  <p>Here is the function and code that i run after receiving a response from a web request (The messagebox displays, but not the buttons.</p>
  
  <pre><code>void MainWindow::RequestReceived()
  {
      QMessageBox *msgBox = new QMessageBox(this);
      msgBox-&gt;setText("Test");
      msgBox-&gt;setWindowModality(Qt::NonModal);
      msgBox-&gt;setInformativeText("Do you want to save your changes?");
      msgBox-&gt;setStandardButtons(QMessageBox::Save | QMessageBox::Discard | 
                                 QMessageBox::Cancel);
      msgBox-&gt;setDefaultButton(QMessageBox::Save);
      int ret = msgBox-&gt;exec();
  }
  </code></pre>
  
  <p>Anyone got an idea of what is happening?</p>
  
  <p>Thanks in advance!</p>