Metadata-Version: 2.1
Name: autoqt6
Version: 0.0.7
Summary: Simplify pyqtProperty creation.
Home-page: https://github.com/jrj99/autoqt6/
Author: NaKyle Wright, Jared Jones
Author-email: jared.randall.jones@gmail.com
License: UNKNOWN
Keywords: PyQt,PyQt6,pyqtProperty,PySide6
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Software Development
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# autoqt
[![PyPI](https://badge.fury.io/py/autoqt.svg)](https://badge.fury.io/py/autoqt)
[![Build Status](https://semaphoreci.com/api/v1/chipolux/autoqt/branches/master/shields_badge.svg)](https://semaphoreci.com/chipolux/autoqt)

A simple single file module that makes setting up basic Qt properties a little
bit nicer without restricting you.

This is very useful if you have QObjects with many readonly properties and a
few special setters or state modifying slots.

Example:
```
from PyQt6.QtCore import pyqtSignal, pyqtSlot
from autoqt6 import AutoObject, AutoProp


class SomeObject(AutoObject):
    valuesChanged = pyqtSignal()

    aNumber = AutoProp(int, 'valuesChanged', '_aNumber')
    otherNumber = AutoProp(float, 'valuesChanged', '_otherNumber')
    aString = AutoProp(str, 'valuesChanged', '_aString', write=True)

    def __init__(self, parent=None):
        super().__init__(parent=parent)
        self._aNumber = 10
        self._otherNumber = 20
        self._aString = 'spam'

    @pyqtSlot()
    def incrementNumber(self):
        self._aNumber += 1
        self.valuesChanged.emit()

    @otherNumber.setter
    def otherNumber(self, value):
        self._otherNumber = value + 2
        self.valuesChanged.emit()


x = SomeObject()

print(x.aNumber)  # 10
x.aNumber = 10  # throws AttributeError, readonly property
x.incrementNumber()  # valuesChanged is emitted
print(x.aNumber)  # 11

print(x.otherNumber)  # 20
x.otherNumber = 40  #  otherNumber.setter called, valuesChanged is emitted
print(x.otherNumber)  # 42

print(x.aString)  # 'spam'
x.aString = 'ham'  # valuesChanged is emitted, writable property
print(x.aString)  # 'ham'
```


