Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML - How to use GridView::itemAt(real x, real y)?

QML - How to use GridView::itemAt(real x, real y)?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 702 Views
  • 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.
  • I Offline
    I Offline
    Ibrahim
    wrote on last edited by
    #1

    Hi;
    I can get item of Repeater like this:

    var item = repeater.itemAt(index);
    

    But how can I get item of GridView? I saw itemAt function. But it is different from itemAt of Repeater. It wants x and y coordinates but we can use index in GridView like Repeater. How can I access the item? Thanks.

    raven-worxR 1 Reply Last reply
    0
    • I Ibrahim

      Hi;
      I can get item of Repeater like this:

      var item = repeater.itemAt(index);
      

      But how can I get item of GridView? I saw itemAt function. But it is different from itemAt of Repeater. It wants x and y coordinates but we can use index in GridView like Repeater. How can I access the item? Thanks.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Ibrahim
      i don't know if it works but try:

      gridView.children[x]
      

      (untested)

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      I 1 Reply Last reply
      1
      • raven-worxR raven-worx

        @Ibrahim
        i don't know if it works but try:

        gridView.children[x]
        

        (untested)

        I Offline
        I Offline
        Ibrahim
        wrote on last edited by
        #3

        @raven-worx thanks.
        I solved this problem like this:

        gridView.currentIndex = lastIndex;
        var lastItem = gridView.currentItem;
        gridView.currentIndex = currentIndex;
        var currentItem = gridView.currentItem;
        
        
        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