[Python] How do I pass through the click on a GtkEditableLabel to the GtkColumnView row...

Discussão em 'Python' iniciado por Stack, Setembro 16, 2025.

  1. Stack

    Stack Membro Participativo

    I have a Gtk.ColumnView where cells are represented by Gtk.EditableLabels. Keyboard navigation works fine, clicking in the cells to edit them works fine, tab navigation works fine.

    However, clicking within a row to select that row doesn't work.

    Some cells are editable (i.e. label.set_editable(True)) and some are not. The ones which are editable simply go into edit mode when clicked within the bounds of the label, the ones which are not don't react to clicks at all. In order to select a row with the mouse, I have to click in the "dead space" within the row, either between rows/cells or in a part of the cell that is not covered by a short label.

    What I expect / want to happen, is for clicking on a non-editable cell to immediately select the row, and for clicking on an editable cell to select its row, and then begin editing.

    I can sort of emulate this for non-editable rows by doing label.set_sensitive(False), but this styles everything with a light-grey "disabled" color, and that's not what I want to indicate; the row is interactable, it's just that that particular cell / column is not editable.

    It seems in gtk4, there's no longer any "clicked" signal, so handling that is not possible; I gather I want to do something with a Gtk.Gesture event controller?

    Continue reading...

Compartilhe esta Página