[SOLVED] QApplication::beep() - no sound on linux
-
@_rth_ Maybe QSound needs some extra Qt libraries.
Anyway, try using XBell.
I.e.:
#include <X11/Xlib.h> int main(int argc, char** argv) { Display *display=XOpenDisplay(NULL); XBell(display, 1000); XFlush(display); }
You will need to link X11 library:
gcc xbell.cpp -lX11
-
@_rth_ You have more information about XBell In this page:
https://bugzilla.redhat.com/show_bug.cgi?id=607393
But in any case, if your code is working in Windows and not in Linux, I think is a problem with Linux more than Qt.
My last recommendation is to use your more suitable solution among the following ones:
-
QMediaPlayer works (at least on Debian 7.8).
QMediaPlayer player; ... //player.setMedia(QUrl::fromLocalFile("/usr/share/sounds/gnome/default/alerts/bark.ogg")); //player.setMedia(QUrl::fromLocalFile("/usr/share/sounds/gnome/default/alerts/drip.ogg")); //player.setMedia(QUrl::fromLocalFile("/usr/share/sounds/gnome/default/alerts/glass.ogg")); //player.setMedia(QUrl::fromLocalFile("/usr/share/sounds/gnome/default/alerts/sonar.ogg")); player.setMedia(QUrl::fromLocalFile("/usr/share/sounds/freedesktop/stereo/bell.oga")); //this seems to be default alert player.setVolume(50); ... player.play();
-
-