Select to view content in your preferred language

Debugging problem in QT/QML application

6567
2
Jump to solution
03-25-2015 06:20 AM
KK2014
by
Deactivated User

I have Identify application and when I want to test debuging mode in onMousePressed signal in application when I click feature debug mode open and goes to the break points after two seconds or when I click the Step Over button gives exception and open Assembly output.How can I solve this problem?

Here is the code of application below:

// Copyright 2015 ESRI

//

// All rights reserved under the copyright laws of the United States

// and applicable international laws, treaties, and conventions.

//

// You may freely redistribute and use this sample code, with or

// without modification, provided you include the original copyright

// notice and use restrictions.

//

// See the Sample code usage restrictions document for further information.

//

import QtQuick 2.0

import QtQuick.Controls 1.2

import QtQuick.Controls.Styles 1.2

import QtQuick.Dialogs 1.2

import QtQuick.Layouts 1.1

import QtQuick.Window 2.0

import ArcGIS.Extras 1.0

import ArcGIS.Runtime 10.25

import ArcGIS.Runtime.Toolkit.Dialogs 1.0

ApplicationWindow {

    id: appWindow

    width: 800

    height: 600

    title: "IdentfyEditing"

    property int hitFeatureId

    property variant attrValue

    property real scaleFactor: System.displayScaleFactor

    SimpleRenderer {

        id: customRender

        symbol: SimpleMarkerSymbol {

            style: Enums.SimpleMarkerSymbolStyleCircle

            color: "red"

            size: 9

        }

    }

    Envelope {

       id: initialExtent

       xMin: 1930934.6938406308

       yMin: 3850498.260784086

       xMax: 5912392.6567565575

       yMax: 5564737.105928443

    }

    GeodatabaseFeatureServiceTable {

        id: featureServiceTable

        url: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Sync/WildfireSync/FeatureServer/0"

    }

    Map {

        anchors.fill: parent

        focus: true

        ArcGISTiledMapServiceLayer {

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

        }

//        ArcGISDynamicMapServiceLayer {

//            url: "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"

//        }

        FeatureLayer {

            id:featureLayer

            featureTable: featureServiceTable

            renderer: customRender

        }

        onStatusChanged: {

            if (status === Enums.MapStatusReady)

                extent = initialExtent;

        }

        onMousePressed: {

            var tolerance = Qt.platform.os === "ios" || Qt.platform.os === "android" ? 4 : 1;                //Break Point

            var features = featureLayer.findFeatures(mouse.x, mouse.y, tolerance * scaleFactor, 1)  //Break Point

            for ( var i = 0; i < features.length; i++ ) {

                hitFeatureId = features;

                getFields(featureLayer);

                identifyDialog.title = "Object ID: " + hitFeatureId;

                identifyDialog.visible = true;

                if(Qt.platform.os !== "ios" && Qt.platform.os != "android") {

                    identifyDialog.width = 200 * scaleFactor;

                    identifyDialog.height = 235 * scaleFactor;

                }

            }

       }

    }

    // Dialog for results

    Dialog {

        id: identifyDialog

        title: "Features"

        modality: Qt.ApplicationModal

        visible: false

        contentItem: Rectangle {

            id: dialogRectangle

            color: "lightgrey"

            width : 200 * scaleFactor

            height: 235 *scaleFactor

            Column {

                id: column

                anchors {

                    fill: parent

                    margins: 10 * scaleFactor

                }

                spacing: 5 * scaleFactor

                clip: true

                Repeater {

                    model: fieldsModel

                    clip: true

                    Row {

                        id: row

                        spacing: (80 * scaleFactor)  - nameLabel.width

                        Label {

                            id: nameLabel

                            text: name + ": "

                            color: "black"

                            horizontalAlignment: Text.AlignHCenter

                            font.pixelSize: 10 * scaleFactor

                        }

                        Label {

                            text: value

                            color: "black"

                            horizontalAlignment: Text.AlignHCenter

                            font.pixelSize: 10 * scaleFactor

                        }

                    }

                }

            }

            Button {

                anchors {

                    margins: 10 * scaleFactor

                    bottom: parent.bottom

                    right: parent.right

                }

                text: "Ok"

                style: ButtonStyle {

                    label: Text {

                        text: control.text

                        color:"black"

                        horizontalAlignment: Text.AlignHCenter

                    }

                }

                onClicked: identifyDialog.close();

            }

        }

    }

    ListModel {

        id:fieldsModel

    }

    Rectangle {

        id: backgroundRectangle

        anchors {

            fill: backgroundColumn

            margins: -10 * scaleFactor

        }

        color: "lightgrey"

        radius: 5

        border.color: "black"

        opacity: 0.77

    }

    Column {

        id: backgroundColumn

        anchors {

            top: parent.top

            left: parent.left

            margins: 20 * scaleFactor

        }

        width: 150 * scaleFactor

        spacing: 7 * scaleFactor

        Text {

            id: descriptionText

            text: qsTr( "Red points are stored in the feature service table. Blue points are drawn dynamically. See description for more details.")

            font.pixelSize: 14 * scaleFactor

            width: 150 * scaleFactor

            wrapMode: Text.WordWrap

        }

    }

    Rectangle {

        anchors.fill: parent

        color: "transparent"

        border {

            width: 0.5 * scaleFactor

            color: "black"

        }

    }

    function getFields( featureLayer )

    {

//        fieldsModel.clear();

//        var fieldsCount = featureLayer.featureTable.fields.length;

//        for ( var f = 0; f < fieldsCount; f++ ) {

//            var fieldName = featureLayer.featureTable.fields.name;

//            attrValue = featureLayer.featureTable.feature(hitFeatureId).attributeValue(fieldName);

//            if ( fieldName !== "Shape" ) {

//                var attrString = attrValue.toString();

//                fieldsModel.append({"name": fieldName, "value": attrString});

//            }

//        }

        fieldsModel.clear();

        var fieldsCount = featureLayer.featureTable.fields.length;

        var fieldName = featureLayer.featureTable.fields[3].name;//description

        attrValue= featureLayer.featureTable.feature(hitFeatureId).attributeValue(fieldName);

        var  attrString = attrValue.toString();

        fieldsModel.append({"name": fieldName, "value":attrString });

    }

}

Here is the assembly output below:

   MSVCR120D!fltout2:

0x7fedd4b20a0                    mov     qword ptr [rsp+20h],r9
0x7fedd4b20a5  <+0x0005>         mov     qword ptr [rsp+18h],r8
0x7fedd4b20aa  <+0x000a>         mov     qword ptr [rsp+10h],rdx
0x7fedd4b20af  <+0x000f>         mov     qword ptr [rsp+8],rcx
0x7fedd4b20b4  <+0x0014>         push    rsi
0x7fedd4b20b5  <+0x0015>         push    rdi
0x7fedd4b20b6  <+0x0016>         sub     rsp,88h
0x7fedd4b20bd  <+0x001d>         mov     rax,qword ptr [MSVCR120D!_security_cookie (000007fe`dd5684b0)]
0x7fedd4b20c4  <+0x0024>         xor     rax,rs
0x7fedd4b20c7  <+0x0027>         mov     qword ptr [rsp+70h],rax
0x7fedd4b20cc  <+0x002c>         lea     rdx,[rsp+0A0h]
0x7fedd4b20d4  <+0x0034>         lea     rcx,[rsp+40h]
0x7fedd4b20d9  <+0x0039>         call    MSVCR120D!_dtold (000007fe`dd4b1ef0)
0x7fedd4b20de  <+0x003e>         lea     rax,[rsp+30h]
0x7fedd4b20e3  <+0x0043>         lea     rcx,[rsp+40h]
0x7fedd4b20e8  <+0x0048>         mov     rdi,rax
0x7fedd4b20eb  <+0x004b>         mov     rsi,rcx
0x7fedd4b20ee  <+0x004e>         mov     ecx,0Ah
0x7fedd4b20f3  <+0x0053>         rep movs byte ptr [rdi],byte ptr [rsi]
0x7fedd4b20f5  <+0x0055>         lea     r9,[rsp+50h]
0x7fedd4b20fa  <+0x005a>         xor     r8d,r8d
0x7fedd4b20fd  <+0x005d>         mov     edx,11h
0x7fedd4b2102  <+0x0062>         lea     rcx,[rsp+30h]
0x7fedd4b2107  <+0x0067>         call    MSVCR120D!$I10_OUTPUT (000007fe`dd4b5490)
0x7fedd4b210c  <+0x006c>         mov     rcx,qword ptr [rsp+0A8h]
0x7fedd4b2114  <+0x0074>         mov     dword ptr [rcx+8],eax
0x7fedd4b2117  <+0x0077>         movsx   eax,byte ptr [rsp+52h]
0x7fedd4b211c  <+0x007c>         mov     rcx,qword ptr [rsp+0A8h]
0x7fedd4b2124  <+0x0084>         mov     dword ptr [rcx],eax
0x7fedd4b2126  <+0x0086>         movsx   eax,word ptr [rsp+50h]
0x7fedd4b212b  <+0x008b>         mov     rcx,qword ptr [rsp+0A8h]
0x7fedd4b2133  <+0x0093>         mov     dword ptr [rcx+4],eax
0x7fedd4b2136  <+0x0096>         lea     r8,[rsp+54h]
0x7fedd4b213b  <+0x009b>         mov     rdx,qword ptr [rsp+0B8h]
0x7fedd4b2143  <+0x00a3>         mov     rcx,qword ptr [rsp+0B0h]
0x7fedd4b214b  <+0x00ab>         call    MSVCR120D!strcpy_s (000007fe`dd3ad280)
0x7fedd4b2150  <+0x00b0>         mov   qword ptr [rsp+28h],0
0x7fedd4b2159  <+0x00b9>         mov     dword ptr [rsp+20h],1Dh
0x7fedd4b2161  <+0x00c1>         lea     r9,[MSVCR120D!`string' (000007fe`dd5359d0)]
0x7fedd4b2168  <+0x00c8>         lea     r8,[MSVCR120D!`string' (000007fe`dd535a20)]
0x7fedd4b216f  <+0x00cf>         lea     rdx,[MSVCR120D!`string' (000007fe`dd535a40)]
0x7fedd4b2176  <+0x00d6>         mov     ecx,eax
0x7fedd4b2178  <+0x00d8>         call    MSVCR120D!invoke_watson_if_error (000007fe`dd3779d0)
0x7fedd4b217d  <+0x00dd>         mov     rax,qword ptr [rsp+0A8h]
0x7fedd4b2185  <+0x00e5>         mov     rcx,qword ptr [rsp+0B0h]
0x7fedd4b218d  <+0x00ed>         mov     qword ptr [rax+10h],rcx
0xfedd4b2191  <+0x00f1>         mov     rax,qword ptr [rsp+0A8h]
0x7fedd4b2199  <+0x00f9>         mov     rcx,qword ptr [rsp+70h]
0x7fedd4b219e  <+0x00fe>         xor     rcx,rsp
0x7fedd4b21a1  <+0x0101>         call    MSVCR120D!_security_check_cookie (000007fe`dd492000)
0x7fedd4b21a6  <+0x0106>         add     rsp,88h
0x7fedd4b21ad  <+0x010d>         pop     rdi
0x7fedd4b21ae  <+0x010e>         pop     rsi
0x7fedd4b21af  <+0x010f>         ret
        MSVCR120D!strrchr:
0x7fedd4b21b0                    mov     dword ptr [rsp+10h],edx
0x7fedd4b21b4  <+0x0004>         mov     qword ptr [rsp+8],rcx
0x7fedd4b21b9  <+0x0009>         sub     rsp,28h
0x7fedd4b21bd  <+0x000d>         mov     edx,dword ptr [rsp+38h]
0x7fedd4b21c1  <+0x0011>         mov     rcx,qword ptr [rsp+30h]
0x7fedd4b21c6  <+0x0016>         call    MSVCR120D!strrchr (000007fe`dd3ab060)
0x7fedd4b21cb  <+0x001b>         add     rsp,28h
0x7fedd4b21cf  <+0x001f>         ret
        MSVCR120D!cfltcvt_l:
0x7fedd4b21d0                    mov     dword ptr [rsp+20h],r9d
0x7fedd4b21d5  <+0x0005>         mov     qword ptr [rsp+18h],r8
0x7fedd4b21da  <+0x000a>         mov     qword ptr [rsp+10h],rdx
0x7fedd4b21df  <+0x000f>         mov     qword ptr [rsp+8],rcx

And here is the excepion below:

Triggered.JPG

Thanks.

0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

We have logged an internal issue to make sure we can get this working in a future release. Due to the declarative nature of QML, it can be a bit odd to step through the declarative code, but it should work in the JavaScript functions.

View solution in original post

0 Kudos
2 Replies
CeyhunYilmaz
Occasional Contributor

Hi,

I have same problem. But nobody haven't replied it yet . Debuging problems are continue where we use code ArcGis.Runtime 10.25 like above.Can we debug in next version of ArcGis Runtime

Thank u

0 Kudos
LucasDanzinger
Esri Frequent Contributor

We have logged an internal issue to make sure we can get this working in a future release. Due to the declarative nature of QML, it can be a bit odd to step through the declarative code, but it should work in the JavaScript functions.

0 Kudos