Select to view content in your preferred language

Qt5/QtQuick plugin not working

426
0
02-14-2023 01:32 PM
GeneHorodecki
New Contributor

Hi there.  I'm trying to complete an app with Pyside2 / Qt 5.15.2 / QML and I'm trying to use the plugin for QtLocation.Map.  The filename is qtgeoservices_esri.dll.

I have tried not providing a token, I have tried providing the API token as "token" and "esri.token", I have tried providing an oauth2 client_access token with both "token" and "esri.token" and all I can get is a grey screen with a small "esri contributors" in the bottom corner.  Can anyone please tell me how to get this plugin to work?

Here is the code I am trying, thanks for the assistance.

esriTest.py:

import QtQuick 2.15
import QtWebEngine 1.10
import QtQuick.Controls 2.15
import QtLocation 5.15
import QtPositioning 5.15

ApplicationWindow {
    visible: true
        width: 600
        height: 500
        title: "HelloApp"
        Plugin {
            id: mapPlugin
            name: "esri"
            PluginParameter {
                name: "esri.token"
                value: "TOKEN"
            }
        }
        Map {
            id: mapSection
            anchors.fill: parent
            plugin: mapPlugin
            activeMapType: supportedMapTypes[1]
            Component.onCompleted: {
                for (var i=0; i<mapSection.supportedMapTypes.length; i++) {
                    console.log(i, supportedMapTypes[i].name)
                }
            }
        }
    }

 

esriTest.qml:

from PySide2 import * 
from PySide2.QtGui import QGuiApplication 
from PySide2.QtQml import QQmlApplicationEngine 
from pathlib import Path import os,sys

app = QGuiApplication(sys.argv) 
engine = QQmlApplicationEngine() 
engine.load(os.fspath(Path(__file__).resolve().parent / "qml/esriTest.qml")) 
if not engine.rootObjects(): sys.exit(-1)
	sys.exit(app.exec_())

 

 

0 Kudos
0 Replies