Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-50141

ComboBox does not support object array

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.6.0 RC
    • 5.6.0 Beta
    • Quick: Controls 2
    • None
    • win10 x64
    • 3242a3be7c7cc84e6fcda3e90a7713d9fda16915

    Description

      ComboBox ‘s data model don't support object array
      such as [

      {display:"a",value:0}

      ,

      {display:"b",value:1}

      ]

      because Combobox.qml source code delegate is

      delegate: ItemDelegate

      { width: control.width text: control.textRole ? model[control.textRole] : modelData checkable: true autoExclusive: true checked: control.currentIndex === index highlighted: control.highlightedIndex === index pressed: highlighted && control.pressed }

      I suggest that
      change text for example: Array.isArray(model) ? modelData[textRole] : model[textRole]

      textRole is empty text is modelData.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            awfan fanjunwu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes