Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
devices.cpp
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QAudioDevice>
5#include <QCameraDevice>
6#include <QMediaDevices>
7#include <QString>
8#include <QTextStream>
9
10int main(int argc, char *argv[])
11{
12 Q_UNUSED(argc);
13 Q_UNUSED(argv);
14
15 QTextStream out(stdout);
16
18 const QList<QAudioDevice> audioDevices = QMediaDevices::audioInputs();
19 for (const QAudioDevice &device : audioDevices)
20 {
21 out << "ID: " << device.id() << Qt::endl;
22 out << "Description: " << device.description() << Qt::endl;
23 out << "Is default: " << (device.isDefault() ? "Yes" : "No") << Qt::endl;
24 }
26
28 const QList<QCameraDevice> videoDevices = QMediaDevices::videoInputs();
29 for (const QCameraDevice &device : videoDevices)
30 {
31 out << "ID: " << device.id() << Qt::endl;
32 out << "Description: " << device.description() << Qt::endl;
33 out << "Is default: " << (device.isDefault() ? "Yes" : "No") << Qt::endl;
34 }
36
37 return 0;
38}
IOBluetoothDevice * device
The QAudioDevice class provides an information about audio devices and their functionality.
The QCameraDevice class provides general information about camera devices.
QList< QAudioDevice > audioInputs
\qmltype MediaDevices
QList< QCameraDevice > videoInputs
\qmlproperty list<cameraDevice> QtMultimedia::MediaDevices::videoInputs Contains a list of cameras on...
\inmodule QtCore
int main()
[0]
QTextStream & endl(QTextStream &stream)
Writes '\n' to the stream and flushes the stream.
#define Q_UNUSED(x)
QTextStream out(stdout)
[7]