Gtk4 Listview : why does the "single-click-activate" also trigger the "selected" event?

Hello,

When using GtkListView with “set_single_click_activate” to TRUE, the “selected” (from GtkSelection) notify signal is triggered each time an item from the list is hovered.

Here is a demonstration video :

As you can see the “hover” and “selected” states are both active.

Kooha-11-01-2021-23-05-38

This condition that control the “selected” on hover seems to be this one :

This documentation page about “single-click-activate” property also mention :

Activate rows on single click and select them on hover.

Is this a normal intended behavior when using this property ? To me, it feels strange that the “selected” event is triggered on hover, as the item isn’t really selected. What is the real use of the “single-click-activate” ?

.

Moreover as the “selected” is triggered each hover, the “bind” event is also triggered :

Message: 23:20:05.026: notify_selection_model_selected | pos = 1
Message: 23:20:05.069: signal_selection_model_selection_changed | pos = 0 | n_items = 2
Message: 23:20:05.069: signal_list_item_factory_bind | position: 0
Message: 23:20:05.069: signal_list_item_factory_bind | position: 1

Thanks for your help! :slight_smile:

1 Like

I suppose it is at least in that it’s doing what it’s documented to do

I guess one point would be that rows should be selectable somehow, how else would you suggest?

Remember you can set ListItem:selectable to false, thus you could have a selection free list of items activated with a single click

I guess “single-click-activate” is more suitable inside a popup when you click on an item, then it also close this popup, not on a list which is always visible ?

That’s what I did with “gtk_list_item_set_selectable FALSE”, but unfortunately you’ll loose the “selected” state and thus the ability to customize the currently selected item and loose the keyboard shortcuts (UP, DOWN, ENTER keys).

So it’s either “single-click-activate” and every hovered item become selected, or no selection, but also no keyboards shortcuts and no “selected” class to style.

Thanks for your reply either way! :slight_smile:

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