Get Gtk TreeModel value from Gtk IconView

,

Hello,
In my program, I want to get a value from a Gtk TreeModel when the user’s mouse hovers over its corresponding item in a Gtk IconView. One of the values in the tree model is needed for creating a custom tooltip.

You haven’t specified which version of GTK you’re using, so I’ll just assume you’re using GTK3.

If you want to have a custom tooltip on an item in a GtkIconView, you will need to set the GtkWidget:has-tooltip property and connect to the GtkWidget::query-tooltip signal on your icon view. In every emission, you will have to call gtk_icon_view_get_path_at_pos() using the coordinates from the query-tooltip signal in order to retrieve a GtkTreePath. You can use the path to retrieve the corresponding iterator from the model, and then query the contents of the model just like you’d do in any other case.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.