diff options
author | 2024-02-09 02:24:53 +0100 | |
---|---|---|
committer | 2024-02-09 02:24:53 +0100 | |
commit | 7a20c8640f16c942733eae0be1af379acd769933 (patch) | |
tree | bec0aab52e31b21a609161ba4e3e335d6d239feb /widget/src/helpers.rs | |
parent | 073466708eef2b4c6331244e905f6739d8dfb076 (diff) | |
parent | c53c3a71d31d6ec5bc04146d8146784fe2532d11 (diff) | |
download | iced-7a20c8640f16c942733eae0be1af379acd769933.tar.gz iced-7a20c8640f16c942733eae0be1af379acd769933.tar.bz2 iced-7a20c8640f16c942733eae0be1af379acd769933.zip |
Merge pull request #2228 from jhannyj/better-tooltips
Refactor tooltip function to accept a generic element as a tooltip
Diffstat (limited to 'widget/src/helpers.rs')
-rw-r--r-- | widget/src/helpers.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/widget/src/helpers.rs b/widget/src/helpers.rs index 3f34d165..a5411c89 100644 --- a/widget/src/helpers.rs +++ b/widget/src/helpers.rs @@ -123,20 +123,21 @@ where Button::new(content) } -/// Creates a new [`Tooltip`] with the provided content, tooltip text, and [`tooltip::Position`]. +/// Creates a new [`Tooltip`] for the provided content with the given +/// [`Element`] and [`tooltip::Position`]. /// /// [`Tooltip`]: crate::Tooltip /// [`tooltip::Position`]: crate::tooltip::Position pub fn tooltip<'a, Message, Theme, Renderer>( content: impl Into<Element<'a, Message, Theme, Renderer>>, - tooltip: impl ToString, + tooltip: impl Into<Element<'a, Message, Theme, Renderer>>, position: tooltip::Position, ) -> crate::Tooltip<'a, Message, Theme, Renderer> where Theme: container::StyleSheet + text::StyleSheet, Renderer: core::text::Renderer, { - Tooltip::new(content, tooltip.to_string(), position) + Tooltip::new(content, tooltip, position) } /// Creates a new [`Text`] widget with the provided content. |