Results 1 to 1 of 1

Thread: QML GridView State change on Delegates and mapToItem Question

  1. #1
    Join Date
    Oct 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QML GridView State change on Delegates and mapToItem Question

    Hello

    i try to make a state change for grid items. As an example i want to set items whose y value is over a certain level (e.g. half of the window size) to change to a state and thus are marked somehow (e.g. another color is set). And this should happen dynamically. It should work, when i do nothing as well as i flick the grid view. But now some things occur, that i dont understand. 1st: I used the mapping function of the Item class to map items coordinates to containers (root) coordinates. If one start the sample above, and click on element 31, the app outputs the elements position and the mapped position. The items position of 200 is ok, since every cell has a height of 50 and the item starts after the 4th row, but why is the mapped position value 400??? Without flicking shouldnt it be 200 too? How can i get the items position in world coordinates? 2nd question: I wonder, when the state changes are recognized, thus it doesn’t seem to be for every element at any time. If one uncomment the console.log method in the isActive-function and slightly flick down, only one element seems to be updated and this happens three times with different values. Why does this happen? And how can i achieve, that this function is evaluated for all items WITHOUT using the grid.moving value?

    A sample file is attached... hope someone can help me.

    Greetings
    Attached Files Attached Files

Similar Threads

  1. QStateMachine state change problem
    By QTie in forum Qt Programming
    Replies: 0
    Last Post: 6th June 2011, 09:09
  2. Change QHttp:: state() from unconnected to connected
    By eman in forum General Programming
    Replies: 1
    Last Post: 18th November 2010, 00:58
  3. Handling window state change
    By sudhansu in forum Qt Programming
    Replies: 0
    Last Post: 10th November 2010, 12:28
  4. Change position according to QCheckBox State
    By champ in forum Qt Programming
    Replies: 5
    Last Post: 6th June 2010, 18:37
  5. mapToItem() question
    By Alex Brophy in forum Newbie
    Replies: 2
    Last Post: 18th April 2008, 09:55

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.