diff options
Diffstat (limited to 'examples/multimedia/declarative-radio/view.qml')
-rw-r--r-- | examples/multimedia/declarative-radio/view.qml | 140 |
1 files changed, 41 insertions, 99 deletions
diff --git a/examples/multimedia/declarative-radio/view.qml b/examples/multimedia/declarative-radio/view.qml index ef7b65d99..ab173a737 100644 --- a/examples/multimedia/declarative-radio/view.qml +++ b/examples/multimedia/declarative-radio/view.qml @@ -52,7 +52,16 @@ import QtQuick 2.0 import QtMultimedia 5.0 Rectangle { - width: 400; height: 300; + anchors.fill: parent + id: root + property int margins: 5 + property int spacing: 10 + + QtObject { + id: d + property int buttonHeight: root.height > root.width ? root.width / 3 : root.height / 3 + property int buttonWidth: (root.width - spacing * 4) / 4 + } Radio { id: radio @@ -61,25 +70,30 @@ Rectangle { Column { anchors.fill: parent - anchors.margins: 5 - spacing: 5 + anchors.margins: root.margins - Row { + Rectangle { + color: root.color + width: parent.width + height: root.height - d.buttonHeight - 40 Text { id: freq - - width: 150 - height: 200 - verticalAlignment: Text.AlignVCenter text: "" + radio.frequency / 1000 + " kHz" + anchors { + bottom: parent.bottom + margins: root.margins + } } Text { id: sig + anchors { + bottom: parent.bottom + right: parent.right + margins: root.margins - width: 200 - height: 200 + } verticalAlignment: Text.AlignVCenter text: (radio.availability == Radio.Available ? "No Signal " : "No Radio Found") @@ -90,112 +104,40 @@ Rectangle { spacing: 5 Rectangle { - width: 350 - height: 10 - + width: root.width - 10 + height: 20 color: "black" Rectangle { width: 5 - height: 10 + height: 20 color: "red" y: 0 x: (parent.width - 5) * ((radio.frequency - radio.minimumFrequency) / (radio.maximumFrequency - radio.minimumFrequency)) - } } } - - Row { - spacing: 5 - - Rectangle { - id: scanDownButton - border.color: "black" - border.width: 1 - radius: 2 - - width: 90 - height: 40 - - Text { - anchors.fill: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - text: "Scan Down" - } - - MouseArea { - anchors.fill: parent - onClicked: radio.scanDown(); - } + spacing: root.spacing + Button { + text: "Scan Down" + onClicked: radio.scanDown() } - Rectangle { - id: freqDownButton - border.color: "black" - border.width: 1 - radius: 2 - - width: 90 - height: 40 - - Text { - anchors.fill: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - text: "Freq Down" - } - - MouseArea { - anchors.fill: parent - onClicked: radio.tuneDown(); - } + Button { + text: "Freq Down" + onClicked: radio.tuneDown() } - Rectangle { - id: freqUpButton - border.color: "black" - border.width: 1 - radius: 2 - - width: 90 - height: 40 - - Text { - anchors.fill: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - text: "Freq Up" - } - - MouseArea { - anchors.fill: parent - onClicked: radio.tuneUp(); - } + Button { + text: "Freq Up" + onClicked: radio.tuneUp() } - Rectangle { - id: scanUpButton - border.color: "black" - border.width: 1 - radius: 2 - - width: 90 - height: 40 - - Text { - anchors.fill: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - text: "Scan Up" - } - - MouseArea { - anchors.fill: parent - onClicked: radio.scanUp(); - } + Button { + text: "Scan Up" + onClicked: radio.scanUp() } } } } + |