add draggable demo

This commit is contained in:
王劲鹏 2021-06-02 09:53:58 +08:00 committed by osborn
parent dde6152972
commit 56d39d19a8
4 changed files with 48 additions and 58 deletions

View File

@ -25,54 +25,57 @@ void DoricDemoBridge::navigate(QVariant route) {
name = "Counter.js"; name = "Counter.js";
break; break;
case 2: case 2:
name = "EffectsDemo.js"; name = "DraggableDemo.js";
break; break;
case 3: case 3:
name = "Gobang.js"; name = "EffectsDemo.js";
break; break;
case 4: case 4:
name = "ImageDemo.js"; name = "Gobang.js";
break; break;
case 5: case 5:
name = "InputDemo.js"; name = "ImageDemo.js";
break; break;
case 6: case 6:
name = "LayoutDemo.js"; name = "InputDemo.js";
break; break;
case 7: case 7:
name = "LayoutTestDemo.js"; name = "LayoutDemo.js";
break; break;
case 8: case 8:
name = "ModalDemo.js"; name = "LayoutTestDemo.js";
break; break;
case 9: case 9:
name = "ModularDemo.js"; name = "ModalDemo.js";
break; break;
case 10: case 10:
name = "NetworkDemo.js"; name = "ModularDemo.js";
break; break;
case 11: case 11:
name = "PopoverDemo.js"; name = "NetworkDemo.js";
break; break;
case 12: case 12:
name = "ScrollerDemo.js"; name = "PopoverDemo.js";
break; break;
case 13: case 13:
name = "SimpleDemo.js"; name = "ScrollerDemo.js";
break; break;
case 14: case 14:
name = "SliderDemo.js"; name = "SimpleDemo.js";
break; break;
case 15: case 15:
name = "Snake.js"; name = "SliderDemo.js";
break; break;
case 16: case 16:
name = "StorageDemo.js"; name = "Snake.js";
break; break;
case 17: case 17:
name = "SwitchDemo.js"; name = "StorageDemo.js";
break; break;
case 18: case 18:
name = "SwitchDemo.js";
break;
case 19:
name = "TextDemo.js"; name = "TextDemo.js";
break; break;
} }

View File

@ -15,7 +15,7 @@ ApplicationWindow {
ListView { ListView {
width: parent.width width: parent.width
model: 19 model: 20
delegate: Rectangle { delegate: Rectangle {
Column { Column {
anchors.centerIn: parent anchors.centerIn: parent
@ -27,38 +27,40 @@ ApplicationWindow {
case 1: case 1:
return "Counter.js" return "Counter.js"
case 2: case 2:
return "EffectsDemo.js" return "DraggableDemo.js"
case 3: case 3:
return "Gobang.js" return "EffectsDemo.js"
case 4: case 4:
return "ImageDemo.js" return "Gobang.js"
case 5: case 5:
return "InputDemo.js" return "ImageDemo.js"
case 6: case 6:
return "LayoutDemo.js" return "InputDemo.js"
case 7: case 7:
return "LayoutTestDemo.js" return "LayoutDemo.js"
case 8: case 8:
return "ModalDemo.js" return "LayoutTestDemo.js"
case 9: case 9:
return "ModularDemo.js" return "ModalDemo.js"
case 10: case 10:
return "NetworkDemo.js" return "ModularDemo.js"
case 11: case 11:
return "PopoverDemo.js" return "NetworkDemo.js"
case 12: case 12:
return "ScrollerDemo.js" return "PopoverDemo.js"
case 13: case 13:
return "SimpleDemo.js" return "ScrollerDemo.js"
case 14: case 14:
return "SliderDemo.js" return "SimpleDemo.js"
case 15: case 15:
return "Snake.js" return "SliderDemo.js"
case 16: case 16:
return "StorageDemo.js" return "Snake.js"
case 17: case 17:
return "SwitchDemo.js" return "StorageDemo.js"
case 18: case 18:
return "SwitchDemo.js"
case 19:
return "TextDemo.js" return "TextDemo.js"
} }
} }

View File

@ -11,6 +11,7 @@
<qresource prefix="/doric/bundles"> <qresource prefix="/doric/bundles">
<file alias="ComponetDemo.js">../../../doric-demo/bundle/src/ComponetDemo.js</file> <file alias="ComponetDemo.js">../../../doric-demo/bundle/src/ComponetDemo.js</file>
<file alias="Counter.js">../../../doric-demo/bundle/src/Counter.js</file> <file alias="Counter.js">../../../doric-demo/bundle/src/Counter.js</file>
<file alias="DraggableDemo.js">../../../doric-demo/bundle/src/DraggableDemo.js</file>
<file alias="EffectsDemo.js">../../../doric-demo/bundle/src/EffectsDemo.js</file> <file alias="EffectsDemo.js">../../../doric-demo/bundle/src/EffectsDemo.js</file>
<file alias="Gobang.js">../../../doric-demo/bundle/src/Gobang.js</file> <file alias="Gobang.js">../../../doric-demo/bundle/src/Gobang.js</file>
<file alias="ImageDemo.js">../../../doric-demo/bundle/src/ImageDemo.js</file> <file alias="ImageDemo.js">../../../doric-demo/bundle/src/ImageDemo.js</file>

View File

@ -8,33 +8,17 @@ ApplicationWindow {
height: 800 height: 800
title: qsTr("Scroll") title: qsTr("Scroll")
SwipeView { Rectangle {
id: view width: 200; height: 200
color: "red"
currentIndex: 0 Drag.active: dragArea.drag.active
anchors.fill: parent
Rectangle { MouseArea {
id: firstPage id: dragArea
color: 'red' anchors.fill: parent
drag.target: parent
} }
Rectangle {
id: secondPage
color: 'green'
}
Rectangle {
id: thirdPage
color: 'blue'
}
}
PageIndicator {
id: indicator
count: view.count
currentIndex: view.currentIndex
anchors.bottom: view.bottom
anchors.horizontalCenter: parent.horizontalCenter
} }
} }