Select to view content in your preferred language

Qt on IOS

3611
3
12-08-2014 03:00 PM
BrianLocke
Frequent Contributor

Finally, though it took a couple of days.... (helps if you read the docs I guess....) got Runtime for Qt over on IOS..... problems is GPS location does not work.... centers in at 0,0 for wkid 4326.  Also any layers that use https: will not display?? getting this error??

 

QObject::connect: Incompatible sender/receiver arguments

  QNetworkSessionPrivateImpl::usagePoliciesChanged(QNetworkSession::UsagePolicies) --> QNetworkSession::usagePoliciesChanged(QNetworkSession::UsagePolicies)

 

hmmmm.... has me scratching my head and I must admit that I am still getting used to the cryptic error messages that Qt usually gives.

 

Taking a swing at things I am wondering if these issues have something to do with the Info.plist???? Do I need to add some keys??  I did read in the docs that Qt does support Https over rest... which I am doing??  Any suggestions ?? I know things are in Beta but was hoping to generate some excitement for Ipads.

0 Kudos
3 Replies
LucasDanzinger
Esri Frequent Contributor

Brian,

For the GPS Position, this should work- we use this internally all the time. Can you share your code? The below code works for me on iOS (and other platforms).

import QtQuick 2.3

import QtQuick.Controls 1.2

import QtPositioning 5.3

import ArcGIS.Runtime 10.3

ApplicationWindow {

    id: appWindow

    width: 800

    height: 600

    title: "ios position"

    Map {

        anchors.fill: parent

        wrapAroundEnabled: true

        focus: true

        ArcGISTiledMapServiceLayer {

                url: "http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer"

        }

        positionDisplay {

                positionSource: PositionSource {

                id: positionSource

                onPositionChanged: {

                          console.log(position.coordinate.longitude);

                          console.log(position.coordinate.latitude);

}

}

        }

    }

    Button {

        anchors {

                left: parent.left

                top: parent.top

                 margins: 15

        }

        text: "show position"

        onClicked: positionSource.active = true;

    }

}

0 Kudos
LucasDanzinger
Esri Frequent Contributor

And as far as the https, I gave this a try with an internal dynamic map service, and it works. In this case, it uses https, but doesn't require credentials. Are you using a different layer, such as a feature layer or tiled layer? Do you require the user to enter credentials? If so, please look at the User Credentials Online sample in the sample app. You can use the identify manager to notify if you require credentials or not.

ArcGISTiledMapServiceLayer {

            url: "http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer"

}

ArcGISDynamicMapServiceLayer {

            url: "https://servername:6080/arcgis/rest/services/Map6/MapServer"

}

BrianLocke
Frequent Contributor

Here is the code for the Location, I have tried this on an Ipad 2 and also an Air 2 with the same Results-publishing to Android works fine though .... Save there is no Compass support on Android.

I have removed the specific server as were not to make the Services Public Quite yet, Also Removing the s out of HTTPS: works?? the services have had the token removed and seem to work fine just using http?  This is odd because in the other runtimes this will not work (iOS, Android and .Net)... hmmmm

Thanks for the speedy response back

import QtQuick 2.1

import QtQuick.Controls 1.0
import QtQuick.Dialogs 1.2
import QtQuick.Window 2.0
import QtQuick.Layouts 1.1
import ArcGIS.Runtime 10.3
import ArcGIS.Runtime.Toolkit.Dialogs 1.0
import QtPositioning 5.3
import QtSensors 5.3
ApplicationWindow {
    id: appWindow
    width: 320
    height: 480
    title: "WrmsLite"
Rectangle{
    anchors.fill: parent
    property int hitFeatureId:0
    property variant attrValue
    property real scaleFactor: 1
    property bool settingsView: true
    states:[
    State{
            name:"Settings"
            when:settingsDisplay
            changes:[
                PropertyChanges {
                    target: settingsDisplay
                    anchors.fill:parent},
                PropertyChanges{
                    target:mainMap
                    visible:false}
            ]
        }
    ]
    Rectangle{
        id:settingsDisplay
        anchors.fill: parent
        color:"white"
    }
    GeodatabaseFeatureServiceTable{
       id:incidentsFeatureService
       url:"https://SERVER/arcgis/rest/services/WRMS/Incidents/MapServer/0"
    }
    Map{
        property Point locationPoint: Point{
            property bool valid: false
            spatialReference: SpatialReference{
                wkid: 4326
            }
        }
        id:mainMap
        anchors.fill: parent
        ArcGISTiledMapServiceLayer{
            id:basemap
            url:"http://Server/arcgis/rest/services/USA_Topo_Maps/MapServer"
        }
        ArcGISDynamicMapServiceLayer{
            id:publicOwnership
            url:"https://Server/arcgis/rest/services/WebMercator/PublicOwnership/MapServer"
            opacity: 0.4
        }
        ArcGISDynamicMapServiceLayer{
            id:plss
            url: "https://Server/arcgis/rest/services/WebMercator/PLSS/MapServer"
        }
        ArcGISDynamicMapServiceLayer{
            id:lightning24
            url:"https://Server/arcgis/rest/services/WebMercator/Lightning24hours/MapServer"
        }
        //ArcGISDynamicMapServiceLayer{
           // id:incidents
           // url:"https://Server/arcgis/rest/services/WRMS/Incidents/MapServer"
        //}
        FeatureLayer{
            id:incidentsFeatureLayer
            featureTable: incidentsFeatureService
        }
        positionDisplay{
            compass:Compass{
                    id:compass
                }
                positionSource: PositionSource{
                id:positionSource
                onPositionChanged: {
                    mainMap.locationPoint.valid = position.latitudeValid&&position.longitudeValid;
                    mainMap.locationPoint.x = position.coordinate.longitude;
                    mainMap.locationPoint.y = position.coordinate.latitude;
                    locationPointChanged();
                }
            }
                onError: {
                    console.log("There was an error with the Positional Display... Not sure as to why")
                }
        }
        onMapReady:extent=oregonExtent
        onMouseClicked: {
            var features = incidentsFeatureLayer.findFeatures(mouse.x,mouse.y,0,1);
            for (var i=0;i<features.length;i++)
            {
                hitFeatureId =features[i];
                getFields(features);
                identifyDialog.title = "ObjectID" + hitFeatureId;;
                identifyDialog.visible = true;
            }
        }
    }
    ServiceInfoTask{
    }
    SimpleDialog {
            id: identifyDialog
            title: "Object ID: " + hitFeatureId
            height: (column.height * 1.3) * scaleFactor
            width: (column.width * 1.05) * scaleFactor
            Column {
                id: column
                spacing: 5 * scaleFactor
                anchors.centerIn: parent
                Repeater {
                    model: fieldsModel
                    Row {
                        id: row
                        spacing: (80 * scaleFactor)  - nameLabel.width
                        Label {
                            id: nameLabel
                            text: name + ": "
                            font.pixelSize: 10 * scaleFactor
                        }
                        Label {
                            text: value
                            font.pixelSize: 10 * scaleFactor
                        }
                    }
                }
            }
            onRejected: {
                hitFeatureId = 0;
            }
    }
    Envelope{
        id:oregonExtent
        xMin:-13884932.6524728
        xMax:-12942012.5881222
        yMin:5152699.92331632
        yMax:5836354.32813466
        spatialReference: SpatialReference{
            wkid: 102100
        }
    }
    ListModel{
        id:fieldsModel
    }
    ListModel{
        id:layers
    }
    ListModel{
        id:basemapLayers
    }
    Rectangle{
        id:topBar
        color: "black"
        height:parent.height/10
        width:parent.width
        opacity: .75
        Text{
            id:latLonPostionalData
            visible:positionSource.active
            color:"white"
            anchors.left: parent.left
            anchors.leftMargin: 10
            anchors.verticalCenter: parent
        }
        Button{
            id:gpsButton
            iconSource: "qrc:/Resources/GpsIcon.png"
            width: parent.height - parent.height * .1
            height: parent.height - parent.height * .1
            anchors.verticalCenter: parent.verticalCenter
            anchors.right: parent.right
            anchors.rightMargin: 10
            onClicked: {
                positionSource.active = true;
                compass.active = true;
                console.log("Hey you just clicked the button to turn the gps on" + qsTr(mainMap.positionDisplay.mode.toString()))
            }
        }
    }
    function getFields( featureLayer ) {
          fieldsModel.clear();
          var fieldsCount = incidentsFeatureLayer.featureTable.fields.length;
          for ( var f = 0; f < fieldsCount; f++ ) {
              var fieldName = incidentsFeatureLayer.featureTable.fields[f].name;
              attrValue = incidentsFeatureLayer.featureTable.feature(hitFeatureId).attributeValue(fieldName);
              if ( fieldName !== "Shape" ) {
                  var attrString = attrValue;
                  fieldsModel.append({"name": fieldName, "value": attrString});
              }
          }
    }
    function locationPointChanged(){
        latLonPostionalData.text = "Lat: "+positionSource.position.coordinate.latitude+" Lon: "+positionSource.position.coordinate.longitude+" Alt: "+positionSource.position.coordinate.altitude;
    }
}
}

					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
0 Kudos