Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.4.1
-
None
-
-
70ce4a4d4 (dev), 6635bf85b (tqtc/lts-6.2), b93b9054f (6.4)
-
DaVinci 68
Description
In https://doc.qt.io/qt-6/qaudiodevice.html#details, the example showing how to enumerate all audio output devices contains the following code snippet:
const auto deviceInfos = QMediaDevices::availableDevices(QAudioDevice::Output); for (const QAudioDevice &deviceInfo : deviceInfos) qDebug() << "Device: " << deviceInfo.description();
This is not correct and appears to be a remnant of the Qt5 QAudioDeviceInfo API.
QMediaDevices does not have an "availableDevices" method. The correct example should be:
const auto deviceInfos = QMediaDevices::audioOutputs(); for (const QAudioDevice &deviceInfo : deviceInfos) qDebug() << "Device: " << deviceInfo.description();
It is especially important to get these examples correct because migrating QtMultimedia code from Qt5 to Qt6 is already fairly confusing as-is due to various reasons.
Minor note: The variables should probably be named "devices" and "device" as well, just for consistency's sake (another Qt5 remnant, where these were QAudioDeviceInfos instead of QAudioDevices).