jdxi_editor.ui.widgets.label_click ================================== .. py:module:: jdxi_editor.ui.widgets.label_click .. autoapi-nested-parse:: Make the label next to a round JD-Xi button act as part of the button. Editor actions are drawn as a 30 px round button with an icon and a text label beside it (Load, Previous, Read from JD-Xi, ...). The label is a separate widget, so a click on the words did nothing and only the small circle reacted. ``make_label_clickable`` installs a filter on the label row: a left click on it clicks the round button next to it in the same layout, and the pointer shows a hand over it. The button can also be given explicitly. Attributes ---------- .. autoapisummary:: jdxi_editor.ui.widgets.label_click._ROUND_BUTTON_MAX_SIZE Classes ------- .. autoapisummary:: jdxi_editor.ui.widgets.label_click._LabelClickForwarder Functions --------- .. autoapisummary:: jdxi_editor.ui.widgets.label_click._is_round_button jdxi_editor.ui.widgets.label_click._neighbours_in_layout jdxi_editor.ui.widgets.label_click.find_round_button_for jdxi_editor.ui.widgets.label_click.make_label_clickable Module Contents --------------- .. py:data:: _ROUND_BUTTON_MAX_SIZE :value: 48 .. py:function:: _is_round_button(widget: Optional[PySide6.QtWidgets.QWidget]) -> bool .. py:function:: _neighbours_in_layout(layout: PySide6.QtWidgets.QLayout, target: PySide6.QtWidgets.QWidget) -> list[PySide6.QtWidgets.QWidget] The widgets just before and after *target* in *layout* (searched recursively). .. py:function:: find_round_button_for(label_row: PySide6.QtWidgets.QWidget) -> Optional[PySide6.QtWidgets.QAbstractButton] The round button that belongs to *label_row*: explicit, else its layout neighbour. .. py:class:: _LabelClickForwarder Bases: :py:obj:`PySide6.QtCore.QObject` Event filter forwarding left clicks on a label row to its round button. .. py:method:: eventFilter(watched: PySide6.QtCore.QObject, event: PySide6.QtCore.QEvent) -> bool .. py:function:: make_label_clickable(label_row: PySide6.QtWidgets.QWidget, button: Optional[PySide6.QtWidgets.QAbstractButton] = None) -> PySide6.QtWidgets.QWidget Let a click on *label_row* click its round button. :param label_row: the widget with the button's icon and text :param button: the button; if omitted, the round button next to the row in its layout :return: label_row