Widgets
all widgets in this library are fork of PySide6 widgets, so you can back to PySide6 documentation to see more info about widgets.
Usage
As you know in PySide6.QtWidgets
there are set, get, and add functions, so when you write the name of a function of type set
or add
in the **kwargs
, that function will be executed with the value inserted.
from Qtica.widgets import Widget
from Qtica.utils import Args
Widget(
setWindowTitle: Args | Any = "Window Title",
addAction: list[Args | Any] = QAction()
)
to overwrite widget events you can use the events parameter
Widget(
events=[
("Event Name", lambda e: ...)
# Using enums.Events
(Events.mousePress, lambda e: ...)
]
)
to connect widget signals you can use the signals
parameter
signals
parameterWidget(
signals=[
("Signal Name", lambda: ...)
# Using enums.Signals
(Signals.clicked, lambda: ...)
]
)
to write inline Qt Style Sheet
Widget(
qss={
"background-color": "purple",
"font-size": "12px",
"color": "white"
}
)
the long press signal usage
Widget(
long_press_delay: int = 1000,
signals=[
("long_pressed", lambda: print("Long Press Active"))
]
)
set window attributes
Widget(
attrs: Union[list[Qt.WidgetAttribute], dict[Qt.WidgetAttribute, bool]] = None
)
set window flags
Widget(
flags: Union[list[Qt.WindowType], dict[Qt.WindowType, bool]] = None
)
run class method
Widget(
methods = [
("resize", QSize(200, 200)),
# Using Func class
Func("resize", 200, 200),
# Using Args class
("resize", Args(200, 200))
]
)
Last updated
Was this helpful?