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. [SOLVED]Animate control's moving caused by other control's invisibility

[SOLVED]Animate control's moving caused by other control's invisibility

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.4k Views
  • 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.
  • I Offline
    I Offline
    ixSci
    wrote on last edited by
    #1

    Hi folks!

    I'd like to know is there a method to achieve smooth animation with the code below:
    @import QtQuick 1.0

    Rectangle {
    id: container

    width: 90
    height: 90
    
    Column{
        Rectangle{
            id: redRect
    
            width: container.width
            height: container.height/3
            color: "red"
            MouseArea{
                anchors.fill: parent
                onClicked: container.state = ""
            }
        }
        Rectangle{
            id: yellowRect
    
            width: redRect.width
            height: redRect.height
            color: "yellow"
            MouseArea{
                anchors.fill: parent
                onClicked: container.state = "new"
            }
        }
        Rectangle{
            id: greenRect
    
            width: redRect.width
            height: redRect.height
            color: "green"
        }
    }
    
    states: State{
        name: "new"
        PropertyChanges {
            target: yellowRect
            visible: false
        }
    }
    

    }@

    So, I want that green rect smoothly moves upward\downward. How can I achieve that with the code above?
    I know that I can extract all of them from the Column and add custom PropertyChange for the green rect (x,y) position to have the smooth animation but maybe there is a method to do it with the Column element?

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

      http://developer.qt.nokia.com/doc/qt-4.7/qml-column.html#id-70ca58a7-9c46-4a08-b488-8cba2063e703

      @Column{
      ...
      move: Transition {
      NumberAnimation { properties: "x,y"; easing.type: Easing.InOutQuad }
      }
      }@

      1 Reply Last reply
      0
      • I Offline
        I Offline
        ixSci
        wrote on last edited by
        #3

        Diph, thanks, it is exactly what I need!

        1 Reply Last reply
        0

        • Login

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