Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated proxy roles not visible to delegate model #83

Open
wingsandsuch opened this issue Nov 10, 2020 · 1 comment
Open

Updated proxy roles not visible to delegate model #83

wingsandsuch opened this issue Nov 10, 2020 · 1 comment

Comments

@wingsandsuch
Copy link

wingsandsuch commented Nov 10, 2020

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]
  }
}
@oKcerG
Copy link
Owner

oKcerG commented Nov 10, 2020

SortFilterProxyModel should support that, maybe Repeater doesn't?
I'll investigate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants