C

Qt Quick Ultralite Thermostat Demo

/****************************************************************************** ** ** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/
import QtQuick 2.15 import QtQuickUltralite.Extras 1.2 import Thermo 1.0 Rectangle { id: dialog color: "#88000000" visible: false opacity: 0 SequentialAnimation { id: showAnimation alwaysRunToEnd: true ScriptAction { script: dialog.visible = true } PropertyAnimation { target: dialog; property: "opacity"; from: 0.0; to: 1.0 } } SequentialAnimation { id: hideAnimation alwaysRunToEnd: true PropertyAnimation { target: dialog; property: "opacity"; from: 1.0; to: 0.0 } ScriptAction { script: dialog.visible = false } } Behavior on opacity { NumberAnimation{} } function hide() { hideAnimation.running = true } function show() { showAnimation.running = true } MouseArea { anchors.fill: parent } Image { id: background source: "popup-bg.png" anchors.centerIn: parent Item { id: titleBar height: Theme.dialogBarHeight width: background.width ColorizedImage { id: close anchors { verticalCenter: parent.verticalCenter; topMargin: 22; right: parent.right; rightMargin: Theme.dialogRightMargin } source: "close.png" color: ColorStyle.greyDark4 } MouseArea { anchors { fill: close; margins: -15 } onClicked: { dialog.hide() } } Text { id: title text: qsTr("Language Settings") anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: Theme.dialogLeftMargin } font.pixelSize: Theme.topBarFontSize font.family: "Roboto" } } Column { anchors { verticalCenter: parent.verticalCenter verticalCenterOffset: titleBar.height / 2 left: titleBar.left leftMargin: Theme.dialogLeftMargin } // No ButtonGroup yet so exclusive checking is implemented manualy LanguageButton { id: english text: "English" flag: "UK.png" checked: Qt.uiLanguage == "" enabled: !checked onCheckedChanged: { if (checked) { Qt.uiLanguage = "" german.checked = false japanese.checked = false } } } LanguageButton { id: german text: "Deutsch" checked: Qt.uiLanguage == "de_DE" enabled: !checked flag: "GERMANY.png" onCheckedChanged: { if (checked) { english.checked = false japanese.checked = false Qt.uiLanguage = "de_DE" } } } LanguageButton { id: japanese text: "日本語" checked: Qt.uiLanguage == "ja_JP" enabled: !checked flag: "JAPAN.png" onCheckedChanged: { if (checked) { english.checked = false german.checked = false Qt.uiLanguage = "ja_JP" } } } } } }