Results 1 to 6 of 6

Thread: QML: Property Z on listViews

  1. #1
    Join Date
    Dec 2010
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default QML: Property Z on listViews

    Hi all, I am trying to do a flip of images similar to the flip used on itunes for selecting discs:

    http://www.applecart.co.za/itunes/im...ac20060912.jpg


    I already did it, but I have a problem with the Z property of listView. When I set the properties of each image on "delegate" I set Z: 4 to the item selected, Z: 3 to the nearest images, Z: 2 to the middles images and Z: 1 to the farest images.

    As result, it should be as itunes, but.... Z doesn't work.

    As Delegate is executed from the index 0 to the last index, what I have is that the images with bigger index than the index selected are been draw over it although they have a smaller Z property.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QML: Property Z on listViews

    Remember this is lowercase "z".
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Dec 2010
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QML: Property Z on listViews

    Yeah I know, I am writting "z" in lowercase in the code.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QML: Property Z on listViews

    Show us some code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Dec 2010
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QML: Property Z on listViews

    Sure, here is the code of delegate:

    javascript Code:
    1. import Qt 4.7
    2.  
    3. Item {
    4. property int indexSelected: 0
    5.  
    6. Image {
    7. id: poster_id
    8. source: model.event_poster == "" ? _pics_path + "no_logo.jpg" : _pics_path + model.event_poster
    9. visible: true
    10. width: 160 * 0.7
    11. height: 208 * 0.7
    12. y: 30
    13. }
    14.  
    15. states: [
    16. State {
    17. name: "farestleft";
    18. when: (indexSelected == model.index)
    19.  
    20. PropertyChanges {
    21. target: poster_id;
    22. width: 160 * 0.7
    23. height: 208 * 0.7
    24. x: 80
    25. y: 30
    26. z: 5
    27. visible: true
    28. }
    29. }
    30. ,
    31. State {
    32. name: "farestright";
    33. when: (indexSelected + 6 == model.index)
    34.  
    35. PropertyChanges {
    36. target: poster_id;
    37. width: 160 * 0.7
    38. height: 208 * 0.7
    39. x: 0
    40. y: 30
    41. z: 5
    42. visible: true
    43. }
    44. }
    45. ,
    46. State {
    47. name: "middleleft";
    48. when: ((indexSelected + 1 == model.index) || (indexSelected + 5 == model.index))
    49.  
    50. PropertyChanges {
    51. target: poster_id;
    52. width: 160 * 0.8
    53. height: 208 * 0.8
    54. x: 32
    55. y: 20
    56. z: 10
    57. visible: true
    58. }
    59. }
    60. ,
    61. State {
    62. name: "middleright";
    63. when: ((indexSelected + 1 == model.index) || (indexSelected + 5 == model.index))
    64.  
    65. PropertyChanges {
    66. target: poster_id;
    67. width: 160 * 0.8
    68. height: 208 * 0.8
    69. x: 0
    70. y: 20
    71. z: 10
    72. visible: true
    73. }
    74. }
    75. ,
    76. State {
    77. name: "nearest";
    78. when: ((indexSelected + 2 == model.index) || (indexSelected + 4 == model.index))
    79.  
    80. PropertyChanges {
    81. target: poster_id;
    82. width: 160 * 0.9
    83. height: 208 * 0.9
    84. y: 10
    85. x: 8
    86. z: 20
    87. visible: true
    88. }
    89. }
    90. ,
    91. State {
    92. name: "selected";
    93. when: (indexSelected + 3 == model.index)
    94.  
    95. PropertyChanges {
    96. target: poster_id;
    97. width : 160
    98. height: 208
    99. scale: 1
    100. x: 0
    101. y: 0
    102. z: 50
    103. visible: true
    104. }
    105. }
    106. ]
    107.  
    108. transitions: Transition {
    109. from: "*"; to: "selected"
    110. NumberAnimation { properties: "x,y"; easing.type: Easing.InOutQuad }
    111. //NumberAnimation { properties: "width"; easing.type: Easing.InOutQuad }
    112. // NumberAnimation { properties: "z"; easing.type: Easing.InOutQuad }
    113. // PropertyAnimation { property: "z"; duration: 1000 }
    114.  
    115. //NumberAnimation { properties: "x"; from: 0; to: 50; easing.type: Easing.Linear; duration: 5500}
    116. //NumberAnimation { properties: "z"; from: 0; to: 50; easing.type: Easing.Linear; duration: 5500}
    117. }
    118. }
    To copy to clipboard, switch view to plain text mode 


    Added after 10 minutes:


    I know each item is using the apropiate "state" because the width, height, x and y properties are working fine
    Last edited by wysota; 2nd December 2010 at 16:25.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QML: Property Z on listViews

    I think you overcomplicate all this. Take a look at the PathView example available in the docs, I've seen coverflow implemented with it and it seems it does exactly what you want (just remember to change the z-order while traversing the path the same way as the scale is changed in the example).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Help with property browser
    By Jsvc in forum Qt Programming
    Replies: 2
    Last Post: 3rd October 2010, 01:49
  2. qt script property
    By wookoon in forum Qt Programming
    Replies: 2
    Last Post: 28th September 2010, 10:41
  3. C++ readonly property
    By yyiu002 in forum Newbie
    Replies: 16
    Last Post: 22nd June 2010, 10:26
  4. Multiple ListViews and checkbox problem
    By onamatic in forum Qt Programming
    Replies: 3
    Last Post: 8th January 2009, 10:48
  5. enum property
    By illuzioner in forum Qt Tools
    Replies: 10
    Last Post: 22nd August 2006, 21:47

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.