Results 1 to 2 of 2

Thread: Animation on ListView::move

  1. #1
    Join Date
    May 2010
    Posts
    61
    Thanks
    2
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Animation on ListView::move

    Hi guys,

    I am trying in implement some sort of animation on the "move" method of a ListModel.

    Please see below my code:
    Qt Code:
    1. import Qt 4.7
    2.  
    3. Rectangle {
    4. width: 300
    5. height: 342
    6.  
    7. ListModel {
    8. id: listModel
    9. ListElement{
    10. rectangleColor: "red"
    11. }
    12. ListElement{
    13. rectangleColor: "green"
    14. }
    15. ListElement{
    16. rectangleColor: "blue"
    17. }
    18. }
    19.  
    20. Component {
    21. id: delegate
    22.  
    23. Rectangle {
    24. id: redRect
    25. width: 200
    26. height: 62
    27. color: rectangleColor
    28. clip:true
    29.  
    30. MouseArea {
    31. anchors.fill: parent
    32. drag.target: redRect
    33. drag.axis: "YAxis"
    34. onClicked: {
    35. listModel.move(index, index + 1, 1)
    36. }
    37. }
    38.  
    39. // Behavior on y { NumberAnimation{} }
    40. }
    41. }
    42.  
    43. ListView {
    44. interactive: false
    45. spacing: 10
    46. anchors.fill: parent
    47. model: listModel
    48. delegate: delegate
    49. }
    50. }
    To copy to clipboard, switch view to plain text mode 

    But I am stuck here, I don't even know if the direction that I am going is good.
    Is it ok that I used a ListView? Would you suggest something different?

    My final goal is to be able to select/drag one item from the listview and to rearrange the items. The behavior is similar to how the Google Chrome tabs are rearranging themselves when trying to move one tab.

    Any idea about the direction that I should proceed is welcome.

    Thanks in advance,
    Wladek


    Added after 25 minutes:


    I just found this: http://developer.qt.nokia.com/wiki/D...hin_a_GridView

    I am pretty sure that I can adjust it for using a ListView.

    I will post the solution here if succeeded

    Regards,
    Wladek
    Last edited by wladek; 2nd March 2011 at 15:40.

  2. #2

    Default Re: Animation on ListView::move

    <ItemsPanelTemplate x:Key="ItemsPanelTemplate">
    <WrapPanel>
    <i:Interaction.Behaviors>
    <il:FluidMoveBehavior AppliesTo="Children" Duration="00:00:00.75"/>
    </i:Interaction.Behaviors>
    </WrapPanel>
    </ItemsPanelTemplate>

Similar Threads

  1. how do you reload a listView?
    By implor in forum Newbie
    Replies: 5
    Last Post: 16th May 2010, 22:21
  2. Problem in Move Move Event Handler.
    By redgoof in forum Qt Programming
    Replies: 0
    Last Post: 7th April 2010, 11:45
  3. how to use listView enevt
    By tsuibin in forum Qt Programming
    Replies: 4
    Last Post: 2nd November 2009, 02:45
  4. listview
    By addu in forum Qt Programming
    Replies: 2
    Last Post: 11th May 2009, 12:05
  5. Move Rectangle on mouse Move
    By vermarajeev in forum Qt Programming
    Replies: 24
    Last Post: 14th May 2007, 05:34

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.