class StyleMixin(core.ObjectMixin):
def draw_primitive(
self,
element: SubControlStr | mod.SubControl,
option: widgets.QStyleOption,
painter: QtGui.QPainter,
widget: widgets.QWidget | None = None,
):
self.drawPrimitive(
PRIMITIVE_ELEMENT.get_enum_value(element), option, painter, widget
)
def draw_control(
self,
control: ControlElementStr | mod.ControlElement,
option: widgets.QStyleOption,
painter: QtGui.QPainter,
widget: widgets.QWidget | None = None,
):
self.drawPrimitive(
CONTROL_ELEMENT.get_enum_value(control), option, painter, widget
)
def get_layout_spacing(
self,
control_1: widgets.sizepolicy.ControlTypeStr | widgets.QSizePolicy.ControlType,
control_2: widgets.sizepolicy.ControlTypeStr | widgets.QSizePolicy.ControlType,
orientation: constants.OrientationStr | constants.Orientation,
option_or_widget: widgets.QStyleOption | widgets.QWidget | None = None,
):
c1 = widgets.sizepolicy.CONTROL_TYPE.get_enum_value(control_1)
c2 = widgets.sizepolicy.CONTROL_TYPE.get_enum_value(control_2)
o = constants.ORIENTATION.get_enum_value(orientation)
match option_or_widget:
case widgets.QWidget():
return self.layoutSpacing(c1, c2, o, None, option_or_widget)
case widgets.QStyleOption() | None:
return self.layoutSpacing(c1, c2, o, option_or_widget)
case _:
raise ValueError(option_or_widget)