The QRadioTuner class provides an interface to the systems analog radio device. 更多...
| 頭: | #include <QRadioTuner> |
| qmake: | QT += multimedia |
| 繼承: | QMediaObject |
| enum | Band { AM, FM, SW, LW, FM2 } |
| enum | Error { NoError, ResourceError, OpenError, OutOfRangeError } |
| enum | SearchMode { SearchFast, SearchGetStationId } |
| enum | State { ActiveState, StoppedState } |
| enum | StereoMode { ForceStereo, ForceMono, Auto } |
|
| QRadioTuner (QObject * parent = nullptr) | |
| virtual | ~QRadioTuner () |
| QRadioTuner::Band | band () const |
| QRadioTuner::Error | error () const |
| QString | errorString () const |
| int | frequency () const |
| QPair<int, int> | frequencyRange (QRadioTuner::Band band ) const |
| int | frequencyStep (QRadioTuner::Band band ) const |
| bool | isAntennaConnected () const |
| bool | isBandSupported (QRadioTuner::Band band ) const |
| bool | isMuted () const |
| bool | isSearching () const |
| bool | isStereo () const |
| QRadioData * | radioData () const |
| void | setStereoMode (QRadioTuner::StereoMode mode ) |
| int | signalStrength () const |
| QRadioTuner::State | state () const |
| QRadioTuner::StereoMode | stereoMode () const |
| int | volume () const |
| virtual QMultimedia::AvailabilityStatus | availability () const override |
| void | cancelSearch () |
| void | searchAllStations (QRadioTuner::SearchMode searchMode = QRadioTuner::SearchFast) |
| void | searchBackward () |
| void | searchForward () |
| void | setBand (QRadioTuner::Band band ) |
| void | setFrequency (int frequency ) |
| void | setMuted (bool muted ) |
| void | setVolume (int volume ) |
| void | start () |
| void | stop () |
| void | antennaConnectedChanged (bool connectionStatus ) |
| void | bandChanged (QRadioTuner::Band band ) |
| void | error (QRadioTuner::Error error ) |
| void | frequencyChanged (int frequency ) |
| void | mutedChanged (bool muted ) |
| void | searchingChanged (bool searching ) |
| void | signalStrengthChanged (int strength ) |
| void | stateChanged (QRadioTuner::State state ) |
| void | stationFound (int frequency , QString stationId ) |
| void | stereoStatusChanged (bool stereo ) |
| void | volumeChanged (int volume ) |
| const QMetaObject | staticMetaObject |
The QRadioTuner class provides an interface to the systems analog radio device.
You can control the systems analog radio device using this interface, for example:
radio = new QRadioTuner; connect(radio, SIGNAL(frequencyChanged(int)), this, SLOT(freqChanged(int))); if (radio->isBandSupported(QRadioTuner::FM)) { radio->setBand(QRadioTuner::FM); radio->setFrequency(yourRadioStationFrequency); radio->setVolume(100); radio->start(); }
The radio object will emit signals for any changes in state such as: bandChanged (), frequencyChanged (), stereoStatusChanged (), searchingChanged (), signalStrengthChanged (), volumeChanged (), mutedChanged ().
You can change between the frequency bands using setBand () however it is recommended that you check to make sure the band is available first using isBandSupported ().
另請參閱 QRadioData and 無綫電概述 .
Enumerates radio frequency bands.
| 常量 | 值 | 描述 |
|---|---|---|
QRadioTuner::AM
|
0
|
520 to 1610 kHz, 9 or 10kHz channel spacing, extended 1610 to 1710 kHz |
QRadioTuner::FM
|
1
|
87.5 to 108.0 MHz, except Japan 76-90 MHz |
QRadioTuner::SW
|
2
|
1.711 to 30.0 MHz, divided into 15 bands. 5kHz channel spacing |
QRadioTuner::LW
|
3
|
148.5 to 283.5 kHz, 9kHz channel spacing (Europe, Africa, Asia) |
QRadioTuner::FM2
|
4
|
range not defined, used when area supports more than one FM range. |
Enumerates radio tuner error conditions.
| 常量 | 值 | 描述 |
|---|---|---|
QRadioTuner::NoError
|
0
|
沒有齣現錯誤。 |
QRadioTuner::ResourceError
|
1
|
There is no radio service available. |
QRadioTuner::OpenError
|
2
|
Unable to open radio device. |
QRadioTuner::OutOfRangeError
|
3
|
An attempt to set a frequency or band that is not supported by radio device. |
Enumerates how the radio tuner should search for stations.
| 常量 | 值 | 描述 |
|---|---|---|
QRadioTuner::SearchFast
|
0
|
Use only signal strength when searching. |
QRadioTuner::SearchGetStationId
|
1
|
After finding a strong signal, wait for the RDS station id (PI) before continuing. |
Enumerates radio tuner states.
| 常量 | 值 | 描述 |
|---|---|---|
QRadioTuner::ActiveState
|
0
|
The tuner is started and active. |
QRadioTuner::StoppedState
|
1
|
The tuner device is stopped. |
Enumerates radio tuner policy for receiving stereo signals.
| 常量 | 值 | 描述 |
|---|---|---|
QRadioTuner::ForceStereo
|
0
|
Provide stereo mode, converting if required. |
QRadioTuner::ForceMono
|
1
|
Provide mono mode, converting if required. |
QRadioTuner::Auto
|
2
|
Uses the stereo mode matching the station. |
This property holds whether there is an antenna connected
訪問函數:
| bool | isAntennaConnected () const |
通知程序信號:
| void | antennaConnectedChanged (bool connectionStatus ) |
This property holds the frequency band a radio tuner is tuned to.
訪問函數:
| QRadioTuner::Band | band () const |
| void | setBand (QRadioTuner::Band band ) |
通知程序信號:
| void | bandChanged (QRadioTuner::Band band ) |
另請參閱 QRadioTuner::Band .
This property holds the frequency in Hertz a radio tuner is tuned to.
訪問函數:
| int | frequency () const |
| void | setFrequency (int frequency ) |
通知程序信號:
| void | frequencyChanged (int frequency ) |
This property holds whether a radio tuner's audio output is muted.
訪問函數:
| bool | isMuted () const |
| void | setMuted (bool muted ) |
通知程序信號:
| void | mutedChanged (bool muted ) |
holds an instance of QRadioData
The instance of QRadioData is already bound to this instance of QRadioTuner .
訪問函數:
| QRadioData * | radioData () const |
This property holds whether a radio tuner is currently scanning for a signal.
訪問函數:
| bool | isSearching () const |
通知程序信號:
| void | searchingChanged (bool searching ) |
另請參閱 searchForward (), searchBackward (),和 cancelSearch ().
This property holds the strength of the current radio signal as a percentage.
訪問函數:
| int | signalStrength () const |
通知程序信號:
| void | signalStrengthChanged (int strength ) |
Return the current radio tuner state.
訪問函數:
| QRadioTuner::State | state () const |
通知程序信號:
| void | stateChanged (QRadioTuner::State state ) |
另請參閱 QRadioTuner::State .
This property holds whether a radio tuner is receiving a stereo signal.
訪問函數:
| bool | isStereo () const |
通知程序信號:
| void | stereoStatusChanged (bool stereo ) |
This property holds the stereo mode of a radio tuner.
訪問函數:
| QRadioTuner::StereoMode | stereoMode () const |
| void | setStereoMode (QRadioTuner::StereoMode mode ) |
This property holds the volume of a radio tuner's audio output as a percentage.
訪問函數:
| int | volume () const |
| void | setVolume (int volume ) |
通知程序信號:
| void | volumeChanged (int volume ) |
Constructs a radio tuner based on a media service allocated by the default media service provider.
The parent 被傳遞給 QMediaObject .
[虛擬]
QRadioTuner::
~QRadioTuner
()
Destroys a radio tuner.
[override virtual]
QMultimedia::AvailabilityStatus
QRadioTuner::
availability
() const
重實現自 QMediaObject::availability ().
Returns the availability of the radio tuner.
[signal]
void
QRadioTuner::
bandChanged
(
QRadioTuner::Band
band
)
Signals a radio tuner's band 已改變。
注意: 通知程序信號對於特性 band .
[slot]
void
QRadioTuner::
cancelSearch
()
Stops scanning for a signal.
另請參閱 searchForward (), searchBackward (),和 searching .
Returns the error state of a radio tuner.
另請參閱 errorString ().
[signal]
void
QRadioTuner::
error
(
QRadioTuner::Error
error
)
發射信號,當 error 齣現。
注意: 信號 error 在此類中被重載。通過使用函數指針句法連接到此信號,Qt 提供用於獲得如此範例展示的函數指針的方便幫助程序:
connect(radioTuner, QOverload<QRadioTuner::Error>::of(&QRadioTuner::error), [=](QRadioTuner::Error error){ /* ... */ });
Returns a description of a radio tuner's error state.
另請參閱 error ().
[signal]
void
QRadioTuner::
frequencyChanged
(
int
frequency
)
發射信號,當 frequency a radio tuner is tuned to has changed.
注意: 通知程序信號對於特性 frequency .
Returns a frequency band 's minimum and maximum frequency.
Returns the number of Hertz to increment the frequency by when stepping through frequencies within a given band .
Identifies if a frequency band is supported by a radio tuner.
Returns true if the band is supported, and false if it is not.
[signal]
void
QRadioTuner::
mutedChanged
(
bool
muted
)
發射信號,當 muted state of a radio tuner's audio output has changed.
注意: 通知程序信號對於特性 muted .
[slot]
void
QRadioTuner::
searchAllStations
(
QRadioTuner::SearchMode
searchMode
= QRadioTuner::SearchFast)
Search all stations in current band
Emits QRadioTuner::stationFound (int, QString ) for every found station. After searching is completed, QRadioTuner::searchingChanged (bool) is emitted (false). If searchMode 被設為 SearchGetStationId , searching waits for station id (PI) on each frequency.
另請參閱 searchForward (), searchBackward (),和 searching .
[slot]
void
QRadioTuner::
searchBackward
()
Starts a backwards scan for a signal, starting from the current frequency .
另請參閱 searchForward (), cancelSearch (),和 searching .
[slot]
void
QRadioTuner::
searchForward
()
Starts a forward scan for a signal, starting from the current frequency .
另請參閱 searchBackward (), cancelSearch (),和 searching .
[signal]
void
QRadioTuner::
searchingChanged
(
bool
searching
)
發射信號,當 searching state of a radio tuner has changed.
注意: 通知程序信號對於特性 searching .
[slot]
void
QRadioTuner::
setBand
(
QRadioTuner::Band
band
)
Sets a radio tuner's frequency band .
Changing the band will reset the frequency to the new band's minimum frequency.
注意: setter 函數對於特性 band .
另請參閱 band ().
[slot]
void
QRadioTuner::
setFrequency
(
int
frequency
)
Sets a radio tuner's frequency .
If the tuner is set to a frequency outside the current band , the band will be changed to one occupied by the new frequency.
注意: setter 函數對於特性 frequency .
另請參閱 frequency ().
[signal]
void
QRadioTuner::
signalStrengthChanged
(
int
strength
)
發射信號,當 strength of the signal received by a radio tuner has changed.
注意: 通知程序信號對於特性 signalStrength .
[slot]
void
QRadioTuner::
start
()
Activate the radio device.
[signal]
void
QRadioTuner::
stateChanged
(
QRadioTuner::State
state
)
This signal is emitted when the state changes to state .
注意: 通知程序信號對於特性 state .
[signal]
void
QRadioTuner::
stationFound
(
int
frequency
,
QString
stationId
)
Signals that a station was found in frequency with stationId Program Identification code.
[signal]
void
QRadioTuner::
stereoStatusChanged
(
bool
stereo
)
發射信號,當 stereo state of a radio tuner has changed.
注意: 通知程序信號對於特性 stereo .
[slot]
void
QRadioTuner::
stop
()
Deactivate the radio device.
[signal]
void
QRadioTuner::
volumeChanged
(
int
volume
)
發射信號,當 volume of a radio tuner's audio output has changed.
注意: 通知程序信號對於特性 volume .