- 
    Bug 
- 
    Resolution: Fixed
- 
    P4: Low 
- 
    6.5.3
- 
    None
- 
        
- 
        141d596d1 (dev), 32c6c4e0e (6.7), f0b88e6a3 (tqtc/lts-6.5)
The typing of QObject.findChild and QObject.findChildren can be extended so that it returns objects of the type supplied. Current code:
def findChild(self, type: type, name: str = ..., options: PySide6.QtCore.Qt.FindChildOption = ...) 
   -> object: ...
@overload
def findChildren(self, type: type, name: str = ..., options: PySide6.QtCore.Qt.FindChildOption = ...)
    -> Iterable: ...
@overload
def findChildren(self, type: type, pattern: Union[PySide6.QtCore.QRegularExpression, str], 
      options: PySide6.QtCore.Qt.FindChildOption = ...)
     -> Iterable: ...
A type variable could be used to dynamically annotate the returned type. Expected:
ObjectT = TypeVar("ObjectT", bound=QObject)
def findChild(self, type: type[ObjectT], name: str = ..., options: PySide6.QtCore.Qt.FindChildOption = ...)
       -> ObjectT: ...
@overload
def findChildren(self, type: type[ObjectT], name: str = ..., options: PySide6.QtCore.Qt.FindChildOption = ...)
    -> Iterable[ObjectT]: ...
@overload
def findChildren(self, type: type[ObjectT], pattern: Union[PySide6.QtCore.QRegularExpression, str], options: PySide6.QtCore.Qt.FindChildOption = ...) 
    -> Iterable[ObjectT]: ...
AFAIK, the returned object for findChildren is always a list.
Also, the returned object for findChild can be None, so it should be optional?