Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. retreive combobox data from repeater
Forum Updated to NodeBB v4.3 + New Features

retreive combobox data from repeater

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 654 Views 2 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.
  • F Offline
    F Offline
    filipdns
    wrote on last edited by
    #1

    Hello,

    I would like to know if it's possible to get data from each combobox if I use repeater.

    using the code below, I have the desired result, 10 line combobox :

                Column{
                    anchors.top:title.bottom
                    anchors.topMargin: 8
                    Repeater{
                        id:comborepeater
                        model:10
                        Rectangle{
                            id:rectdesc
                            width:250
                            height:30
    
                            ComboBox {
                                id: descriptionInput
                                anchors.fill:parent
                                editable:true
                                textRole: "part"
                                model: combopnModel
                                style: ComboBoxStyle{
                                    font {
                                        pixelSize: 18
                                    }
                                }                            
                            }
                            Text{
                                id:qtytitle
                                anchors.left:descriptionInput.right
                                anchors.top:descriptionInput.top
                                anchors.leftMargin: 8
                                font.pixelSize: 18
                                text:"Qty"
                            }
                            TextField{
                                height:parent.height
                                width:height*2
                                anchors.left:qtytitle.right
                                anchors.top:descriptionInput.top
                                anchors.leftMargin: 8
                                font.pixelSize: 18
                            }
                        }
                    }
                }
            }
        }
        ListModel {
            id: combopnModel
        }
        Component.onCompleted: {
            JS.comboboxpartnumberonly()
        }
    

    but what I have to do to get data for each?

    thanks for your help

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2
      console.log(comborepeater.children[5].children[0].currentIndex)
      

      This will return your the current index of 6th combo box.

      To make it simpler you can add your combobox as property to rectdesc component, like this:

      Rectangle{
        id:rectdesc
        width:250
        height:30
        property alias combobox: descriptionInput
      
        ComboBox {
          id: descriptionInput
      
      // then:
      console.log(comborepeater.children[5].combobox.currentIndex)
      

      (Z(:^

      1 Reply Last reply
      2

      • Login

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