Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. My Messagebox is silent i don't have sound

My Messagebox is silent i don't have sound

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 4.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    HADIIR
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      Yahara
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        HADIIR
        wrote on last edited by
        #3

        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;;
        

        @

        1 Reply Last reply
        0
        • H Offline
          H Offline
          HADIIR
          wrote on last edited by
          #4

          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 ?

          1 Reply Last reply
          0
          • H Offline
            H Offline
            HADIIR
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • Chris KawaC Offline
              Chris KawaC Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved