Code Review
/
apps
/
homescreen.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
horizontal
[apps/homescreen.git]
/
homescreen
/
qml
/
ShortcutIcon.qml
diff --git
a/homescreen/qml/ShortcutIcon.qml
b/homescreen/qml/ShortcutIcon.qml
index
6f8e05e
..
026db32
100644
(file)
--- a/
homescreen/qml/ShortcutIcon.qml
+++ b/
homescreen/qml/ShortcutIcon.qml
@@
-16,39
+16,59
@@
*/
import QtQuick 2.2
*/
import QtQuick 2.2
+import QtQuick.Controls 2.0
+import QtGraphicalEffects 1.0
MouseArea {
id: root
MouseArea {
id: root
- width:
195
- height:
216.8
+ width:
70
+ height:
70
property string name: 'Home'
property bool active: false
property string name: 'Home'
property bool active: false
- I
mage
{
+ I
tem
{
id: icon
id: icon
+ property real desaturation: 0
anchors.fill: parent
anchors.fill: parent
- source: './images/Shortcut/HMI_Shortcut_%1-01.png'.arg(root.name)
- }
- Image {
- anchors.fill: parent
- source: './images/Shortcut/HMI_Shortcut_%1_Active-01.png'.arg(root.name)
- opacity: 1.0 - icon.opacity
- }
- states: [
- State {
- when: root.active
- PropertyChanges {
- target: icon
- opacity: 0.0
- }
+ Image {
+ id: inactiveIcon
+ anchors.fill: parent
+ source: './images/Shortcut/%1.png'.arg(root.name.toLowerCase())
}
}
- ]
+ Image {
+ id: activeIcon
+ anchors.fill: parent
+ source: './images/Shortcut/%1_active.png'.arg(root.name.toLowerCase())
+ opacity: 0.0
+ }
+ layer.enabled: true
+ layer.effect: Desaturate {
+ id: desaturate
+ desaturation: icon.desaturation
+ cached: true
+ }
+ }
transitions: [
Transition {
NumberAnimation {
properties: 'opacity'
transitions: [
Transition {
NumberAnimation {
properties: 'opacity'
+ duration: 500
easing.type: Easing.OutExpo
}
easing.type: Easing.OutExpo
}
+ NumberAnimation {
+ properties: 'desaturation'
+ duration: 250
+ }
}
]
}
]
+
+ onPressed: {
+ activeIcon.opacity = 1.0
+ inactiveIcon.opacity = 0.0
+ }
+
+ onReleased: {
+ activeIcon.opacity = 0.0
+ inactiveIcon.opacity = 1.0
+ }
}
}