AYONStyle drawer for QLineEdit.
Registers a no-op for PE_PanelLineEdit when the widget is an AYLineEdit instance (which paints itself fully in its own paintEvent), and falls back to the base QCommonStyle implementation for all other QLineEdit widgets.
Source code in client/ayon_ui_qt/drawers/lineedit.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 | class LineEditDrawer:
"""AYONStyle drawer for QLineEdit.
Registers a no-op for PE_PanelLineEdit when the widget is an AYLineEdit
instance (which paints itself fully in its own paintEvent), and falls back
to the base QCommonStyle implementation for all other QLineEdit widgets.
"""
def __init__(self, style_inst: AYONStyle) -> None:
self.style_inst = style_inst
@property
def _super(self):
"""Return proxy for calling QCommonStyle methods on style_inst."""
from ..style import AYONStyle as _AYONStyle
return super(_AYONStyle, self.style_inst)
@property
def base_class(self):
return {"QLineEdit": QLineEdit}
def register_drawers(self):
return {
enum_to_str(
QStyle.PrimitiveElement,
QStyle.PrimitiveElement.PE_PanelLineEdit,
"QLineEdit",
): self.draw_panel,
}
def draw_panel(
self,
option: QStyleOption,
painter: QPainter,
widget: QWidget | None,
) -> None:
# AYLineEdit paints its own background — skip Qt's default frame.
if type(widget).__name__ == "AYLineEdit":
return
self._super.drawPrimitive(
QStyle.PrimitiveElement.PE_PanelLineEdit, option, painter, widget
)
|