ComboBoxes and ArcMaps for Developers

  • I am attempting a simple exercise, building off a template ESRI's ArcMaps for developers has given me. If anyone is familiar it is the Quick Report Template. That being said I have no experience in Qt QML, I am learning as I go. On this template provided you can report information at location provided by GPS. This information is grabbed from a text box and stored in an online database (ArcMaps Online).

    I am attempting to replace the text box with a dropdown menu. So far I've used a combo box and ListModel, It looks like it should work. Dropdown work, and change what they say.
    The complication is when I look into the database. Changing my selection with the dropdown does to appear to change the index. I am missing some way to tell the program that it needs to look for List elements.

    I can return a single entry from the dropdown into the database by using

    currentIndex: 1

    So it does access the ListElement, however when I use this every selection, will return this same index. If i do not set currentIndex, I will receive a null value.

    My combo box is below.

     ComboBox {
                id: textField
                //currentIndex: 1     
                model: ListModel {
                    id: cbItems
                    ListElement { text: "StrawBerry"  }
                    ListElement { text: "Banana"  }
                    ListElement { text: "Apple"  }
                    ListElement { text: "Coconut"; }
                width: 300
                anchors {
                    bottomMargin: 2
                    horizontalCenter: parent.horizontalCenter
                onCurrentIndexChanged: console.debug(cbItems.get(currentIndex).text)
                Component.onCompleted: {
                    //listView.onAttributeUpdate(objectName, text)
                    if (fieldType != Enums.FieldTypeDate)
                        attributesArray[fieldName] = textField.currentText 

    This piece is communicating back to ArcMaps Online

     function onAttributeUpdate(f_name, f_value){
                console.log("Got: ", f_name, f_value, typeof(f_value));
                for(var i=0; i<theFeatureAttributesModel.count; i++) {
                    var item = theFeatureAttributesModel.get(i);
                    if(item["fieldName"] == f_name) {
                        item["fieldValue"] = f_value;

    Thanks in advance!

  • Did you already resolve this? If not, perhaps it would be simpler if you used a regular js array to add your items to the combo box, instead of using the ListModel?

Log in to reply

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