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. Zooming into ListView doesnt work

Zooming into ListView doesnt work

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 261 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.
  • C Offline
    C Offline
    Creaperdown
    wrote on last edited by
    #1

    Hey, I have a ListView and I want to zoom in and out on it. The zooming itself works fine, but it is not zooming into the middle of the listview, but scrolls up while zooming https://streamable.com/o1frzj (As you can see it moves up towards the top of the listview).
    I suppose the problem is the 3rd parameter of Flickable.resizeContent (the zoomPoint). I can't find a way to set it to a value that results in a zooming towards the middle of my screen.

    This is my zoom function:

    function zoom(factor)
    {
        let newWidth = listView.contentWidth * factor;
        
        var zoomPoint = Qt.point(listView.width/2 + listView.contentX,
                                 listView.height/2 + listView.contentY);
        
    
        listView.resizeContent(Math.round(newWidth),
                               Math.round(newWidth / listView.currentItem.pageRatio),
                               zoomPoint);
        
        listView.returnToBounds();
    }
    

    Does someone have an idea why it doesn't scroll into the middle of the screen?
    Thanks in advance

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Creaperdown
      wrote on last edited by
      #2

      I have created a minimal example of my problem: https://gist.github.com/DavidLazarescu/58ae4c1f60a007326b2b6ea7bc5fcd66, in this video: https://streamable.com/8cxjre you can see that it is not scrolling into the middle of the listview

      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