Skip to content

Updated proxy roles not visible to delegate model #83

Description

@wingsandsuch

I have the following SortFilterProxyModel with an ExpressionRole that has a name that changes based on some property binding. When I select option 'a' or 'b' I expect that I could use the respective role name, but it seems to not trigger the expression function (no log message) and I get undefined as a return value. Does the SortFilterProxyModel not support the behavior that I want or is QML not recognizing that there is a new role present?

ComboBox{
  id: nameComboBox
  model: ['a','b']
  currentIndex: 0
}

SortFilterProxyModel{
  id: minimumTestModel
  sourceModel: ListModel{
    ListElement{
      unUsed: "you can ignore this"
    }
  }

  proxyRoles: [
    ExpressionRole{
      // dynamic name, should work when 'b' is selected in ComboBox but doesnt
      name: nameComboBox.currentValue
      expression: {
        console.log('trigger')
        return 1
      }
    },
    ExpressionRole{
      // constant name - present in the combobox, works
      name: 'a'
      expression: {
        console.log('trigger')
        return 2
      }
    }
  ]
}
Repeater{
  model: minimumTestModel
  delegate: Text{
    text: model[nameComboBox.currentValue]
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions