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::Save);@

    OR

    @ QMessageBox msgBox(this); //Text doesn't show when I put a parent, works fine without (but doesn't show application icon..)
    // QMessageBox msgBox;
    msgBox.setIcon(QMessageBox::Warning);
    msgBox.setText("The document has been modified.");
    msgBox.setInformativeText("Do you want to save your changes?");
    msgBox.setStandardButtons(QMessageBox::Ok);
    msgBox.setDefaultButton(QMessageBox::Ok);
    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.