edifice.StackedView#

class edifice.StackedView(**kwargs)[source]#

Bases: _LinearView[QWidget]

Stacked layout.

Props

All props from QtWidgetElement.

Usage

Children of the StackedView will be stacked on top of each other. The first child will be on the top, the last child on the bottom. The top (first) child will occlude the bottom children.

If the top child has visual transparency then the bottom children will be visible through the top child.

If the top child has mouse event transparency then the bottom children will be clickable.

In the following example, the Label will be rendered on top of the CheckBox. The Checkbox will be partly visible in places where the Label is transparent. The CheckBox, not the Label, will be clickable because the Label is transparent to mouse events.

Example with clickable bottom CheckBox#
from PySide6.QtCore import Qt

label_ref: ed.Reference[ed.Label] = ed.use_ref()

def label_command():
    label = label_ref()
    if label and label.underlying:
        label.underlying.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents, True)

ed.use_effect(label_command, ())

with StackedView():
    Label(text="Top Label").register_ref(label_ref)
    CheckBox(text="Bottom Checkbox")

Methods

__init__(**kwargs)

register_ref(reference)

Registers provided Reference to this Element.

set_key(key)

Set the key of an Element.

Attributes

children

The children of this Element.

props

The props of this Element.

underlying

The underlying QWidget, which may not exist if this Element has not rendered.