ubports / ubuntu-ui-toolkit

Moved to https://gitlab.com/ubports/core/lomiri-ui-toolkit
https://gitlab.com/ubports/core/lomiri-ui-toolkit
GNU Lesser General Public License v3.0
13 stars 21 forks source link

OptionSelectorDelegate: Binding loop for "itemHeight" #104

Closed matdahl closed 3 years ago

matdahl commented 3 years ago

The binding

Component.onCompleted: {
    height = listView.itemHeight = Qt.binding(function() { return childrenRect.height; });
}

in OptionSelectorDelegate.qml:128 causes a QML ListView: Binding loop detected for property "itemHeight" warning each time a component of this type is created.

matdahl commented 3 years ago

replacing

Component.onCompleted: {
        height = listView.itemHeight = Qt.binding(function() { return childrenRect.height; });
}

by

Component.onCompleted: {
        height = listView.itemHeight = childrenRect.height
}

onChildrenRectChanged: {
        height = listView.itemHeight = childrenRect.height
}

should solve the problem.

lduboeuf commented 3 years ago

@matdahl will you PR something for that ? , i've tested locally and binding loops warning are gone.

matdahl commented 3 years ago

@lduboeuf done. But I accidentally included the not yet merged changes proposed in the other issue #105 ... Is it better to remove them to make 2 separated PRs or should I merge the PRs, i.e. cancel #106 ?

lduboeuf commented 3 years ago

I think it is better having two separate PR as it address two different things

matdahl commented 3 years ago

I guess, I successfully got rid of the other commits now.