Qt 5.6 MapItemView issue



  • 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



  • 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"
                     }
                }
            }
        }


  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.