2 * Copyright (C) 2016 The Qt Company Ltd.
3 * Copyright (c) 2018 TOYOTA MOTOR CORPORATION
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 import QtQuick.Controls 2.0
19 import QtGraphicalEffects 1.0
25 property string icon: model.icon
37 anchors.top: parent.top
39 anchors.horizontalCenter: parent.horizontalCenter
42 source: './images/%1_%2.svg'.arg(model.icon).arg(loc.pressed && (loc.index === model.index || loc.currentId === model.id) ? 'active' : 'inactive')
43 antialiasing: item.state !== ''
45 property string initial: model.name.substring(0,1).toUpperCase()
51 anchors.centerIn: parent
58 anchors.centerIn: parent
59 anchors.horizontalCenterOffset: model.index / 3 - 1
60 anchors.verticalCenterOffset: model.index % 3 - 1
63 model: main.icon === 'blank' ? 9 : 0
66 layer.effect: LinearGradient {
68 GradientStop { position: -0.5; color: "#6BFBFF" }
69 GradientStop { position: +1.5; color: "#00ADDC" }
76 anchors.top: item.bottom
77 anchors.left: parent.left
78 anchors.right: parent.right
82 wrapMode: Text.WordWrap
83 horizontalAlignment: Text.AlignHCenter
85 text: qsTr(model.name.toUpperCase())
88 Behavior on x { enabled: item.state !== 'active'; NumberAnimation { duration: 400; easing.type: Easing.OutCubic } }
89 Behavior on y { enabled: item.state !== 'active'; NumberAnimation { duration: 400; easing.type: Easing.OutCubic } }
90 SequentialAnimation on rotation {
91 NumberAnimation { to: 5; duration: 100 }
92 NumberAnimation { to: -5; duration: 200 }
93 NumberAnimation { to: 0; duration: 100 }
94 running: loc.currentId !== '' && item.state !== 'active'
95 loops: Animation.Infinite; alwaysRunToEnd: true
100 when: loc.currentId === model.id
103 x: loc.mouseX - width/2
104 y: loc.mouseY - height/2
110 when: loc.currentId !== ''
118 transitions: Transition { NumberAnimation { properties: 'scale, opacity, x, y'; duration: 150; easing.type: Easing.OutCubic} }