RadioThe Radio type allows you to access radio functionality from a QML application. More... Inherits Item Properties
Signals
Methods
Detailed DescriptionRadio is part of the QtMultimedia 5.0 module. import QtQuick 2.0 import QtMultimedia 5.0 Rectangle { width: 320 height: 480 Radio { id: radio band: Radio.FM } MouseArea { x: 0; y: 0 height: parent.height width: parent.width / 2 onClicked: radio.scanDown() } MouseArea { x: parent.width / 2; y: 0 height: parent.height width: parent.width / 2 onClicked: radio.scanUp() } } You can use Radio to tune the radio and get information about the signal. You can also use the Radio to get information about tuning, for instance the frequency steps supported for tuning. The corresponding RadioData gives RDS information about the current radio station. The best way to access the RadioData for the current Radio is to use the radioData property. See also Radio Overview. Property DocumentationThis property is true if there is an antenna connected. Otherwise it will be false. Returns the availability state of the radio. This is one of:
This property holds the frequency band used for the radio, which can be specified as any one of the values in the table below.
Sets the frequency in Hertz that the radio is tuned to. The frequency must be within the frequency range for the current band, otherwise it will be changed to be within the frequency range. See also maximumFrequency and minimumFrequency. The number of Hertz for each step when tuning the radio manually. The value is for the current band. This property reflects whether the radio is muted or not. This property is true if the radio is currently searching for radio stations, for instance using the scanUp, scanDown, and searchAllStations methods. Once the search completes, or if it is cancelled using cancelScan, this property will be false. The strength of the current radio signal as a percentage where 0% equals no signal, and 100% is a very good signal. This property holds whether the radio is receiving a stereo signal or not. If stereoMode is set to ForceMono the value will always be false. Likewise, it will always be true if stereoMode is set to ForceStereo. See also stereoMode. This property holds the stereo mode of the radio, which can be set to any one of the values in the table below.
Set this property to control the volume of the radio. The valid range of the volume is from 0 to 100. Signal DocumentationThis signal is emitted when a new radio station is found. This signal is only emitted if searchAllStations is called with SearchGetStationId. The frequency is returned in Hertz, and the stationId corresponds to the station Id in the RadioData for this radio station. Method DocumentationCancel the current scan. Will also cancel a search started with searchAllStations. Start searching the complete frequency range for the current band, and save all the radio stations found. The search mode can be either of the values described in the table below.
The snippet below uses searchAllStations with SearchGetStationId to receive all the radio stations in the current band, and store them in a ListView. The station Id is shown to the user and if the user presses a station, the radio is tuned to this station. Item { width: 640 height: 360 Radio { id: radio onStationFound: radioStations.append({"frequency": frequency, "stationId": stationId}) } ListModel { id: radioStations } ListView { model: radioStations delegate: Rectangle { MouseArea { anchors.fill: parent onClicked: radio.frequency = frequency } Text { anchors.fill: parent text: stationId } } } Rectangle { MouseArea { anchors.fill: parent onClicked: radio.searchAllStations(Radio.SearchGetStationId) } } } Starts the radio. If the radio is available, as determined by the availability property, this will result in the state becoming ActiveState. Stops the radio. After calling this method the state will be StoppedState. Decrements the frequency by the frequency step for the current band. If the frequency is already set to the minimum frequency, calling this function has no effect. See also band, frequencyStep, and minimumFrequency. Increments the frequency by the frequency step for the current band. If the frequency is already set to the maximum frequency, calling this function has no effect. See also band, frequencyStep, and maximumFrequency. |