QMessageBox - text not showing when it has a parent

  • Hi,

    I'm using the "code example here":http://qt-project.org/doc/qt-5.0/qtwidgets/qmessagebox.html
    I trying the static and the non-static approach, both with the same problem, no text message displayed:

    "Here what I get":https://www.dropbox.com/s/bowz9uut73osmfl/QMessageBox.png

    @int ret = QMessageBox::warning(this, tr("My Application"),
    tr("The document has been modified.\n"
    "Do you want to save your changes?"),
    QMessageBox::Save | QMessageBox::Discard
    | QMessageBox::Cancel,


    @ QMessageBox msgBox(this); //Text doesn't show when I put a parent, works fine without (but doesn't show application icon..)
    // QMessageBox msgBox;
    msgBox.setText("The document has been modified.");
    msgBox.setInformativeText("Do you want to save your changes?");
    int ret = msgBox.exec();@

    Maybe the code example is outdated? I'm using 5.1.1 and this code is straight in the MainWindow with nothing fancy, thank you!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.