小编gar*_*art的帖子

QML。如何从 C++ 更改 MapPolyline 路径?

这是一个 QML 地图:

Map {
        anchors.fill: parent
        plugin: osmMapPlugin
        center: QtPositioning.coordinate(56.006355, 92.860984)
        zoomLevel: 14

        MapPolyline {
            line.width: 3
            line.color: 'red'
            path: [
                { latitude: -27, longitude: 153.0 },
                { latitude: -27, longitude: 154.1 },
                { latitude: -28, longitude: 153.5 },
                { latitude: -29, longitude: 153.5 }
            ]
        }
    }
Run Code Online (Sandbox Code Playgroud)

path从怎么改C++/qt?我试过这个:

QML:

Map {
        anchors.fill: parent
        plugin: osmMapPlugin
        center: QtPositioning.coordinate(56.006355, 92.860984)
        zoomLevel: 14

        MapPolyline {
            line.width: 3
            line.color: 'red'

            path: map_path
        }
    }
Run Code Online (Sandbox Code Playgroud)

C++:

map = new QQuickWidget(); …
Run Code Online (Sandbox Code Playgroud)

c++ qt qml qt5

4
推荐指数
1
解决办法
1889
查看次数

标签 统计

c++ ×1

qml ×1

qt ×1

qt5 ×1