Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Qt 5.6 MapItemView issue

    QML and Qt Quick
    qt5.6 mapitemview model delegate
    2
    3
    1426
    Loading More Posts
    • 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.
    • ginkgoguy
      ginkgoguy last edited by

      Hi,

      last days I try to build my project with Qt 5.6. The most works fine, but I have a problem with the Map component especially with MapItemView. The problem is there is no item shown on the map. Using Qt 5.5 the MapCircle is displayed at the correctly. Simplified my code looks like this snippet.

      import QtQuick 2.5
      import QtLocation 5.5
      import QtPositioning 5.5
      
      
      Map {
          id: map
          zoomLevel: 5
          center {
              latitude: 12
              longitude: 12
          }
          plugin: Plugin {
              name: "osm"
          }
      
          MapItemView {
              model: dummyModel
              delegate: MapCircle {
                  center {
                      latitude: model.latitude
                      longitude: model.longitude
                  }
                  radius: 50000.0
                  color: 'green'
                  border.width: 3
              }
          }
      
          ListModel {
              id:dummyModel
              ListElement {
                  latitude: 12.0
                  longitude: 12.0
                  Azimuth: 10.0
                  Color:"red"
               }
          }
      }
      

      For testing I use qmlscene, but there is the same problem in the project.
      Are there new conditions I don't have considered?

      Best regards

      1 Reply Last reply Reply Quote 0
      • A
        Alexander_Lanin last edited by

        Hi, I cannot explain this unfortunately and I don't even have Qt 5.6 installed right now.
        With Qt 5.7 this doesn't work with qmlscene either, but it works from QtCreator with a "real" project.
        e.g.:

            import QtQuick 2.5
            import QtLocation 5.5
            import QtPositioning 5.5
            import QtQuick.Controls 1.5
            
            ApplicationWindow
            {
                visible: true
            
                Map {
                    anchors.fill: parent
            
                    id: map
                    zoomLevel: 5
                    center {
                        latitude: 12
                        longitude: 12
                    }
                    plugin: Plugin {
                        name: "osm"
                    }
            
                    MapItemView {
                        model: dummyModel
                        delegate: MapCircle {
                            center {
                                latitude: model.latitude
                                longitude: model.longitude
                            }
                            radius: 50000.0
                            color: 'green'
                            border.width: 3
                        }
                    }
            
                    ListModel {
                        id:dummyModel
                        ListElement {
                            latitude: 12.0
                            longitude: 12.0
                            Azimuth: 10.0
                            Color:"red"
                         }
                    }
                }
            }
        
        1 Reply Last reply Reply Quote 1
        • ginkgoguy
          ginkgoguy last edited by

          Thanks for your efforts.
          As you said it works in a project I have a second look at my code.
          I'm not writing a Quick-App but a QWidget-App and use the map inside a QQuickWidget. I have read about another approach to embed qml content in a QWidget-App using QQuickView inside a QObject-Container.
          This approach works as expected. I don't know why it doesn't work with a QQuickWidget but my problem is solved.

          Best Regards

          1 Reply Last reply Reply Quote 0
          • First post
            Last post