You cannot do it directly in Qt. If you are on Windows, you can use window.h package to do that Beep(frequency, milliseconds)
However, in Qt, there are several other ways in which you can manipulate the sound. Answered here
#define FREQ_CONST ((2.0 * M_PI) / SAMPLE_RATE)
QByteArray* bytebuf = new QByteArray();
buf->resize(seconds * SAMPLE_RATE);
for (int i=0; i<(seconds * SAMPLE_RATE); i++) {
qreal t = (qreal)(freq * i);
t = t * FREQ_CONST;
t = qSin(t);
// now we normalize t
t *= TG_MAX_VAL;
(*bytebuf)[i] = (quint8)t;
}
Then we can take that buffer and do something like this to play it:
// Make a QBuffer from our QByteArray
QBuffer* input = new QBuffer(bytebuf);
input->open(QIODevice::ReadOnly);
// Create an output with our premade QAudioFormat (See example in QAudioOutput)
QAudioOutput* audio = new QAudioOutput(format, this);
audio->start(input);