aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2018-10-17 08:56:06 +0800
committerwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2018-10-17 08:56:06 +0800
commit56607817112410d7a25cddc81aa7d652fc536cb9 (patch)
tree5511f4d7c0d99b4325629ad74f5929f1d2389adc
parentc225d3fe5d0d9354fb368b793e798403ab17a71f (diff)
make applist flickablesandbox/wangzhiqiang/some_improve
Change-Id: I2a2a4a56b0d3d3e635f73cc7519171d67182c893
-rw-r--r--launcher/qml/IconItem.qml14
-rw-r--r--launcher/qml/Launcher.qml51
2 files changed, 55 insertions, 10 deletions
diff --git a/launcher/qml/IconItem.qml b/launcher/qml/IconItem.qml
index c15a3da..8171bef 100644
--- a/launcher/qml/IconItem.qml
+++ b/launcher/qml/IconItem.qml
@@ -22,13 +22,17 @@ Item {
id: main
width: 320
height: 320
+ x: main.x
+ y: main.y
property string icon: model.icon
Item {
id: container
parent: loc
- x: main.x
- y: main.y
+// x: main.x
+// y: main.y
+ x: main.x - loc.r_mouseX + loc.mouseX
+ y: main.y - loc.r_mouseY + loc.mouseY
width: main.width
height: main.height
@@ -85,8 +89,8 @@ Item {
text: qsTr(model.name.toUpperCase())
}
- Behavior on x { enabled: item.state !== 'active'; NumberAnimation { duration: 400; easing.type: Easing.OutCubic } }
- Behavior on y { enabled: item.state !== 'active'; NumberAnimation { duration: 400; easing.type: Easing.OutCubic } }
+ Behavior on x { enabled: item.state !== 'active' && loc.flicking == false ; NumberAnimation { duration: 400; easing.type: Easing.OutCubic } }
+ Behavior on y { enabled: item.state !== 'active' && loc.flicking == false ; NumberAnimation { duration: 400; easing.type: Easing.OutCubic } }
SequentialAnimation on rotation {
NumberAnimation { to: 5; duration: 100 }
NumberAnimation { to: -5; duration: 200 }
@@ -112,6 +116,8 @@ Item {
target: container
scale: 0.85
opacity: 0.75
+ x: main.x - loc.r_mouseX + loc.mouseX
+ y: main.y - loc.r_mouseY + loc.mouseY
}
}
]
diff --git a/launcher/qml/Launcher.qml b/launcher/qml/Launcher.qml
index 6d55271..8c1078c 100644
--- a/launcher/qml/Launcher.qml
+++ b/launcher/qml/Launcher.qml
@@ -51,7 +51,8 @@ ApplicationWindow {
visible: true
cellWidth: 320
cellHeight: 320
- interactive: false
+ interactive: true
+ boundsBehavior: Flickable.StopAtBounds
model: ApplicationModel { id: applicationModel }
delegate: IconItem {
@@ -59,19 +60,43 @@ ApplicationWindow {
height: grid.cellHeight
}
+ onFlickStarted: {
+ console.warn("grid:onFlickStarted, status=", grid.flicking)
+ }
+
+ onFlickEnded: {
+ console.warn("grid:onFlickEnded, status=", grid.flicking)
+ }
+
+
+
MouseArea {
id: loc
anchors.fill: parent
property string currentId: ''
property int newIndex: -1
- property int index: grid.indexAt(loc.mouseX, loc.mouseY)
- x: 62
- y: 264
- onPressAndHold: currentId = applicationModel.id(newIndex = index)
+ property int r_mouseX: loc.mouseX + grid.contentX
+ property int r_mouseY: loc.mouseY + grid.contentY
+ property bool flicking: grid.flicking
+ property int index: grid.indexAt(r_mouseX, r_mouseY)
+// x: 62
+// y: 264
+// propagateComposedEvents: true
+ onPressAndHold: {
+ currentId = applicationModel.id(newIndex = index)
+ grid.interactive = false
+ console.warn("onPressAndHold:currentId = ", currentId, loc.mouseX, loc.mouseY, loc.index)
+ console.warn("onPressAndHold:r_mouseX = ", r_mouseX, "r_mouseY = ", r_mouseX, "contentY = ", grid.contentY)
+ for(var it in loc.children)
+ console.warn("itx=", loc.children[it].x, "ity=", loc.children[it].y, '\n')
+ }
onReleased: {
+ console.warn("onReleased:currentId = ", currentId, loc.mouseX, loc.mouseY, loc.index)
+ grid.interactive = true
if(loc.index < 0) {
return
}
+
if (currentId === '') {
pid = launcher.launch(applicationModel.id(loc.index))
if (1 < pid) {
@@ -83,13 +108,27 @@ ApplicationWindow {
} else {
currentId = ''
}
+// homescreenHandler.tapShortcut(applicationModel.name(loc.index))
}
onPositionChanged: {
- if (loc.currentId === '') return
+ if (loc.currentId === '') {
+ console.warn("mouse.accepted = false")
+// mouse.accepted = false
+ return
+ }
+ else {
+ console.warn("mouse.accepted = true")
+// mouse.accepted = true
+ }
+
if (index < 0) return
if (index === newIndex) return
applicationModel.move(newIndex, newIndex = index)
}
+
+// onClicked: {
+// console.warn("CLICKED ON")
+// }
}
}
}