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

ComboBox reset current on model changed #5217

Merged
merged 5 commits into from May 15, 2024
Merged

Conversation

FloVanGH
Copy link
Member

Fixes #5214
Fixes #3628

CHANGELOG.md Outdated
Comment on lines 34 to 35
- Fixed updating model of ComboBox does not change current-value
- Fixed set current-index of ComboBox to -1 does not reset current-value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These actually belong in the Widget category.

Be carefull as well that if this is not merged before the release, it needs to be changed to a different version manually.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@tronical
Copy link
Member

I tried to debug this a little. It’s the inlining that breaks with change handlers. SLINT_INLINING=true reproduces the failure also for builds (gallery for example). It looks like the names references inside the change handlers aren’t adjusted correctly. From the code it looks like that should happen when processing the fix ups for the mapping, but something goes wrong.

@tronical
Copy link
Member

Minimal reproducer:

component Test {
    in-out property <int> index: 0;
    changed index => {
        debug(root.index);
    }
}

export component Testcase  {
    in-out property index <=> t.index;
    t := Test {}
}

@tronical
Copy link
Member

tronical commented May 15, 2024

Even smaller test case, it's not related to inlining but declarations moving:

export component Testcase {
    t := Rectangle {
        in-out property <int> index: 0;
        changed index => {
        }
    }
}

FloVanGH and others added 5 commits May 15, 2024 14:27
When eliminating a properyt, also make sure to remove associated change callbacks:

```slint
export component Testcase {
    t := Rectangle {
        in-out property <int> index: 0;
        changed index => {
        }
    }
}
```
When an observed property is renamed due to alias removal, make sure to update the name of the observed property:

```slint
export component Testcase {
    in-out property index <=> t.index;
    t := Rectangle {
        in-out property <int> index: 0;
        changed index => {
        }
    }
}
```
@FloVanGH FloVanGH merged commit 310b01a into master May 15, 2024
26 checks passed
@FloVanGH FloVanGH deleted the florian/cb-model-change branch May 15, 2024 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants