Qt alarm sound settings

Function description : When the node display exceeds the threshold, the column on the interface turns red, a certain number of a node in red font is printed in the textedit, and the computer emits a warning sound.

Query Help Assistant

Alarm sound solution one :

void QApplication::beep () [static]

Sounds the bell, using the default volume and sound. The function is not available in Qt for Embedded Linux.

Meaning: use the default volume and sound to ring the bell, but this feature does not work with QT embedded in Linux

Alarm sound solution two :

#include <QSound>

Public Functions: (function function)

QSound ( const QString & filename, QObject * parent = 0 )
~QSound ()
QString fileName () const
bool isFinished () const
int loops () const
int loopsRemaining () const

void setLoops ( int number )

Public Slots:(槽)
void play ()
void stop ()

Use example:

1) QSound::play("mysounds/bells.wav");

2) QSound bells("mysounds/bells.wav");

      bells.play();

A record of learning, once used and written, will be learned in the future, and will no longer be at a loss.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324768448&siteId=291194637