In questa pagina

QLightSensor Class

La classe QLightSensor è un wrapper di comodità che avvolge QSensor. Per saperne di più...

Intestazione: #include <QLightSensor>
CMake: find_package(Qt6 REQUIRED COMPONENTS Sensors)
target_link_libraries(mytarget PRIVATE Qt6::Sensors)
qmake: QT += sensors
Eredita da: QSensor

Proprietà

Funzioni pubbliche

QLightSensor(QObject *parent = nullptr)
virtual ~QLightSensor()
qreal fieldOfView() const
QLightReading *reading() const
void setFieldOfView(qreal fieldOfView)

Segnali

void fieldOfViewChanged(qreal fieldOfView)

Descrizione dettagliata

L'unica differenza comportamentale è che questa classe imposta correttamente il tipo.

Questa classe dispone inoltre di una funzione reading() che restituisce un QLightReading invece di un QSensorReading.

Per i dettagli sul funzionamento del sensore, vedere QLightReading.

Vedi anche QLightReading.

Documentazione sulle proprietà

[read-only] fieldOfView : qreal

Questa proprietà contiene un valore che indica il campo visivo.

Si tratta di un angolo che rappresenta il campo visivo del sensore.

Non tutti i sensori di luce supportano il recupero del proprio campo visivo. Per i sensori che non supportano questa proprietà, il valore sarà 0. È possibile verificare se il campo visivo è supportato utilizzando la funzione QSensor::isFeatureSupported() e il flag QSensor::FieldOfView.

Funzioni di accesso:

qreal fieldOfView() const

Segnale di notifica:

void fieldOfViewChanged(qreal fieldOfView)

Documentazione delle funzioni membro

[explicit] QLightSensor::QLightSensor(QObject *parent = nullptr)

Crea il sensore come elemento figlio di parent.

[virtual noexcept] QLightSensor::~QLightSensor()

Distruggi il sensore. Arresta il sensore, se non è già stato arrestato.

QLightReading *QLightSensor::reading() const

Restituisce la classe di lettura per questo sensore.

Vedi anche QSensor::reading().

void QLightSensor::setFieldOfView(qreal fieldOfView)

Imposta il campo visivo su fieldOfView. Questa operazione deve essere eseguita dal backend.

Vedi anche fieldOfView().

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.