Results 1 to 2 of 2

Thread: QML ListView change CurrentIndex - Transition

  1. #1
    Join Date
    May 2012
    Posts
    5

    Default QML ListView change CurrentIndex - Transition

    Hi,

    I'm using Qt 5 Alpha, QtQuick 2 and want to define Transitions when I switch the CurrentIndex (not the highlight) of a ListView.
    The delegate of the ListView contains a Img and I want to scale it while changing.

    Is this possible?

    Thank You.

  2. #2
    Join Date
    Nov 2010
    Posts
    82
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QML ListView change CurrentIndex - Transition

    not tested qt5 enough but in qtquick 1.1
    - the element of your model should have an "active" property
    - the delegate has a state "active" when active == true
    - the transition of the state will do the animation (you can set it reversible)
    - onCurrentIndexChanged of your listview: active the current item in the model (that must deactivate old value)


    Added after 4 minutes:


    a simplier way :
    create a : property QtObject currObj for your listview
    create a function active(newObj) that will set the standart state of the curObj, set the "active" state of newObj and then copy newObj to curObj
    in the onclicked of your mouseArea of the delegate just call active(<id_of_delegate>)
    Last edited by Le_B; 28th June 2012 at 16:32.

Similar Threads

  1. Replies: 1
    Last Post: 23rd June 2012, 13:23
  2. Replies: 2
    Last Post: 21st June 2012, 13:43
  3. Replies: 0
    Last Post: 22nd May 2011, 08:42
  4. Replies: 2
    Last Post: 26th January 2008, 10:20
  5. currentIndex().internalPointer() problem
    By xgoan in forum Qt Programming
    Replies: 2
    Last Post: 14th December 2006, 09:55

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.