From 9b88a6776212820079c62b11304546b7028a3585 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Mon, 31 May 2021 12:46:41 +0200 Subject: Port remaining examples to use QtQuick Controls 2 Change-Id: Ia3e1930220dfb35da4b3d5b77a4d4a70d3cc80e3 Reviewed-by: Robert Griebl --- examples/ivimedia/mediaplayer/main.qml | 2 +- examples/ivimedia/tuner/main.qml | 18 ++++++++++++------ examples/ivivehiclefunctions/climate_qml/main.qml | 15 +++++++++------ .../ivivehiclefunctions/window_qml/WindowItem.qml | 19 +++++++++---------- examples/ivivehiclefunctions/window_qml/main.qml | 22 ++++++++++++++-------- 5 files changed, 45 insertions(+), 31 deletions(-) (limited to 'examples') diff --git a/examples/ivimedia/mediaplayer/main.qml b/examples/ivimedia/mediaplayer/main.qml index 1abe5b3..9331b09 100644 --- a/examples/ivimedia/mediaplayer/main.qml +++ b/examples/ivimedia/mediaplayer/main.qml @@ -52,7 +52,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls 1.5 +import QtQuick.Controls 2.15 import QtQuick.Layouts 1.1 import QtIvi 1.0 import QtIvi.Media 1.0 diff --git a/examples/ivimedia/tuner/main.qml b/examples/ivimedia/tuner/main.qml index 830531c..24053ad 100644 --- a/examples/ivimedia/tuner/main.qml +++ b/examples/ivimedia/tuner/main.qml @@ -52,7 +52,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls 1.5 +import QtQuick.Controls 2.15 import QtQuick.Layouts 1.1 import QtIvi 1.0 import QtIvi.Media 1.0 @@ -67,7 +67,7 @@ ApplicationWindow { AmFmTuner { id: tuner - band: bandGroup.current.text === "AM" ? AmFmTuner.AMBand : AmFmTuner.FMBand + band: bandGroup.checkedButton.text === "AM" ? AmFmTuner.AMBand : AmFmTuner.FMBand onScanStarted: { console.log("A Station SCAN has been started") @@ -98,8 +98,8 @@ ApplicationWindow { RowLayout { Label { text: "Band:" } - RadioButton { text: "AM"; exclusiveGroup: bandGroup; checked: tuner.band === AmFmTuner.AMBand } - RadioButton { text: "FM"; exclusiveGroup: bandGroup; checked: tuner.band === AmFmTuner.FMBand } + RadioButton { text: "AM"; ButtonGroup.group: bandGroup; checked: tuner.band === AmFmTuner.AMBand } + RadioButton { text: "FM"; ButtonGroup.group: bandGroup; checked: tuner.band === AmFmTuner.FMBand } } GroupBox { @@ -122,7 +122,7 @@ ApplicationWindow { } } - ExclusiveGroup { + ButtonGroup { id: bandGroup } @@ -159,6 +159,10 @@ ApplicationWindow { } } + Item { + Layout.fillHeight: true + } + } //![2] @@ -224,7 +228,9 @@ ApplicationWindow { Connections { target: presetsModel - onCountChanged: addButton.checkExists() + function onCountChanged() { + addButton.checkExists() + } } } //![6] diff --git a/examples/ivivehiclefunctions/climate_qml/main.qml b/examples/ivivehiclefunctions/climate_qml/main.qml index 737b99e..3a26d10 100644 --- a/examples/ivivehiclefunctions/climate_qml/main.qml +++ b/examples/ivivehiclefunctions/climate_qml/main.qml @@ -52,10 +52,9 @@ ****************************************************************************/ import QtQuick 2.4 -import QtQuick.Controls 1.3 +import QtQuick.Controls 2.15 import QtQuick.Window 2.2 import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.2 import QtIvi.VehicleFunctions 1.0 @@ -68,7 +67,7 @@ ApplicationWindow { //![1] ClimateControl { id: climateControl - discoveryMode: AbstractFeature.LoadOnlySimulationBackends + discoveryMode: ClimateControl.LoadOnlySimulationBackends } //![1] @@ -285,11 +284,15 @@ ApplicationWindow { } } - MessageDialog { + Dialog { id: messageDialog + anchors.centerIn: parent title: "Auto Discovery Failed !" - text: "No Climate Backend available" - icon: StandardIcon.Critical + standardButtons: Dialog.Ok + + Label { + text: "No Climate Backend available" + } } //![4] diff --git a/examples/ivivehiclefunctions/window_qml/WindowItem.qml b/examples/ivivehiclefunctions/window_qml/WindowItem.qml index 94be284..a164d25 100644 --- a/examples/ivivehiclefunctions/window_qml/WindowItem.qml +++ b/examples/ivivehiclefunctions/window_qml/WindowItem.qml @@ -52,10 +52,9 @@ ****************************************************************************/ import QtQuick 2.4 -import QtQuick.Controls 1.3 +import QtQuick.Controls 2.15 import QtQuick.Window 2.2 import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.2 import QtIvi.VehicleFunctions 1.0 @@ -109,13 +108,13 @@ GroupBox { } } - ExclusiveGroup { + ButtonGroup { id: blindGroup } RadioButton { text: "Open" - exclusiveGroup: blindGroup + ButtonGroup.group: blindGroup checked: zone.blindMode === WindowControl.BlindOpen onCheckedChanged: { if (checked) @@ -125,7 +124,7 @@ GroupBox { RadioButton { text: "Closed" - exclusiveGroup: blindGroup + ButtonGroup.group: blindGroup checked: zone.blindMode === WindowControl.BlindClosed onCheckedChanged: { if (checked) @@ -135,7 +134,7 @@ GroupBox { RadioButton { text: "Automatic" - exclusiveGroup: blindGroup + ButtonGroup.group: blindGroup checked: zone.blindMode === WindowControl.AutoBlind onCheckedChanged: { if (checked) @@ -161,13 +160,13 @@ GroupBox { } } - ExclusiveGroup { + ButtonGroup { id: heaterGroup } RadioButton { text: "On" - exclusiveGroup: heaterGroup + ButtonGroup.group: heaterGroup checked: zone.heaterMode === WindowControl.HeaterOn onCheckedChanged: { if (checked) @@ -177,7 +176,7 @@ GroupBox { RadioButton { text: "Off" - exclusiveGroup: heaterGroup + ButtonGroup.group: heaterGroup checked: zone.heaterMode === WindowControl.HeaterOff onCheckedChanged: { if (checked) @@ -187,7 +186,7 @@ GroupBox { RadioButton { text: "Automatic" - exclusiveGroup: heaterGroup + ButtonGroup.group: heaterGroup checked: zone.heaterMode === WindowControl.AutoHeater onCheckedChanged: { if (checked) diff --git a/examples/ivivehiclefunctions/window_qml/main.qml b/examples/ivivehiclefunctions/window_qml/main.qml index f719047..2564e07 100644 --- a/examples/ivivehiclefunctions/window_qml/main.qml +++ b/examples/ivivehiclefunctions/window_qml/main.qml @@ -52,26 +52,28 @@ ****************************************************************************/ import QtQuick 2.4 -import QtQuick.Controls 1.3 +import QtQuick.Controls 2.15 import QtQuick.Window 2.2 import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.2 import QtIvi.VehicleFunctions 1.0 ApplicationWindow { title: "Window Control" visible: true + width: mainLayout.width + height: mainLayout.height WindowControl { id: windowControl - discoveryMode: AbstractFeature.LoadOnlySimulationBackends + discoveryMode: WindowControl.LoadOnlySimulationBackends } ColumnLayout { + id: mainLayout WindowItem { title: "Roof" - anchors.horizontalCenter: parent.horizontalCenter + Layout.alignment: Qt.AlignHCenter zone: windowControl.zoneAt.Roof } @@ -99,16 +101,20 @@ ApplicationWindow { WindowItem { title: "Rear" - anchors.horizontalCenter: parent.horizontalCenter + Layout.alignment: Qt.AlignHCenter zone: windowControl.zoneAt.Rear } } - MessageDialog { + Dialog { id: messageDialog + anchors.centerIn: parent title: "Auto Discovery Failed !" - text: "No WindowControl Backend available" - icon: StandardIcon.Critical + standardButtons: Dialog.Ok + + Label { + text: "No WindowControl Backend available" + } } Component.onCompleted: { -- cgit v1.2.1