Results 1 to 2 of 2

Thread: How to write a number animation on the mouse button press event in QML?

  1. #1
    Join Date
    Apr 2011
    Posts
    231
    Thanks
    141
    Thanked 6 Times in 5 Posts

    Default How to write a number animation on the mouse button press event in QML?

    Qt Code:
    1. import QtQuick 1.0
    2.  
    3. Rectangle
    4. {
    5. width: 100; height: 100
    6. color: "red"
    7.  
    8. MouseArea
    9. {
    10. anchors.fill: parent
    11.  
    12. onPressed:
    13. {
    14. NumberAnimation
    15. {
    16. target: parent.x
    17. to: 50;
    18. duration: 1000
    19. }
    20. }
    21. }
    22. }
    To copy to clipboard, switch view to plain text mode 

    I expect this code to shift the x position of the rectangle on the button press event, but this does nothing.

    Where am I going wrong?

  2. The following user says thank you to TheIndependentAquarius for this useful post:


  3. #2
    Join Date
    Apr 2011
    Posts
    231
    Thanks
    141
    Thanked 6 Times in 5 Posts

    Default Re: How to write a number animation on the mouse button press event in QML?


Similar Threads

  1. long mouse press event
    By tonylin0826 in forum Newbie
    Replies: 5
    Last Post: 27th September 2012, 16:24
  2. QGraphicsview and mouse press event
    By eva2002 in forum Qt Programming
    Replies: 6
    Last Post: 26th January 2010, 05:04
  3. Mouse press event in a QGraphicsScene
    By Lykurg in forum Qt Programming
    Replies: 3
    Last Post: 19th June 2009, 10:28
  4. Mouse press event detection
    By A.H.M. Mahfuzur Rahman in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2009, 13:08
  5. Checking for key press on mouse event
    By Cruz in forum Newbie
    Replies: 1
    Last Post: 24th January 2009, 18:18

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.