# Core

## Classes

* Api
* AbstractBase
* AbstractQObject
* AbstractWidget
* BehaviorDec
* WidgetDec&#x20;
* 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.

```python
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.

<pre class="language-python"><code class="lang-python"><strong>from typing import Union
</strong>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)
        ...
</code></pre>

## BehaviorDec

to make `__init__` the method returns a value!

NOTE: you can set `uid` to fetch it using `Api.fetch`

```python
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.

```python
from typing import Any
from Qtica import QObjectDec

class Object(ObjectDec, QObject):
    def __init__(self, **kwargs):
        QObject.__init__(self)
        super().__init__(**kwargs)

        return ...
```

## WidgetDec

```python
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**!

{% tabs %}
{% tab title="Direct Access" %}

<pre class="language-python"><code class="lang-python"><strong>from Qtica import Api
</strong><strong>
</strong><strong>Window(
</strong>    uid="window",
    home=Widget(
            uid="child-widget"
        )
)

Api.fetch("child-widget") # -> Widget class
</code></pre>

{% endtab %}

{% tab title="Create Obj" %}

```python
widget = Widget(
    uid="child-widget"
)

parent = Window(
    uid="window",
    home=widget
)

# way 1
api = Api(parent)
api.get("child-widget") # -> Widget class

# way 2
api = Api(parent)("child-widget") # -> Widget class
```

{% endtab %}
{% endtabs %}

## AbstractTool

AbstractTool means that the object doesn't contain base methods like objectName, or setProperty.

```python
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)

```
