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. How I Can Use MapView + ScrollView
Forum Updated to NodeBB v4.3 + New Features

How I Can Use MapView + ScrollView

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.2k 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.
  • O Offline
    O Offline
    omerfurkan
    wrote last edited by omerfurkan
    #1

    Hello, I am doing some experiments with Qt 6.9. I want to use ScrollView together with MapView. I have done this, but I have a problem. When I try to scroll the ScrollView, the MapView moves as well. How can I fix this issue? I want to separate the scrolling actions of the two. In other words, when I drag the MapView, it should scroll the MapView, and when I drag the ScrollView, it should scroll the ScrollView. Right now, in both cases, the MapView is scrolling.

    Psuedo code

    
        MapView {
            id: mapView
            anchors.fill: parent
    
            ScrollView {
                width: parent.width
                height: 200
                anchors.left: parent.left
                anchors.leftMargin: 5
                anchors.right: parent.right
                anchors.bottom: parent.bottom
                anchors.bottomMargin: 5
                clip: true
                contentWidth: parent.width
                contentHeight: 200
    
                ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
                ScrollBar.vertical.policy: ScrollBar.AlwaysOff
    
                ScrollBar.horizontal.interactive: true
                ScrollBar.vertical.interactive: false
    
                RowLayout {
                    anchors.fill: parent
                    Repeater {
                        model: 10
                        delegate:  Rectangle {
                            width: 200
                            height: 300
                            color: "red"
                        }
                    }
                }
            }
        }
    
    1 Reply Last reply
    0
    • mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote last edited by
      #2

      I didn't actually test this, but here's one possible approach:

      MapView {
          interactive: !scrollView.dragging
          ScrollView {
              id: scrollView
      
      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