You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In desktop land item views (e.g. QListView and -Widget) are usually surrounded by a frame rectangle acting as a focus indicator. The look depends on the platform (for some (LX)Qt themes on Linux it is made of 2 border colors -> tricky). On other platforms the corners are rounded etc.
I think a separate FocusFrame (or simply Frame) component may be interesting for Slint. It further helps building custom components with a platform native look.
Here is my (approximated) implementation (mentioned in #1722 -> here).
import {Palette} from"std-widgets.slint";
/// Draws a focus frame around fickables (ListView, ScollView, …)/// respecting system style palette and metricsexportcomponentFocusFrameinheritsFocusScope {
Rectangle {
background: Palette.control-background;
border-color: {
// NOTE: Depends on platform
if root.has-focus {
Palette.selection-background
} else {
Palette.border
}
}
// NOTE: border radius depends on platform
border-width: {
// NOTE: Depends on platform
if root.has-focus {
2px
} else {
1px
}
}
@children
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In desktop land item views (e.g. QListView and -Widget) are usually surrounded by a frame rectangle acting as a focus indicator. The look depends on the platform (for some (LX)Qt themes on Linux it is made of 2 border colors -> tricky). On other platforms the corners are rounded etc.
I think a separate FocusFrame (or simply Frame) component may be interesting for Slint. It further helps building custom components with a platform native look.
Here is my (approximated) implementation (mentioned in #1722 -> here).
Beta Was this translation helpful? Give feedback.
All reactions