X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=homescreen%2Fqml%2Fmain.qml;h=10509fd78564da7dab4c20b6277526da66a76793;hb=fabcb8148b8032f4f8d04523e2f24cf8debe477f;hp=13500bd7542c675fd0ae1ff2f1e9522d8cde6d4e;hpb=c5aad6f23f523bf44bf58419bb2fc41262be2180;p=apps%2Fhomescreen.git diff --git a/homescreen/qml/main.qml b/homescreen/qml/main.qml index 13500bd..10509fd 100644 --- a/homescreen/qml/main.qml +++ b/homescreen/qml/main.qml @@ -134,38 +134,44 @@ Window { Item { id: switchBtn + width: 110 + height: 110 anchors.right: parent.right - anchors.rightMargin: 20 anchors.top: parent.top - anchors.topMargin: 5 - width: 55 - height: 55 z: 1 + Image { + id: image + width: 55 + height: 55 + anchors.right: parent.right + anchors.rightMargin: 20 + anchors.top: parent.top + anchors.topMargin: 5 + source: './images/normal.png' + } MouseArea { anchors.fill: parent property string btnState: 'normal' - Image { - id: image - anchors.fill: parent - source: './images/normal.png' - } onClicked: { - if (btnState === 'normal') { - image.source = './images/fullscreen.png' - btnState = 'fullscreen' - container.state = 'fullscreen' - container.opacity = 0.0 - touchArea.switchArea(1) - + if (container.state === 'normal') { + turnToFullscreen() } else { - image.source = './images/normal.png' - btnState = 'normal' - container.state = 'normal' - container.opacity = 1.0 - touchArea.switchArea(0) + turnToNormal() } } } } + function turnToFullscreen() { + image.source = './images/fullscreen.png' + container.state = 'fullscreen' + container.opacity = 0.0 + touchArea.switchArea(1) + } + function turnToNormal() { + image.source = './images/normal.png' + container.state = 'normal' + container.opacity = 1.0 + touchArea.switchArea(0) + } }