Core
all Qtica base classes to implement codes and manage declarative style.
Classes
Api
AbstractBase
AbstractQObject
AbstractWidget
BehaviorDec
WidgetDec
QObjectDec
AbstractConfig
AbstractDec
AbstractDialog
AbstractIcons
AbstractPainter
AbstractTool
AbstractBase
Used to configure PySide6 tools to run in declarative mode.
AbstractQObject
It is used to configure PySide6 tools whose type is not QWidget to run in declarative mode, like QObject, or that have objectName method, events, and signals.
from Qtica import AbstractQObject
from PySide6.QtCore import QObject
class Object(AbstractQObject, QObject):
def __init__(self,
uid: str = None,
signals: SignalTypeVar = None,
events: EventTypeVar = None,
methods: Sequence[Union[tuple[str, Any], Func]] = None,
enable_event_stack: bool = True,
**kwargs):
QObject.__init__(self)
super().__init__(uid, signals, events, methods, enable_event_stack, **kwargs)
...
AbstractWidget
It is used to configure PySide6 widgets whose type is QWidget to run in declarative mode. like QWidget, or that have objectName, events, and signals, graphicsEffect, styleSheet, setAttribute, windowFlag.
from typing import Union
from PySide6.QtWidgets import QWidget
from Qtica import AbstractWidget
class Widget(AbstractWidget, QWidget):
def __init__(self,
long_press_delay: int = 1000,
effect: QGraphicsEffect = None,
qss: Union[str, dict, QStyleSheet] = None,
attrs: Union[list[Qt.WidgetAttribute], dict[Qt.WidgetAttribute, bool]] = None,
flags: Union[list[Qt.WindowType], dict[Qt.WindowType, bool]] = None,
**kwargs):
QWidget.__init__(self)
super().__init__(**kwargs)
...
BehaviorDec
to make __init__
the method returns a value!
NOTE: you can set uid
to fetch it using Api.fetch
from typing import Any
from Qtica import BehaviorDec
class Class(BehaviorDec):
def __init__(self, *args, **kwargs) -> Any:
return ...
QObjectDec
to make __init__
the method returns a value, with the QObject class type, in a word it's the mix between AbstractQObject or AbstractWidget and BehaviorDec.
from typing import Any
from Qtica import QObjectDec
class Object(ObjectDec, QObject):
def __init__(self, **kwargs):
QObject.__init__(self)
super().__init__(**kwargs)
return ...
WidgetDec
from typing import Any
from Qtica import WidgetDec
class Widget(WidgetDec, QWidget):
def __init__(self, **kwargs):
QWidget.__init__(self)
super().__init__(**kwargs)
return ...
Api
we can say that's like a provider in Flutter!
from Qtica import Api
Window(
uid="window",
home=Widget(
uid="child-widget"
)
)
Api.fetch("child-widget") # -> Widget class
AbstractTool
AbstractTool means that the object doesn't contain base methods like objectName, or setProperty.
from Qtica import AbstractTool
from PySide6.QtGui import QPen
class Tool(AbstractTool, QPen):
def __init__(self, *, methods: Sequence[Union[tuple[str, Any], Func]] = None, **kwargs):
QPen.__init__(self)
super().__init__(methods=methods, **kwargs)
Last updated
Was this helpful?