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

Add always-on-top property to Window element #2557

Merged

Conversation

colelawrence
Copy link
Contributor

@colelawrence colelawrence commented Apr 14, 2023

It's a very simple implementation, which could be made by mostly pattern matching the existing code path for no-frame and no_frame. I've added my own review for things that stood out as potential questions.

if (size != widget_ptr->size()) {
widget_ptr->resize(size.expandedTo({1, 1}));
}
widget_ptr->setWindowFlag(Qt::FramelessWindowHint, no_frame);
widget_ptr->setWindowFlag(Qt::WindowStaysOnTopHint, always_on_top);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +335 to +339
winit_window.set_window_level(if window_item.always_on_top() {
winit::window::WindowLevel::AlwaysOnTop
} else {
winit::window::WindowLevel::Normal
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Question: Does being fullscreen matter like it does for no-frame?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think it matters :)

Comment on lines 154 to +155
in property <bool> no-frame;
in property <bool> always-on-top;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is the ordering arbitrary, here? In the docs, the ordering is alphabetical.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah. Even the alphabetical ordering in the docs I would personally rather group by relevance. This looks good to me.

@colelawrence colelawrence marked this pull request as ready for review April 14, 2023 18:34
@@ -1174,6 +1174,7 @@ pub struct WindowItem {
pub background: Property<Brush>,
pub title: Property<SharedString>,
pub no_frame: Property<bool>,
pub always_on_top: Property<bool>,
Copy link
Member

Choose a reason for hiding this comment

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

There aren't many window items around, so I think this is fine, too.

@tronical
Copy link
Member

Looks good to me. Let's see what the others say :)

@ogoffart
Copy link
Member

Very good PR, complete with documentation and changelog entry. There are no test but I can't think how this could be tested. Thank you for the contribution.

@ogoffart ogoffart merged commit af30896 into slint-ui:master Apr 15, 2023
@colelawrence colelawrence deleted the feature/2023-04-window-always-on-top branch April 17, 2023 15:06
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

Successfully merging this pull request may close these issues.

3 participants