How to change cursor to hand when hover button? #1325
Closed
amirhossein-fzl
started this conversation in
General
Replies: 2 comments
-
You would have to use a https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.EventControllerMotion.html and then call https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/prelude/trait.WidgetExt.html#tymethod.set_cursor on the widget. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Some pseudo code to help let controller = gtk::EventControllerMotion::new();
controller.connect_enter(|controller, _, _| {
let widget = controller.widget().unwrap();
// See https://gtk-rs.org/gtk4-rs/stable/latest/docs/gdk4/struct.Cursor.html#method.from_name
let cursor = gdk::Cursor::from_name("help", None::<&gdk::Cursor>);
widget.set_cursor(Some(&cursor));
});
controller.connect_leave(|controller| {
let widget = controller.widget().unwrap();
widget.set_cursor(None::<&gdk::Cursor>);
});
widget.add_controller(controller); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How to change cursor to hand when hover button?
I use gtk-rs v0.6.2 and v4_8 feature ...
Beta Was this translation helpful? Give feedback.
All reactions