Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Swipe Screen[solved]
Forum Updated to NodeBB v4.3 + New Features

Swipe Screen[solved]

Scheduled Pinned Locked Moved QML and Qt Quick
11 Posts 5 Posters 3.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Shrinidhi UpadhyayaS Offline
    Shrinidhi UpadhyayaS Offline
    Shrinidhi Upadhyaya
    wrote on last edited by
    #1

    This is my code:
    @
    import QtQuick 2.0
    import QtQuick.Window 2.1

    Window {
    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...

    Shrinidhi Upadhyaya.
    Upvote the answer(s) that helped you to solve the issue.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dasRicardo
      wrote on last edited by
      #2

      What is your problem? I can't see any event/signal handling in your source.

      **Sorry for my english :)

      PLEASE ADD [SOLVED] TO YOUR THREAD TITLE IF IT'S SOLVED.**

      1 Reply Last reply
      0
      • Shrinidhi UpadhyayaS Offline
        Shrinidhi UpadhyayaS Offline
        Shrinidhi Upadhyaya
        wrote on last edited by
        #3

        I want to implement the swipe function using the mousearea of the rectangles.

        Shrinidhi Upadhyaya.
        Upvote the answer(s) that helped you to solve the issue.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          surfsky
          wrote on last edited by
          #4

          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
          }
          

          }
          @

          1 Reply Last reply
          1
          • Shrinidhi UpadhyayaS Offline
            Shrinidhi UpadhyayaS Offline
            Shrinidhi Upadhyaya
            wrote on last edited by
            #5

            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.?

            Shrinidhi Upadhyaya.
            Upvote the answer(s) that helped you to solve the issue.

            1 Reply Last reply
            1
            • O Offline
              O Offline
              onek24
              wrote on last edited by
              #6

              Please specify what exactly isn't working.

              1 Reply Last reply
              0
              • Shrinidhi UpadhyayaS Offline
                Shrinidhi UpadhyayaS Offline
                Shrinidhi Upadhyaya
                wrote on last edited by
                #7

                The project is building up and compiling but the application output is not getting displayed.Even the output window does not pop up.

                Shrinidhi Upadhyaya.
                Upvote the answer(s) that helped you to solve the issue.

                1 Reply Last reply
                0
                • O Offline
                  O Offline
                  onek24
                  wrote on last edited by
                  #8

                  Could you please provide us the output of your console? (If there is any output)

                  1 Reply Last reply
                  0
                  • Shrinidhi UpadhyayaS Offline
                    Shrinidhi UpadhyayaS Offline
                    Shrinidhi Upadhyaya
                    wrote on last edited by
                    #9

                    Solved it.It is working fine now

                    Shrinidhi Upadhyaya.
                    Upvote the answer(s) that helped you to solve the issue.

                    1 Reply Last reply
                    1
                    • p3c0P Offline
                      p3c0P Offline
                      p3c0
                      Moderators
                      wrote on last edited by
                      #10

                      Hi,

                      Did you check "StackView":http://qt-project.org/doc/qt-5/qml-qtquick-controls-stackview.html ? It allows something similar.

                      157

                      1 Reply Last reply
                      1
                      • D Offline
                        D Offline
                        dasRicardo
                        wrote on last edited by
                        #11

                        Please add [SOLVED] to your thread title!

                        **Sorry for my english :)

                        PLEASE ADD [SOLVED] TO YOUR THREAD TITLE IF IT'S SOLVED.**

                        1 Reply Last reply
                        1

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved