rustgtk4gtk-rs

How to set the GTK4 tooltip delay in gtk-rs?


I can do like

let button = Button::builder().label("Click me..!")
                              .tooltip_text("You have to click this..!")
                              .margin_top(24)
                              .margin_bottom(24)
                              .margin_start(12)
                              .margin_end(12)
                              .build();

and when hovered the button shows the tooltip with a certain delay. Yet i would like to shorten it's timeout to show earlier. Despite all kinds of AI and GPT and whatnot it turned out to be an impossible mission. This is with GTK4 with dependencies in cargo.toml defined as

[dependencies]
gtk = { version = "0.6.6", package = "gtk4", features = ["v4_10"] }

Could anybody please help?


Solution

  • The hover timeout for tooltips has been fixed to 500 ms (or 60 ms when browsing from another tooltip) since GTK+ 3.9.8, in commit e61c1245. Even before then, it was configurable only for the entire application, not for individual widgets. To use an earlier timeout, you'll have to create your own popup from scratch; you may find EventControllerMotion and Popover helpful for that.