Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Closed] ListView move items with animation. (no qml)
Forum Updated to NodeBB v4.3 + New Features

[Closed] ListView move items with animation. (no qml)

Scheduled Pinned Locked Moved General and Desktop
13 Posts 3 Posters 6.9k 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.
  • S Offline
    S Offline
    Sam
    wrote on last edited by
    #1

    I have a list view that has n items , My requirement is that when i select an item in the list and move up or down,I need to provide an anmation effect For eg:

    item1
    item2
    item3
    item4
    item5
    item6

    If i select item5 and move/drag up then each item should shift one position down with animation and the current position should be empty until the item is dropped.

    How can i achieve something like this, It will be helpful if i get some examples.

    Thanks.

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

      Hello,

      This is perhaps time to look at the QML :)

      dmcr

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Sam
        wrote on last edited by
        #3

        I would like to implement this without using qml. For animation QPropertyAnimation or QTimer might work.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dmcr
          wrote on last edited by
          #4

          Sure you can go without it.
          Just that it will take some time to implement.
          I don't know about your list, if it interact with the rest of your classical widget....
          But one admissible solution could be, if not, to encapsulate a QML in a QDeclarativeView and use it as a any other widget.
          .... still QML tought.

          dmcr

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            Perhaps you should google for "item views NG" then. It is an old research project for creating a new set of item views. The views in that framework (again: reseach, never officialy released!) are based on QGrapicsView. Animation is possible in there. The work done in this project was part of the basis of what you can now find in QML item views.

            But again: why is QML not an option? You can make only the list a QML view, in an otherwise QWidget based application.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Sam
              wrote on last edited by
              #6

              [quote author="Andre" date="1348473731"]Perhaps you should google for "item views NG" then. [/quote]

              Yep, I checked out that, I downloaded the example from "here":http://qt.gitorious.org/qt-labs/itemviews-ng but couldn't get them working.

              bq. But again: why is QML not an option?

              To be honest I have to start with qml, dont have sufficient knowledge with that my bad :(

              Thanks for the help :-|

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #7

                [quote author="Sam" date="1348484526"]
                [quote author="Andre" date="1348473731"]Perhaps you should google for "item views NG" then. [/quote]

                Yep, I checked out that, I downloaded the example from "here":http://qt.gitorious.org/qt-labs/itemviews-ng but couldn't get them working.
                [/quote]
                There is a compile error, but it is only in a test case, so you can simply disable the test.
                [quote]
                To be honest I have to start with qml, dont have sufficient knowledge with that my bad :([/quote]

                I think digging a bit into QML is going to be way less work than trying to program the animation yourself, even if you do that on top of ItemViewNG.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  dmcr
                  wrote on last edited by
                  #8

                  It's a good idea :)

                  You can perform very smart result in a very short amount of time.
                  Specially if you want to customize a listView.

                  i would recommend you "this post":http://cdumez.blogspot.fr/2010/11/how-to-use-c-list-model-in-qml.html !

                  Good luck

                  dmcr

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    Sam
                    wrote on last edited by
                    #9

                    [quote author="Andre" date="1348485044"]
                    I think digging a bit into QML is going to be way less work than trying to program the animation yourself, even if you do that on top of ItemViewNG.[/quote]

                    Yes i have to look into that, But is there any way to use QPropertyAnimation on a listview item. I found "this":http://lists.trolltech.com/qt-interest/2002-02/thread01181-0.html discussion but not of much help as it uses QListViewItem- moveItems n all. But if there is some way I can get the co-ordinates or move the items then i can play with the animation.

                    Or I Use a QWidget and a QVboxLayout and fake it to look like a QListView and then play with moving the widgets up and down ? Long way to go :-|

                    [quote author="dmcr" date="1348486856"]It's a good idea :)

                    You can perform very smart result in a very short amount of time.
                    Specially if you want to customize a listView.

                    i would recommend you "this post":http://cdumez.blogspot.fr/2010/11/how-to-use-c-list-model-in-qml.html !

                    Good luck

                    [/quote]

                    Thanks for the help, but i couldnt get it working :(
                    I got some Linker error related to QDeclarativeView.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      andre
                      wrote on last edited by
                      #10

                      Yes, you can animate properties. Simply use a Behaviour on on them.

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        Sam
                        wrote on last edited by
                        #11

                        Can you provide an example. I couldnt get any property for QListView or QStandardItem that could be used for animation, however I am using QStyledItemDelegate where i can get the position of each rect. using option.rect. I think i am going the wrong way to implement this.

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          andre
                          wrote on last edited by
                          #12

                          Oh, sorry, my comment was aimed as ListView in QML, not QListView in Qt Widgets.

                          No, in the widget world, I know of no ways to add animations to items.

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            Sam
                            wrote on last edited by
                            #13

                            No Problem at all,

                            Thanks for your help :-)

                            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