slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.96k stars 568 forks source link

Add is-open to PopupWindow #456

Open nyanpasu64 opened 3 years ago

nyanpasu64 commented 3 years ago

There should be a is-open output property on PopupWindow. Such that the Combobox can be styled differently when the popup is open.

Original issue: "Open appearance in native ComboBox"

I'm testing cargo install cargo-ui (which defaults to the Qt theme) on Linux, with sixtyfps 0.1.1. On Qt styles Fusion and Breeze master (but not Breeze from Plasma 5.22), when I click a dropdown box, the appearance looks permanently clicked and never returns to a normal state.

Screenshot_20210903_023946_Cargo UI

ogoffart commented 3 years ago

Thanks for the bug report.

I somehow can't reproduce this particular problem now with my Qt style. But I think the problem is that we don't properly send the cancel event if the mouse is released in another location after a grab Because i noticed similar problem with button/checkboxes that they stay in the hover state when we release the mouse outside of the button. And also if we scroll a view while it has hover. So this definitively needs to be fixed.

Jhyub commented 2 years ago

I also experience this. maybe button, tab, etc. hover also belongs to here too?

ogoffart commented 2 years ago

@Jhyub how exactly do you reproduce that?

Jhyub commented 2 years ago

I just cloned the repository and cargo run-ed the widgets gallery example on linux. I'll provide my exact specs when I get to my laptop.

ogoffart commented 2 years ago

I can reproduce

ogoffart commented 2 years ago

The thing that i can reproduce that that the is-open is never set to false again. That's because there is no property in the PopupMenu saying if it is visible or event called when it is closed.

I worked around the problem by never showing it as open.

ogoffart commented 1 year ago

So the problem is now that the combobox is never in the "open" appearance.

So to fix the problem, we'd need an is-open property on the PopupWindow, that can be accessed from the outside, to bind to the combobox representation. CC https://github.com/slint-ui/slint/issues/1143