jdxi_editor.ui.widgets.label_click

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

_ROUND_BUTTON_MAX_SIZE

Classes

_LabelClickForwarder

Event filter forwarding left clicks on a label row to its round button.

Functions

_is_round_button(widget) → bool

_neighbours_in_layout(layout, target) → list[PySide6.QtWidgets.QWidget]

The widgets just before and after target in layout (searched recursively).

find_round_button_for(label_row) → Optional[PySide6.QtWidgets.QAbstractButton]

The round button that belongs to label_row: explicit, else its layout neighbour.

make_label_clickable(label_row[, button]) → PySide6.QtWidgets.QWidget

Let a click on label_row click its round button.

Module Contents

jdxi_editor.ui.widgets.label_click._ROUND_BUTTON_MAX_SIZE = 48[source]
jdxi_editor.ui.widgets.label_click._is_round_button(widget: PySide6.QtWidgets.QWidget | None) → bool[source]
jdxi_editor.ui.widgets.label_click._neighbours_in_layout(layout: PySide6.QtWidgets.QLayout, target: PySide6.QtWidgets.QWidget) → list[PySide6.QtWidgets.QWidget][source]

The widgets just before and after target in layout (searched recursively).

jdxi_editor.ui.widgets.label_click.find_round_button_for(label_row: PySide6.QtWidgets.QWidget) → PySide6.QtWidgets.QAbstractButton | None[source]

The round button that belongs to label_row: explicit, else its layout neighbour.

class jdxi_editor.ui.widgets.label_click._LabelClickForwarder[source]

Bases: PySide6.QtCore.QObject

Event filter forwarding left clicks on a label row to its round button.

eventFilter(watched: PySide6.QtCore.QObject, event: PySide6.QtCore.QEvent) → bool[source]
jdxi_editor.ui.widgets.label_click.make_label_clickable(label_row: PySide6.QtWidgets.QWidget, button: PySide6.QtWidgets.QAbstractButton | None = None) → PySide6.QtWidgets.QWidget[source]

Let a click on label_row click its round button.

Parameters:
  • label_row – the widget with the button’s icon and text

  • button – the button; if omitted, the round button next to the row in its layout

Returns:

label_row