Swipe Screen[solved]
-
This is my code:
@
import QtQuick 2.0
import QtQuick.Window 2.1Window {
id:parent
height:Screen.height
width:Screen.width
Image {
id:home3
source:"images.png"
height: Screen.height
width:Screen.width
}
Rectangle {
id:rect1
height:Screen.height
width:Screen.width
color:"Green"
SmoothedAnimation{
id:anim;
target:rect2
properties: "x"
to:0
duration: 500
}
}
Rectangle {
id:rect2
height:Screen.height
width:Screen.width
color:"red"
x:rect1.x-2000
SmoothedAnimation{
id:anim1;
target:rect1
properties: "x"
to:0
duration: 500
}
}
}
@
Basically at the starting the rect1 is visible and when you swipe the screen from right to left the the animation anim should occur and the rect2 is visible and when you swipe from left to right on the rect2 the animation anim1 should occur... -
What is your problem? I can't see any event/signal handling in your source.
-
I want to implement the swipe function using the mousearea of the rectangles.
-
Use ListView & ObjectModel/VisualItemModel
Flickable(scrollview,gridview...) component has achieve ths swipe event:
@
import QtQuick 2.2
import QtQml.Models 2.1
Rectangle {
ObjectModel {
id: itemModel
Rectangle { height: lv.height; width: lv.width; color: "red" }
Rectangle { height: lv.height; width: lv.width; color: "green" }
Rectangle { height: lv.height; width: lv.width; color: "blue" }
}ListView { id: lv anchors.fill: parent model: itemModel orientation: ListView.Horizontal snapMode: ListView.SnapOneItem boundsBehavior: Flickable.StopAtBounds }
}
@ -
Thank you very much.This works perfectly fine in Qt Quick Ui projects but it is not working in Qt Quick Application project.How to make this work in Qt Quick Application project.?
-
Please specify what exactly isn't working.
-
The project is building up and compiling but the application output is not getting displayed.Even the output window does not pop up.
-
Could you please provide us the output of your console? (If there is any output)
-
Solved it.It is working fine now
-
Hi,
Did you check "StackView":http://qt-project.org/doc/qt-5/qml-qtquick-controls-stackview.html ? It allows something similar.
-
Please add [SOLVED] to your thread title!