from .qt import QColor as QColor, QKeySequence as QKeySequence, QObject as QObject, Signal as Signal
from _typeshed import Incomplete
from enum import Enum
from packaging.version import Version
from pathlib import Path
from typing import Iterable

class QOptionValidator:
    def validate(self, value) -> bool: ...
    def correct(self, value) -> object: ...

class QRangeValidator(QOptionValidator):
    min: Incomplete
    max: Incomplete
    range: Incomplete
    def __init__(self, min: float | int, max: float | int) -> None: ...
    def validate(self, value: float | int): ...
    def correct(self, value): ...

class QStringValidator(QOptionValidator):
    def validate(self, value) -> bool: ...

class QListValidator(QOptionValidator):
    def __init__(self, itemValidator: QOptionValidator) -> None: ...
    def validate(self, value: Iterable) -> bool: ...
    def correct(self, value: Iterable) -> list[object]: ...

class QSizeValidator(QOptionValidator):
    def validate(self, value) -> bool: ...

class QSizeFValidator(QOptionValidator):
    def validate(self, value) -> bool: ...

class QFolderValidator(QOptionValidator):
    def validate(self, value): ...
    def correct(self, value) -> None: ...

class QShortcutValidator(QOptionValidator):
    def validate(self, value): ...

class QColorValidator(QOptionValidator):
    def validate(self, color): ...
    def correct(self, value) -> None: ...

class QMultiOptionsValidator(QOptionValidator):
    options: Incomplete
    def __init__(self, options: list | type[Enum]) -> None: ...
    def validate(self, value) -> bool: ...
    def correct(self, value) -> object: ...

class QEnumValidator(QMultiOptionsValidator):
    def __init__(self, enumClass: type[Enum]) -> None: ...

class QBoolValidator(QMultiOptionsValidator):
    def __init__(self) -> None: ...

class QObjectSerializer:
    def serialize(self, value): ...
    def deserialize(self, value): ...

class QEnumSerializer(QObjectSerializer):
    enumClass: Incomplete
    def __init__(self, enumClass: type[Enum]) -> None: ...
    def serialize(self, value: Enum): ...
    def deserialize(self, value: str | int) -> Enum: ...

class QColorSerializer(QObjectSerializer):
    def serialize(self, value: QColor): ...
    def deserialize(self, value: str) -> QColor: ...

class QShortcutSerializer(QObjectSerializer):
    def serialize(self, value: QKeySequence): ...
    def deserialize(self, value: str) -> QKeySequence: ...

class QOptionItem(QObject):
    valueChanged: Incomplete
    def __init__(self, section: str, option: str, default: object, validator: QOptionValidator, serializer: QObjectSerializer, restart: bool = False) -> None: ...
    @property
    def value(self) -> object: ...
    @value.setter
    def value(self, v) -> None: ...
    @property
    def default(self) -> object: ...
    @property
    def key(self) -> str: ...
    @property
    def section(self) -> str: ...
    @property
    def option(self) -> str: ...
    def toStr(self) -> str: ...
    def fromStr(self, string: str) -> bool: ...
    def validate(self, value): ...

class QUserConfig:
    def __init__(self) -> None: ...
    def addOption(self, section: str, option: str, default: object, validator: QOptionValidator, serializer: QObjectSerializer = ..., restart: bool = False) -> QOptionItem: ...
    def options(self) -> list[QOptionItem]: ...
    def option(self, section: str, option: str): ...
    def read(self, file: Path) -> Version | None: ...
    def save(self, file: Path, version: Version): ...
    def checkFileVersion(self, filepath) -> Version: ...
