My Messagebox is silent i don't have sound



  • Hi
    I'm Using Qt v5.1.0 - Mingw v 4.8-32bit QCreator 2.8

    I have a problem with QMessageBox; MessageBox Is Silent When Is Displayed.

    @
    #include <QMessageBox>
    @

    @
    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);
    //....
    @
    how to fix it?



  • If you define the message box and it's text yourself, it will not play any sound by default.

    You can either play the sound yourself, before the message box is called, or use one of the build in message boxes, which will play a warning sound.

    You can also try the following code:
    @ QMessageBox msgBox;
    msgBox.setText("<b> The document has been modified.<\b>");
    msgBox.setInformativeText(" Do you want to save your changes? ");
    msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
    msgBox.setDefaultButton(QMessageBox::Save);
    msgBox.setIcon(QMessageBox::Warning);

    int ret = msgBox.exec(&#41;;
    

    //....
    @

    I hope it helps.



  • tnx
    OK now im using this but not fix!!!

    @
    QMessageBox msgBox;
    msgBox.setText("<b> The document has been modified.<\b>");
    msgBox.setInformativeText(" Do you want to save your changes? ");
    msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
    msgBox.setDefaultButton(QMessageBox::Save);
    msgBox.setIcon(QMessageBox::Warning);

    int ret = msgBox.exec&#40;&#41;;
    

    @



  • I think it 's a bug related problem Qt Version 5.xxx

    I have a serious problem with the new version Qt
    When I use the standard dialogs, appears without a sounds in the dialogue were.
    How do I fix this problem ?



  • I fixed it!
    this bug existing on the new versions of qt for windows only (5.xxx).
    i not testing on others OS.
    When i using of qt version 4.8.5 with mingw 4.40 don't have any problem. but when i using the last and new versions of qt on windows XP or 7 This problem occurs.


  • Moderators

    I can reproduce it with Qt 5.1.1. This seems to be a regression. Please report it at https://bugreports.qt-project.org so it can be fixed in the next release.


Log in to reply
 

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