Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. ComboBoxes and ArcMaps for Developers
Forum Updated to NodeBB v4.3 + New Features

ComboBoxes and ArcMaps for Developers

Scheduled Pinned Locked Moved Unsolved General and Desktop
arcmapsesricomboboxquickreport
2 Posts 2 Posters 909 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • rmichalR Offline
    rmichalR Offline
    rmichal
    wrote on last edited by
    #1

    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 {
                    bottom: page4_button1.top
                    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!

    1 Reply Last reply
    0
    • L Offline
      L Offline
      ldanzinger
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved