PDA

View Full Version : QMessageBox sound



wirasto
29th September 2010, 22:53
I tried make a messagebox like this


QMessageBox msg(this);
msg.setIcon(QMessageBox::Critical);
msg.setWindowTitle("Error");
msg.setText("Message");
msg.setDetailedText("Detail");
msg.addButton("OK", QMessageBox::RejectRole);
msg.exec();

But, why I lost critical message sound ??

wysota
29th September 2010, 22:54
Because you are using the Qt message box that doesn't make sounds instead of the native message box that is used when you use static methods of QMessageBox.

wirasto
29th September 2010, 23:00
I need make with dinamic way, not static. How to set the sound ? I look in the Qt doc, there is nothing to set a sound on QMessageBox..

wysota
30th September 2010, 00:55
Widgets don't make sounds.

SixDegrees
30th September 2010, 06:49
Not automatically, anyway. If you want to have a sound accompany the appearance of your widget, you'll have to arrange for that yourself. And if you want the sound to be one of the system sounds, you'll have to figure out how they're organized and stored, and how to access them reliably; they're managed by whatever desktop system you're using.

Or, you can simply settle for the static calls, which already make use of a native widget.