Skip to content

core

Class info

Classes

Name Children Inherits
AbstractAnimation
prettyqt.core.abstractanimation
    AbstractAnimationMixin
    prettyqt.core.abstractanimation
    The base of all animations.
    AbstractEventDispatcher
    prettyqt.core.abstracteventdispatcher
    Interface to manage Qt's event queue.
      AbstractItemModel
      prettyqt.core.abstractitemmodel
      The abstract interface for item model classes.
      AbstractItemModelMixin
      prettyqt.core.abstractitemmodel
      AbstractListModel
      prettyqt.core.abstractlistmodel
      Abstract model that can be subclassed to create one-dimensional list models.
        AbstractListModelMixin
        prettyqt.core.abstractlistmodel
        AbstractNativeEventFilter
        prettyqt.core.abstractnativeeventfilter
        Interface for receiving native events, such as MSG or XCB event structs.
          AbstractProxyModel
          prettyqt.core.abstractproxymodel
          Base class for proxy item models that can do sorting, filtering and processing.
          AbstractProxyModelMixin
          prettyqt.core.abstractproxymodel
          AbstractTableModel
          prettyqt.core.abstracttablemodel
          Abstract model that can be subclassed to create table models.
          AbstractTableModelMixin
          prettyqt.core.abstracttablemodel
          AnimationGroup
          prettyqt.core.animationgroup
          Abstract base class for groups of animations.
            AnimationGroupMixin
            prettyqt.core.animationgroup
            AsyncBridge
            prettyqt.core.aio
            Runs a standard `asyncio` loop in a background thread bridged to Qt.
              BasicTimer
              prettyqt.core.basictimer
              Timer events for objects.
                BluetoothPermission
                prettyqt.core.bluetoothpermission
                Access Bluetooth peripherals.
                  Buffer
                  prettyqt.core.buffer
                  QIODevice interface for a QByteArray.
                    ByteArray
                    prettyqt.core.bytearray
                    Array of bytes.
                      ByteArrayMatcher
                      prettyqt.core.bytearraymatcher
                      Holds a sequence of bytes that can be quickly matched in a byte array.
                        Calendar
                        prettyqt.core._calendar
                        Describes calendar systems.
                          CalendarPermission
                          prettyqt.core.calendarpermission
                          Access the user's calendar.
                            CameraPermission
                            prettyqt.core.camerapermission
                            Access the camera for taking pictures or videos.
                              Collator
                              prettyqt.core.collator
                              Compares strings according to a localized collation algorithm.
                                CollatorSortKey
                                prettyqt.core.collatorsortkey
                                Can be used to speed up string collation.
                                  CommandLineOption
                                  prettyqt.core.commandlineoption
                                  Defines a possible command-line option.
                                    CommandLineParser
                                    prettyqt.core.commandlineparser
                                    Means for handling the command line options.
                                      ConcatenateTablesProxyModel
                                      prettyqt.core.concatenatetablesproxymodel
                                      Proxies multiple source models, concatenating their rows.
                                        ContactsPermission
                                        prettyqt.core.contactspermission
                                        Access the user's contacts.
                                          CoreApplication
                                          prettyqt.core.coreapplication
                                          Event loop for Qt applications without UI.
                                            CoreApplicationMixin
                                            prettyqt.core.coreapplication
                                            CryptographicHash
                                            prettyqt.core.cryptographichash
                                            Way to generate cryptographic hashes.
                                              DataStream
                                              prettyqt.core.datastream
                                              Serialization of binary data to a QIODevice.
                                                Date
                                                prettyqt.core.date
                                                Date functions.
                                                  DateTime
                                                  prettyqt.core._datetime
                                                  DateTime funcitons.
                                                    DeadlineTimer
                                                    prettyqt.core.deadlinetimer
                                                    Marks a deadline in the future.
                                                      Dir
                                                      prettyqt.core.dir
                                                      Access to directory structures and their contents.
                                                        DirIterator
                                                        prettyqt.core.diriterator
                                                        Iterator for directory entrylists.
                                                          EasingCurve
                                                          prettyqt.core.easingcurve
                                                          Easing curves for controlling animation.
                                                            ElapsedTimer
                                                            prettyqt.core.elapsedtimer
                                                            Fast way to calculate elapsed times.
                                                              Event
                                                              prettyqt.core.event
                                                              The base class of all event classes. Event objects contain event parameters.
                                                                EventLoop
                                                                prettyqt.core.eventloop
                                                                Means of entering and leaving an event loop.
                                                                  File
                                                                  prettyqt.core.file
                                                                  Interface for reading from and writing to files.
                                                                    FileDevice
                                                                    prettyqt.core.filedevice
                                                                      FileDeviceMixin
                                                                      prettyqt.core.filedevice
                                                                      Interface for reading from and writing to open files.
                                                                      FileInfo
                                                                      prettyqt.core.fileinfo
                                                                      System-independent file information.
                                                                        FileMixin
                                                                        prettyqt.core.file
                                                                        FileSelector
                                                                        prettyqt.core.fileselector
                                                                        Convenient way of selecting file variants.
                                                                          FileSystemWatcher
                                                                          prettyqt.core.filesystemwatcher
                                                                          Interface for monitoring files and directories for modifications.
                                                                            IODevice
                                                                            prettyqt.core.iodevice
                                                                            The base interface class of all I/O devices in Qt.
                                                                              IODeviceMixin
                                                                              prettyqt.core.iodevice
                                                                              IdentityProxyModel
                                                                              prettyqt.core.identityproxymodel
                                                                              Proxies its source model unmodified.
                                                                              ItemSelection
                                                                              prettyqt.core.itemselection
                                                                              Manages information about selected items in a model.
                                                                                ItemSelectionModel
                                                                                prettyqt.core.itemselectionmodel
                                                                                Keeps track of a view's selected items.
                                                                                ItemSelectionRange
                                                                                prettyqt.core.itemselectionrange
                                                                                Manages information about a range of selected items in a model.
                                                                                  JsonDocument
                                                                                  prettyqt.core.jsondocument
                                                                                  Way to read and write JSON documents.
                                                                                    JsonValue
                                                                                    prettyqt.core.jsonvalue
                                                                                    Encapsulates a value in JSON.
                                                                                      KeyCombination
                                                                                      prettyqt.core.keycombination
                                                                                      Stores a combination of a key with optional modifiers.
                                                                                        Library
                                                                                        prettyqt.core.library
                                                                                        Loads shared libraries at runtime.
                                                                                          LibraryInfo
                                                                                          prettyqt.core.libraryinfo
                                                                                          Information about the Qt library.
                                                                                            Line
                                                                                            prettyqt.core.line
                                                                                            Two-dimensional vector using integer precision.
                                                                                              LineF
                                                                                              prettyqt.core.linef
                                                                                              Two-dimensional vector using floating point precision.
                                                                                                Locale
                                                                                                prettyqt.core._locale
                                                                                                Converts between numbers and their string representations in various languages.
                                                                                                  LocationPermission
                                                                                                  prettyqt.core.locationpermission
                                                                                                  Access the user's location.
                                                                                                    LockFile
                                                                                                    prettyqt.core.lockfile
                                                                                                    Locking between processes using a file.
                                                                                                      LoggingCategory
                                                                                                      prettyqt.core.loggingcategory
                                                                                                      Represents a category, or 'area' in the logging infrastructure.
                                                                                                        Margins
                                                                                                        prettyqt.core.margins
                                                                                                        Defines the four margins of a rectangle.
                                                                                                          MarginsF
                                                                                                          prettyqt.core.marginsf
                                                                                                          Defines the four margins of a rectangle (floating point precision).
                                                                                                            MessageAuthenticationCode
                                                                                                            prettyqt.core.messageauthenticationcode
                                                                                                            Way to generate hash-based message authentication codes (HMAC).
                                                                                                              MetaEnum
                                                                                                              prettyqt.core.metaenum
                                                                                                              Meta-data about an enumerator.
                                                                                                                MetaMethod
                                                                                                                prettyqt.core.metamethod
                                                                                                                Meta-data about an member method.
                                                                                                                  MetaObject
                                                                                                                  prettyqt.core.metaobject
                                                                                                                  Contains meta-information about Qt objects.
                                                                                                                    MetaProperty
                                                                                                                    prettyqt.core.metaproperty
                                                                                                                    Meta-data about a property.
                                                                                                                      MetaType
                                                                                                                      prettyqt.core.metatype
                                                                                                                      Manages named types in the meta-object system.
                                                                                                                        MicrophonePermission
                                                                                                                        prettyqt.core.microphonepermission
                                                                                                                        Access the microphone for monitoring or recording sound.
                                                                                                                          MimeData
                                                                                                                          prettyqt.core.mimedata
                                                                                                                          Container for data that records information about its MIME type.
                                                                                                                            MimeDatabase
                                                                                                                            prettyqt.core.mimedatabase
                                                                                                                            Maintains a database of MIME types.
                                                                                                                              MimeType
                                                                                                                              prettyqt.core.mimetype
                                                                                                                              Describes types of file or data, represented by a MIME type string.
                                                                                                                                ModelRoleData
                                                                                                                                prettyqt.core.modelroledata
                                                                                                                                Holds a role and the data associated to that role.
                                                                                                                                  Mutex
                                                                                                                                  prettyqt.core.mutex
                                                                                                                                  Access serialization between threads.
                                                                                                                                    NativeIpcKey
                                                                                                                                    prettyqt.core.nativeipckey
                                                                                                                                    Holds a native key used by QSystemSemaphore and QSharedMemory.
                                                                                                                                      Object
                                                                                                                                      prettyqt.core.object
                                                                                                                                      The base class of all Qt objects.
                                                                                                                                      ObjectMixin
                                                                                                                                      prettyqt.core.object
                                                                                                                                      OperatingSystemVersion
                                                                                                                                      prettyqt.core.operatingsystemversion
                                                                                                                                      Information about the operating system version.
                                                                                                                                        ParallelAnimationGroup
                                                                                                                                        prettyqt.core.parallelanimationgroup
                                                                                                                                        Parallel group of animations.
                                                                                                                                        PauseAnimation
                                                                                                                                        prettyqt.core.pauseanimation
                                                                                                                                        Pause for QSequentialAnimationGroup.
                                                                                                                                          Permission
                                                                                                                                          prettyqt.core.permission
                                                                                                                                          Opaque wrapper of a typed permission.
                                                                                                                                            PersistentModelIndex
                                                                                                                                            prettyqt.core.persistentmodelindex
                                                                                                                                            Used to locate data in a data model.
                                                                                                                                              PluginLoader
                                                                                                                                              prettyqt.core.pluginloader
                                                                                                                                              Load a plugin at runtime.
                                                                                                                                                Process
                                                                                                                                                prettyqt.core.process
                                                                                                                                                Used to start external programs and to communicate with them.
                                                                                                                                                  ProcessEnvironment
                                                                                                                                                  prettyqt.core.processenvironment
                                                                                                                                                  Holds the environment variables that can be passed to a program.
                                                                                                                                                    PropertyAnimation
                                                                                                                                                    prettyqt.core.propertyanimation
                                                                                                                                                    Animates Qt properties.
                                                                                                                                                    RandomGenerator
                                                                                                                                                    prettyqt.core.randomgenerator
                                                                                                                                                    Allows one to obtain random values from a high-quality Random Number Generator.
                                                                                                                                                      RangeModel
                                                                                                                                                      prettyqt.core.rangemodel
                                                                                                                                                      Item model wrapping a Python sequence or table range.
                                                                                                                                                        ReadWriteLock
                                                                                                                                                        prettyqt.core.readwritelock
                                                                                                                                                        Read-write locking between threads.
                                                                                                                                                          RegularExpression
                                                                                                                                                          prettyqt.core.regularexpression
                                                                                                                                                          Pattern matching using regular expressions.
                                                                                                                                                            RegularExpressionMatch
                                                                                                                                                            prettyqt.core.regularexpressionmatch
                                                                                                                                                            The results of a matching a QRegularExpression against a string.
                                                                                                                                                              RegularExpressionMatchIterator
                                                                                                                                                              prettyqt.core.regularexpressionmatchiterator
                                                                                                                                                              Iterator on the results of a global match of a QRegularExpression.
                                                                                                                                                                Resource
                                                                                                                                                                prettyqt.core._resource
                                                                                                                                                                Interface for reading directly from resources.
                                                                                                                                                                  Runnable
                                                                                                                                                                  prettyqt.core.runnable
                                                                                                                                                                  The base class for all runnable objects.
                                                                                                                                                                  • Worker
                                                                                                                                                                  SaveFile
                                                                                                                                                                  prettyqt.core.savefile
                                                                                                                                                                  Interface for safely writing to files.
                                                                                                                                                                    Semaphore
                                                                                                                                                                    prettyqt.core.semaphore
                                                                                                                                                                    General counting semaphore.
                                                                                                                                                                      SequentialAnimationGroup
                                                                                                                                                                      prettyqt.core.sequentialanimationgroup
                                                                                                                                                                      Sequential group of animations.
                                                                                                                                                                        Settings
                                                                                                                                                                        prettyqt.core.settings
                                                                                                                                                                        Settings class which wraps everything into a dict to preserve data types.
                                                                                                                                                                          • Settings_
                                                                                                                                                                          SharedMemory
                                                                                                                                                                          prettyqt.core.sharedmemory
                                                                                                                                                                          Access to a shared memory segment.
                                                                                                                                                                            SignalBlocker
                                                                                                                                                                            prettyqt.core.signalblocker
                                                                                                                                                                            Exception-safe wrapper around QObject.blockSignals().
                                                                                                                                                                              SignalMapper
                                                                                                                                                                              prettyqt.core.signalmapper
                                                                                                                                                                              Bundles signals from identifiable senders.
                                                                                                                                                                                Size
                                                                                                                                                                                prettyqt.core.size
                                                                                                                                                                                Defines the size of a two-dimensional object using integer point precision.
                                                                                                                                                                                  SizeF
                                                                                                                                                                                  prettyqt.core.sizef
                                                                                                                                                                                  Defines the size of a two-dimensional object using floating point precision.
                                                                                                                                                                                    SocketNotifier
                                                                                                                                                                                    prettyqt.core.socketnotifier
                                                                                                                                                                                    Support for monitoring activity on a file descriptor.
                                                                                                                                                                                      SortFilterProxyModel
                                                                                                                                                                                      prettyqt.core.sortfilterproxymodel
                                                                                                                                                                                      Support for sorting and filtering data passed between another model and a view.
                                                                                                                                                                                      StandardPaths
                                                                                                                                                                                      prettyqt.core.standardpaths
                                                                                                                                                                                      Methods for accessing standard paths.
                                                                                                                                                                                        StorageInfo
                                                                                                                                                                                        prettyqt.core.storageinfo
                                                                                                                                                                                        Provides information about currently mounted storage and drives.
                                                                                                                                                                                          StringConverter
                                                                                                                                                                                          prettyqt.core.stringconverter
                                                                                                                                                                                          Base class for encoding and decoding text.
                                                                                                                                                                                            StringConverterMixin
                                                                                                                                                                                            prettyqt.core.stringconverter
                                                                                                                                                                                            StringDecoder
                                                                                                                                                                                            prettyqt.core.stringdecoder
                                                                                                                                                                                            State-based decoder for text.
                                                                                                                                                                                              StringEncoder
                                                                                                                                                                                              prettyqt.core.stringencoder
                                                                                                                                                                                              State-based encoder for text.
                                                                                                                                                                                                StringListModel
                                                                                                                                                                                                prettyqt.core.stringlistmodel
                                                                                                                                                                                                Model that supplies strings to views.
                                                                                                                                                                                                • IconModel
                                                                                                                                                                                                StringListModelMixin
                                                                                                                                                                                                prettyqt.core.stringlistmodel
                                                                                                                                                                                                TemporaryDir
                                                                                                                                                                                                prettyqt.core.temporarydir
                                                                                                                                                                                                Creates a unique directory for temporary use.
                                                                                                                                                                                                  TemporaryFile
                                                                                                                                                                                                  prettyqt.core.temporaryfile
                                                                                                                                                                                                  I/O device that operates on temporary files.
                                                                                                                                                                                                    TextBoundaryFinder
                                                                                                                                                                                                    prettyqt.core.textboundaryfinder
                                                                                                                                                                                                    Way of finding Unicode text boundaries in a string.
                                                                                                                                                                                                      TextStream
                                                                                                                                                                                                      prettyqt.core.textstream
                                                                                                                                                                                                      Convenient interface for reading and writing text.
                                                                                                                                                                                                        Thread
                                                                                                                                                                                                        prettyqt.core.thread
                                                                                                                                                                                                        Platform-independent way to manage threads.
                                                                                                                                                                                                          ThreadPool
                                                                                                                                                                                                          prettyqt.core.threadpool
                                                                                                                                                                                                          Manages a collection of QThreads.
                                                                                                                                                                                                            Time
                                                                                                                                                                                                            prettyqt.core._time
                                                                                                                                                                                                            Clock time functions.
                                                                                                                                                                                                              TimeLine
                                                                                                                                                                                                              prettyqt.core.timeline
                                                                                                                                                                                                              Timeline for controlling animations.
                                                                                                                                                                                                                TimeZone
                                                                                                                                                                                                                prettyqt.core.timezone
                                                                                                                                                                                                                Identifies how a time representation relates to UTC.
                                                                                                                                                                                                                  Timer
                                                                                                                                                                                                                  prettyqt.core.timer
                                                                                                                                                                                                                  Repetitive and single-shot timers.
                                                                                                                                                                                                                  • AnimationTimer
                                                                                                                                                                                                                  Translator
                                                                                                                                                                                                                  prettyqt.core.translator
                                                                                                                                                                                                                  Internationalization support for text output.
                                                                                                                                                                                                                    TransposeProxyModel
                                                                                                                                                                                                                    prettyqt.core.transposeproxymodel
                                                                                                                                                                                                                    This proxy transposes the source model.
                                                                                                                                                                                                                      Url
                                                                                                                                                                                                                      prettyqt.core.url
                                                                                                                                                                                                                      Convenient interface for working with URLs.
                                                                                                                                                                                                                        UrlQuery
                                                                                                                                                                                                                        prettyqt.core.urlquery
                                                                                                                                                                                                                        Way to manipulate a key-value pairs in a URL's query.
                                                                                                                                                                                                                          Uuid
                                                                                                                                                                                                                          prettyqt.core._uuid
                                                                                                                                                                                                                          Stores a Universally Unique Identifier (UUID).
                                                                                                                                                                                                                            UuidMixin
                                                                                                                                                                                                                            prettyqt.core._uuid
                                                                                                                                                                                                                            VariantAnimation
                                                                                                                                                                                                                            prettyqt.core.variantanimation
                                                                                                                                                                                                                            Base class for animations.
                                                                                                                                                                                                                            VariantAnimationMixin
                                                                                                                                                                                                                            prettyqt.core.variantanimation
                                                                                                                                                                                                                            VersionNumber
                                                                                                                                                                                                                            prettyqt.core.versionnumber
                                                                                                                                                                                                                            Contains a version number with an arbitrary number of segments.
                                                                                                                                                                                                                              XmlStreamReader
                                                                                                                                                                                                                              prettyqt.core.xmlstreamreader
                                                                                                                                                                                                                              Fast parser for reading well-formed XML via a simple streaming API.
                                                                                                                                                                                                                                XmlStreamWriter
                                                                                                                                                                                                                                prettyqt.core.xmlstreamwriter
                                                                                                                                                                                                                                XML writer with a simple streaming API.

                                                                                                                                                                                                                                  🛈 DocStrings

                                                                                                                                                                                                                                  Core non-graphical classes used by other modules.

                                                                                                                                                                                                                                  AbstractAnimationMixin

                                                                                                                                                                                                                                  Bases: ObjectMixin, _AbstractAnimationBase

                                                                                                                                                                                                                                  The base of all animations.

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractanimation.py
                                                                                                                                                                                                                                  class AbstractAnimationMixin(core.ObjectMixin, _AbstractAnimationBase):
                                                                                                                                                                                                                                      """The base of all animations."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __len__(self):
                                                                                                                                                                                                                                          return self.duration()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __and__(self, other: core.QAbstractAnimation) -> core.SequentialAnimationGroup:
                                                                                                                                                                                                                                          group = core.SequentialAnimationGroup()
                                                                                                                                                                                                                                          group.addAnimation(self)
                                                                                                                                                                                                                                          group.addAnimation(other)
                                                                                                                                                                                                                                          return group
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __or__(self, other: core.QAbstractAnimation) -> core.ParallelAnimationGroup:
                                                                                                                                                                                                                                          group = core.ParallelAnimationGroup()
                                                                                                                                                                                                                                          group.addAnimation(self)
                                                                                                                                                                                                                                          group.addAnimation(other)
                                                                                                                                                                                                                                          return group
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def _get_map(self):
                                                                                                                                                                                                                                          maps = super()._get_map()
                                                                                                                                                                                                                                          maps |= {"direction": DIRECTION, "state": STATE}
                                                                                                                                                                                                                                          return maps
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def toggle_direction(self):
                                                                                                                                                                                                                                          direction = AbstractAnimation.Direction
                                                                                                                                                                                                                                          is_forward = self.direction() == direction.Forward
                                                                                                                                                                                                                                          direction = direction.Backward if is_forward else direction.Forward
                                                                                                                                                                                                                                          self.setDirection(direction)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_direction(self, direction: DirectionStr | core.QAbstractAnimation.Direction):
                                                                                                                                                                                                                                          """Set animation direction.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              direction: animation direction
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setDirection(DIRECTION.get_enum_value(direction))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_direction(self) -> DirectionStr:
                                                                                                                                                                                                                                          """Get the current animation direction.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              animation direction
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return DIRECTION.inverse[self.direction()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_state(self) -> StateStr:
                                                                                                                                                                                                                                          """Get the current animation state.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              animation state
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return STATE.inverse[self.state()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def start_animation(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          policy: DeletionPolicyStr | core.QAbstractAnimation.DeletionPolicy = "keep",
                                                                                                                                                                                                                                          interval: int = 0,
                                                                                                                                                                                                                                          single_shot: bool = True,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Start the animation.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              policy: animation policy
                                                                                                                                                                                                                                              interval: time interval / delay for timer
                                                                                                                                                                                                                                              single_shot: whether animation gets triggered once or in intervals
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          policy_ = DELETION_POLICY.get_enum_value(policy)
                                                                                                                                                                                                                                          if interval:
                                                                                                                                                                                                                                              fn = functools.partial(self.start, policy_)
                                                                                                                                                                                                                                              self.start_callback_timer(fn, interval, single_shot=single_shot)
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              self.start(policy_)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def restart_animation(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          policy: DeletionPolicyStr | core.QAbstractAnimation.DeletionPolicy = "keep",
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Restart the animation.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              policy: animation policy
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.stop()
                                                                                                                                                                                                                                          self.start_animation(policy)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def run(self, delay: int = 0, single_shot: bool = True):
                                                                                                                                                                                                                                          self.start_callback_timer(self.start, delay, single_shot=single_shot)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_direction() -> DirectionStr

                                                                                                                                                                                                                                  Get the current animation direction.

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractanimation.py
                                                                                                                                                                                                                                  def get_direction(self) -> DirectionStr:
                                                                                                                                                                                                                                      """Get the current animation direction.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          animation direction
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return DIRECTION.inverse[self.direction()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_state() -> StateStr

                                                                                                                                                                                                                                  Get the current animation state.

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractanimation.py
                                                                                                                                                                                                                                  def get_state(self) -> StateStr:
                                                                                                                                                                                                                                      """Get the current animation state.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          animation state
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return STATE.inverse[self.state()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  restart_animation(policy: DeletionPolicyStr | core.QAbstractAnimation.DeletionPolicy = 'keep')

                                                                                                                                                                                                                                  Restart the animation.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  policy DeletionPolicyStr | DeletionPolicy

                                                                                                                                                                                                                                  animation policy

                                                                                                                                                                                                                                  'keep'
                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractanimation.py
                                                                                                                                                                                                                                  def restart_animation(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      policy: DeletionPolicyStr | core.QAbstractAnimation.DeletionPolicy = "keep",
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Restart the animation.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          policy: animation policy
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.stop()
                                                                                                                                                                                                                                      self.start_animation(policy)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_direction(direction: DirectionStr | core.QAbstractAnimation.Direction)

                                                                                                                                                                                                                                  Set animation direction.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  direction DirectionStr | Direction

                                                                                                                                                                                                                                  animation direction

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractanimation.py
                                                                                                                                                                                                                                  def set_direction(self, direction: DirectionStr | core.QAbstractAnimation.Direction):
                                                                                                                                                                                                                                      """Set animation direction.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          direction: animation direction
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setDirection(DIRECTION.get_enum_value(direction))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  start_animation(policy: DeletionPolicyStr | core.QAbstractAnimation.DeletionPolicy = 'keep', interval: int = 0, single_shot: bool = True)

                                                                                                                                                                                                                                  Start the animation.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  policy DeletionPolicyStr | DeletionPolicy

                                                                                                                                                                                                                                  animation policy

                                                                                                                                                                                                                                  'keep'
                                                                                                                                                                                                                                  interval int

                                                                                                                                                                                                                                  time interval / delay for timer

                                                                                                                                                                                                                                  0
                                                                                                                                                                                                                                  single_shot bool

                                                                                                                                                                                                                                  whether animation gets triggered once or in intervals

                                                                                                                                                                                                                                  True
                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractanimation.py
                                                                                                                                                                                                                                  def start_animation(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      policy: DeletionPolicyStr | core.QAbstractAnimation.DeletionPolicy = "keep",
                                                                                                                                                                                                                                      interval: int = 0,
                                                                                                                                                                                                                                      single_shot: bool = True,
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Start the animation.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          policy: animation policy
                                                                                                                                                                                                                                          interval: time interval / delay for timer
                                                                                                                                                                                                                                          single_shot: whether animation gets triggered once or in intervals
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      policy_ = DELETION_POLICY.get_enum_value(policy)
                                                                                                                                                                                                                                      if interval:
                                                                                                                                                                                                                                          fn = functools.partial(self.start, policy_)
                                                                                                                                                                                                                                          self.start_callback_timer(fn, interval, single_shot=single_shot)
                                                                                                                                                                                                                                      else:
                                                                                                                                                                                                                                          self.start(policy_)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  AbstractEventDispatcher

                                                                                                                                                                                                                                  Bases: ObjectMixin, QAbstractEventDispatcher

                                                                                                                                                                                                                                  Interface to manage Qt's event queue.

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstracteventdispatcher.py
                                                                                                                                                                                                                                  class AbstractEventDispatcher(core.ObjectMixin, core.QAbstractEventDispatcher):
                                                                                                                                                                                                                                      """Interface to manage Qt's event queue."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  AbstractItemModel

                                                                                                                                                                                                                                  Bases: AbstractItemModelMixin, QAbstractItemModel

                                                                                                                                                                                                                                  The abstract interface for item model classes.

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractitemmodel.py
                                                                                                                                                                                                                                  class AbstractItemModel(AbstractItemModelMixin, core.QAbstractItemModel):
                                                                                                                                                                                                                                      """The abstract interface for item model classes."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  AbstractItemModelMixin

                                                                                                                                                                                                                                  Bases: ObjectMixin, _AbstractItemModelBase

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractitemmodel.py
                                                                                                                                                                                                                                   50
                                                                                                                                                                                                                                   51
                                                                                                                                                                                                                                   52
                                                                                                                                                                                                                                   53
                                                                                                                                                                                                                                   54
                                                                                                                                                                                                                                   55
                                                                                                                                                                                                                                   56
                                                                                                                                                                                                                                   57
                                                                                                                                                                                                                                   58
                                                                                                                                                                                                                                   59
                                                                                                                                                                                                                                   60
                                                                                                                                                                                                                                   61
                                                                                                                                                                                                                                   62
                                                                                                                                                                                                                                   63
                                                                                                                                                                                                                                   64
                                                                                                                                                                                                                                   65
                                                                                                                                                                                                                                   66
                                                                                                                                                                                                                                   67
                                                                                                                                                                                                                                   68
                                                                                                                                                                                                                                   69
                                                                                                                                                                                                                                   70
                                                                                                                                                                                                                                   71
                                                                                                                                                                                                                                   72
                                                                                                                                                                                                                                   73
                                                                                                                                                                                                                                   74
                                                                                                                                                                                                                                   75
                                                                                                                                                                                                                                   76
                                                                                                                                                                                                                                   77
                                                                                                                                                                                                                                   78
                                                                                                                                                                                                                                   79
                                                                                                                                                                                                                                   80
                                                                                                                                                                                                                                   81
                                                                                                                                                                                                                                   82
                                                                                                                                                                                                                                   83
                                                                                                                                                                                                                                   84
                                                                                                                                                                                                                                   85
                                                                                                                                                                                                                                   86
                                                                                                                                                                                                                                   87
                                                                                                                                                                                                                                   88
                                                                                                                                                                                                                                   89
                                                                                                                                                                                                                                   90
                                                                                                                                                                                                                                   91
                                                                                                                                                                                                                                   92
                                                                                                                                                                                                                                   93
                                                                                                                                                                                                                                   94
                                                                                                                                                                                                                                   95
                                                                                                                                                                                                                                   96
                                                                                                                                                                                                                                   97
                                                                                                                                                                                                                                   98
                                                                                                                                                                                                                                   99
                                                                                                                                                                                                                                  100
                                                                                                                                                                                                                                  101
                                                                                                                                                                                                                                  102
                                                                                                                                                                                                                                  103
                                                                                                                                                                                                                                  104
                                                                                                                                                                                                                                  105
                                                                                                                                                                                                                                  106
                                                                                                                                                                                                                                  107
                                                                                                                                                                                                                                  108
                                                                                                                                                                                                                                  109
                                                                                                                                                                                                                                  110
                                                                                                                                                                                                                                  111
                                                                                                                                                                                                                                  112
                                                                                                                                                                                                                                  113
                                                                                                                                                                                                                                  114
                                                                                                                                                                                                                                  115
                                                                                                                                                                                                                                  116
                                                                                                                                                                                                                                  117
                                                                                                                                                                                                                                  118
                                                                                                                                                                                                                                  119
                                                                                                                                                                                                                                  120
                                                                                                                                                                                                                                  121
                                                                                                                                                                                                                                  122
                                                                                                                                                                                                                                  123
                                                                                                                                                                                                                                  124
                                                                                                                                                                                                                                  125
                                                                                                                                                                                                                                  126
                                                                                                                                                                                                                                  127
                                                                                                                                                                                                                                  128
                                                                                                                                                                                                                                  129
                                                                                                                                                                                                                                  130
                                                                                                                                                                                                                                  131
                                                                                                                                                                                                                                  132
                                                                                                                                                                                                                                  133
                                                                                                                                                                                                                                  134
                                                                                                                                                                                                                                  135
                                                                                                                                                                                                                                  136
                                                                                                                                                                                                                                  137
                                                                                                                                                                                                                                  138
                                                                                                                                                                                                                                  139
                                                                                                                                                                                                                                  140
                                                                                                                                                                                                                                  141
                                                                                                                                                                                                                                  142
                                                                                                                                                                                                                                  143
                                                                                                                                                                                                                                  144
                                                                                                                                                                                                                                  145
                                                                                                                                                                                                                                  146
                                                                                                                                                                                                                                  147
                                                                                                                                                                                                                                  148
                                                                                                                                                                                                                                  149
                                                                                                                                                                                                                                  150
                                                                                                                                                                                                                                  151
                                                                                                                                                                                                                                  152
                                                                                                                                                                                                                                  153
                                                                                                                                                                                                                                  154
                                                                                                                                                                                                                                  155
                                                                                                                                                                                                                                  156
                                                                                                                                                                                                                                  157
                                                                                                                                                                                                                                  158
                                                                                                                                                                                                                                  159
                                                                                                                                                                                                                                  160
                                                                                                                                                                                                                                  161
                                                                                                                                                                                                                                  162
                                                                                                                                                                                                                                  163
                                                                                                                                                                                                                                  164
                                                                                                                                                                                                                                  165
                                                                                                                                                                                                                                  166
                                                                                                                                                                                                                                  167
                                                                                                                                                                                                                                  168
                                                                                                                                                                                                                                  169
                                                                                                                                                                                                                                  170
                                                                                                                                                                                                                                  171
                                                                                                                                                                                                                                  172
                                                                                                                                                                                                                                  173
                                                                                                                                                                                                                                  174
                                                                                                                                                                                                                                  175
                                                                                                                                                                                                                                  176
                                                                                                                                                                                                                                  177
                                                                                                                                                                                                                                  178
                                                                                                                                                                                                                                  179
                                                                                                                                                                                                                                  180
                                                                                                                                                                                                                                  181
                                                                                                                                                                                                                                  182
                                                                                                                                                                                                                                  183
                                                                                                                                                                                                                                  184
                                                                                                                                                                                                                                  185
                                                                                                                                                                                                                                  186
                                                                                                                                                                                                                                  187
                                                                                                                                                                                                                                  188
                                                                                                                                                                                                                                  189
                                                                                                                                                                                                                                  190
                                                                                                                                                                                                                                  191
                                                                                                                                                                                                                                  192
                                                                                                                                                                                                                                  193
                                                                                                                                                                                                                                  194
                                                                                                                                                                                                                                  195
                                                                                                                                                                                                                                  196
                                                                                                                                                                                                                                  197
                                                                                                                                                                                                                                  198
                                                                                                                                                                                                                                  199
                                                                                                                                                                                                                                  200
                                                                                                                                                                                                                                  201
                                                                                                                                                                                                                                  202
                                                                                                                                                                                                                                  203
                                                                                                                                                                                                                                  204
                                                                                                                                                                                                                                  205
                                                                                                                                                                                                                                  206
                                                                                                                                                                                                                                  207
                                                                                                                                                                                                                                  208
                                                                                                                                                                                                                                  209
                                                                                                                                                                                                                                  210
                                                                                                                                                                                                                                  211
                                                                                                                                                                                                                                  212
                                                                                                                                                                                                                                  213
                                                                                                                                                                                                                                  214
                                                                                                                                                                                                                                  215
                                                                                                                                                                                                                                  216
                                                                                                                                                                                                                                  217
                                                                                                                                                                                                                                  218
                                                                                                                                                                                                                                  219
                                                                                                                                                                                                                                  220
                                                                                                                                                                                                                                  221
                                                                                                                                                                                                                                  222
                                                                                                                                                                                                                                  223
                                                                                                                                                                                                                                  224
                                                                                                                                                                                                                                  225
                                                                                                                                                                                                                                  226
                                                                                                                                                                                                                                  227
                                                                                                                                                                                                                                  228
                                                                                                                                                                                                                                  229
                                                                                                                                                                                                                                  230
                                                                                                                                                                                                                                  231
                                                                                                                                                                                                                                  232
                                                                                                                                                                                                                                  233
                                                                                                                                                                                                                                  234
                                                                                                                                                                                                                                  235
                                                                                                                                                                                                                                  236
                                                                                                                                                                                                                                  237
                                                                                                                                                                                                                                  238
                                                                                                                                                                                                                                  239
                                                                                                                                                                                                                                  240
                                                                                                                                                                                                                                  241
                                                                                                                                                                                                                                  242
                                                                                                                                                                                                                                  243
                                                                                                                                                                                                                                  244
                                                                                                                                                                                                                                  245
                                                                                                                                                                                                                                  246
                                                                                                                                                                                                                                  247
                                                                                                                                                                                                                                  248
                                                                                                                                                                                                                                  249
                                                                                                                                                                                                                                  250
                                                                                                                                                                                                                                  251
                                                                                                                                                                                                                                  252
                                                                                                                                                                                                                                  253
                                                                                                                                                                                                                                  254
                                                                                                                                                                                                                                  255
                                                                                                                                                                                                                                  256
                                                                                                                                                                                                                                  257
                                                                                                                                                                                                                                  258
                                                                                                                                                                                                                                  259
                                                                                                                                                                                                                                  260
                                                                                                                                                                                                                                  261
                                                                                                                                                                                                                                  262
                                                                                                                                                                                                                                  263
                                                                                                                                                                                                                                  264
                                                                                                                                                                                                                                  265
                                                                                                                                                                                                                                  266
                                                                                                                                                                                                                                  267
                                                                                                                                                                                                                                  268
                                                                                                                                                                                                                                  269
                                                                                                                                                                                                                                  270
                                                                                                                                                                                                                                  271
                                                                                                                                                                                                                                  272
                                                                                                                                                                                                                                  273
                                                                                                                                                                                                                                  274
                                                                                                                                                                                                                                  275
                                                                                                                                                                                                                                  276
                                                                                                                                                                                                                                  277
                                                                                                                                                                                                                                  278
                                                                                                                                                                                                                                  279
                                                                                                                                                                                                                                  280
                                                                                                                                                                                                                                  281
                                                                                                                                                                                                                                  282
                                                                                                                                                                                                                                  283
                                                                                                                                                                                                                                  284
                                                                                                                                                                                                                                  285
                                                                                                                                                                                                                                  286
                                                                                                                                                                                                                                  287
                                                                                                                                                                                                                                  288
                                                                                                                                                                                                                                  289
                                                                                                                                                                                                                                  290
                                                                                                                                                                                                                                  291
                                                                                                                                                                                                                                  292
                                                                                                                                                                                                                                  293
                                                                                                                                                                                                                                  294
                                                                                                                                                                                                                                  295
                                                                                                                                                                                                                                  296
                                                                                                                                                                                                                                  297
                                                                                                                                                                                                                                  298
                                                                                                                                                                                                                                  299
                                                                                                                                                                                                                                  300
                                                                                                                                                                                                                                  301
                                                                                                                                                                                                                                  302
                                                                                                                                                                                                                                  303
                                                                                                                                                                                                                                  304
                                                                                                                                                                                                                                  305
                                                                                                                                                                                                                                  306
                                                                                                                                                                                                                                  307
                                                                                                                                                                                                                                  308
                                                                                                                                                                                                                                  309
                                                                                                                                                                                                                                  310
                                                                                                                                                                                                                                  311
                                                                                                                                                                                                                                  312
                                                                                                                                                                                                                                  313
                                                                                                                                                                                                                                  314
                                                                                                                                                                                                                                  315
                                                                                                                                                                                                                                  316
                                                                                                                                                                                                                                  317
                                                                                                                                                                                                                                  318
                                                                                                                                                                                                                                  319
                                                                                                                                                                                                                                  320
                                                                                                                                                                                                                                  321
                                                                                                                                                                                                                                  322
                                                                                                                                                                                                                                  323
                                                                                                                                                                                                                                  324
                                                                                                                                                                                                                                  325
                                                                                                                                                                                                                                  326
                                                                                                                                                                                                                                  327
                                                                                                                                                                                                                                  328
                                                                                                                                                                                                                                  329
                                                                                                                                                                                                                                  330
                                                                                                                                                                                                                                  331
                                                                                                                                                                                                                                  332
                                                                                                                                                                                                                                  333
                                                                                                                                                                                                                                  334
                                                                                                                                                                                                                                  335
                                                                                                                                                                                                                                  336
                                                                                                                                                                                                                                  337
                                                                                                                                                                                                                                  338
                                                                                                                                                                                                                                  339
                                                                                                                                                                                                                                  340
                                                                                                                                                                                                                                  341
                                                                                                                                                                                                                                  342
                                                                                                                                                                                                                                  343
                                                                                                                                                                                                                                  344
                                                                                                                                                                                                                                  345
                                                                                                                                                                                                                                  346
                                                                                                                                                                                                                                  347
                                                                                                                                                                                                                                  348
                                                                                                                                                                                                                                  349
                                                                                                                                                                                                                                  350
                                                                                                                                                                                                                                  351
                                                                                                                                                                                                                                  352
                                                                                                                                                                                                                                  353
                                                                                                                                                                                                                                  354
                                                                                                                                                                                                                                  355
                                                                                                                                                                                                                                  356
                                                                                                                                                                                                                                  357
                                                                                                                                                                                                                                  358
                                                                                                                                                                                                                                  359
                                                                                                                                                                                                                                  360
                                                                                                                                                                                                                                  361
                                                                                                                                                                                                                                  362
                                                                                                                                                                                                                                  363
                                                                                                                                                                                                                                  364
                                                                                                                                                                                                                                  365
                                                                                                                                                                                                                                  366
                                                                                                                                                                                                                                  367
                                                                                                                                                                                                                                  368
                                                                                                                                                                                                                                  369
                                                                                                                                                                                                                                  370
                                                                                                                                                                                                                                  371
                                                                                                                                                                                                                                  372
                                                                                                                                                                                                                                  373
                                                                                                                                                                                                                                  374
                                                                                                                                                                                                                                  375
                                                                                                                                                                                                                                  376
                                                                                                                                                                                                                                  377
                                                                                                                                                                                                                                  378
                                                                                                                                                                                                                                  379
                                                                                                                                                                                                                                  380
                                                                                                                                                                                                                                  381
                                                                                                                                                                                                                                  382
                                                                                                                                                                                                                                  383
                                                                                                                                                                                                                                  384
                                                                                                                                                                                                                                  385
                                                                                                                                                                                                                                  386
                                                                                                                                                                                                                                  387
                                                                                                                                                                                                                                  388
                                                                                                                                                                                                                                  389
                                                                                                                                                                                                                                  390
                                                                                                                                                                                                                                  391
                                                                                                                                                                                                                                  392
                                                                                                                                                                                                                                  393
                                                                                                                                                                                                                                  394
                                                                                                                                                                                                                                  395
                                                                                                                                                                                                                                  396
                                                                                                                                                                                                                                  397
                                                                                                                                                                                                                                  398
                                                                                                                                                                                                                                  399
                                                                                                                                                                                                                                  400
                                                                                                                                                                                                                                  401
                                                                                                                                                                                                                                  402
                                                                                                                                                                                                                                  403
                                                                                                                                                                                                                                  404
                                                                                                                                                                                                                                  405
                                                                                                                                                                                                                                  406
                                                                                                                                                                                                                                  407
                                                                                                                                                                                                                                  408
                                                                                                                                                                                                                                  409
                                                                                                                                                                                                                                  410
                                                                                                                                                                                                                                  411
                                                                                                                                                                                                                                  412
                                                                                                                                                                                                                                  413
                                                                                                                                                                                                                                  414
                                                                                                                                                                                                                                  415
                                                                                                                                                                                                                                  416
                                                                                                                                                                                                                                  417
                                                                                                                                                                                                                                  418
                                                                                                                                                                                                                                  419
                                                                                                                                                                                                                                  420
                                                                                                                                                                                                                                  421
                                                                                                                                                                                                                                  422
                                                                                                                                                                                                                                  423
                                                                                                                                                                                                                                  424
                                                                                                                                                                                                                                  425
                                                                                                                                                                                                                                  426
                                                                                                                                                                                                                                  427
                                                                                                                                                                                                                                  428
                                                                                                                                                                                                                                  429
                                                                                                                                                                                                                                  430
                                                                                                                                                                                                                                  431
                                                                                                                                                                                                                                  432
                                                                                                                                                                                                                                  433
                                                                                                                                                                                                                                  434
                                                                                                                                                                                                                                  435
                                                                                                                                                                                                                                  436
                                                                                                                                                                                                                                  437
                                                                                                                                                                                                                                  438
                                                                                                                                                                                                                                  439
                                                                                                                                                                                                                                  440
                                                                                                                                                                                                                                  441
                                                                                                                                                                                                                                  442
                                                                                                                                                                                                                                  443
                                                                                                                                                                                                                                  444
                                                                                                                                                                                                                                  445
                                                                                                                                                                                                                                  446
                                                                                                                                                                                                                                  447
                                                                                                                                                                                                                                  448
                                                                                                                                                                                                                                  449
                                                                                                                                                                                                                                  450
                                                                                                                                                                                                                                  451
                                                                                                                                                                                                                                  452
                                                                                                                                                                                                                                  453
                                                                                                                                                                                                                                  454
                                                                                                                                                                                                                                  455
                                                                                                                                                                                                                                  456
                                                                                                                                                                                                                                  457
                                                                                                                                                                                                                                  458
                                                                                                                                                                                                                                  459
                                                                                                                                                                                                                                  460
                                                                                                                                                                                                                                  461
                                                                                                                                                                                                                                  462
                                                                                                                                                                                                                                  463
                                                                                                                                                                                                                                  464
                                                                                                                                                                                                                                  465
                                                                                                                                                                                                                                  466
                                                                                                                                                                                                                                  467
                                                                                                                                                                                                                                  468
                                                                                                                                                                                                                                  469
                                                                                                                                                                                                                                  470
                                                                                                                                                                                                                                  471
                                                                                                                                                                                                                                  472
                                                                                                                                                                                                                                  473
                                                                                                                                                                                                                                  474
                                                                                                                                                                                                                                  475
                                                                                                                                                                                                                                  476
                                                                                                                                                                                                                                  477
                                                                                                                                                                                                                                  478
                                                                                                                                                                                                                                  479
                                                                                                                                                                                                                                  480
                                                                                                                                                                                                                                  481
                                                                                                                                                                                                                                  482
                                                                                                                                                                                                                                  483
                                                                                                                                                                                                                                  484
                                                                                                                                                                                                                                  485
                                                                                                                                                                                                                                  486
                                                                                                                                                                                                                                  487
                                                                                                                                                                                                                                  488
                                                                                                                                                                                                                                  489
                                                                                                                                                                                                                                  490
                                                                                                                                                                                                                                  491
                                                                                                                                                                                                                                  492
                                                                                                                                                                                                                                  493
                                                                                                                                                                                                                                  494
                                                                                                                                                                                                                                  495
                                                                                                                                                                                                                                  496
                                                                                                                                                                                                                                  497
                                                                                                                                                                                                                                  498
                                                                                                                                                                                                                                  499
                                                                                                                                                                                                                                  500
                                                                                                                                                                                                                                  501
                                                                                                                                                                                                                                  502
                                                                                                                                                                                                                                  503
                                                                                                                                                                                                                                  504
                                                                                                                                                                                                                                  505
                                                                                                                                                                                                                                  506
                                                                                                                                                                                                                                  507
                                                                                                                                                                                                                                  508
                                                                                                                                                                                                                                  509
                                                                                                                                                                                                                                  510
                                                                                                                                                                                                                                  511
                                                                                                                                                                                                                                  512
                                                                                                                                                                                                                                  513
                                                                                                                                                                                                                                  514
                                                                                                                                                                                                                                  515
                                                                                                                                                                                                                                  516
                                                                                                                                                                                                                                  517
                                                                                                                                                                                                                                  518
                                                                                                                                                                                                                                  519
                                                                                                                                                                                                                                  520
                                                                                                                                                                                                                                  521
                                                                                                                                                                                                                                  522
                                                                                                                                                                                                                                  523
                                                                                                                                                                                                                                  524
                                                                                                                                                                                                                                  525
                                                                                                                                                                                                                                  526
                                                                                                                                                                                                                                  527
                                                                                                                                                                                                                                  528
                                                                                                                                                                                                                                  529
                                                                                                                                                                                                                                  530
                                                                                                                                                                                                                                  531
                                                                                                                                                                                                                                  532
                                                                                                                                                                                                                                  533
                                                                                                                                                                                                                                  534
                                                                                                                                                                                                                                  535
                                                                                                                                                                                                                                  536
                                                                                                                                                                                                                                  537
                                                                                                                                                                                                                                  538
                                                                                                                                                                                                                                  539
                                                                                                                                                                                                                                  540
                                                                                                                                                                                                                                  541
                                                                                                                                                                                                                                  542
                                                                                                                                                                                                                                  543
                                                                                                                                                                                                                                  544
                                                                                                                                                                                                                                  545
                                                                                                                                                                                                                                  546
                                                                                                                                                                                                                                  547
                                                                                                                                                                                                                                  548
                                                                                                                                                                                                                                  549
                                                                                                                                                                                                                                  550
                                                                                                                                                                                                                                  551
                                                                                                                                                                                                                                  class AbstractItemModelMixin(core.ObjectMixin, _AbstractItemModelBase):
                                                                                                                                                                                                                                      IS_RECURSIVE = False  # for docs
                                                                                                                                                                                                                                      DELEGATE_DEFAULT = None
                                                                                                                                                                                                                                      DEFAULT_FLAGS = (
                                                                                                                                                                                                                                          constants.DRAG_ENABLED | constants.IS_ENABLED | constants.IS_SELECTABLE
                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return f"{type(self).__name__}: ({self.rowCount()}, {self.columnCount()})"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __len__(self) -> int:
                                                                                                                                                                                                                                          return self.rowCount()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __add__(self, other: core.QAbstractItemModel) -> core.ConcatenateTablesProxyModel:
                                                                                                                                                                                                                                          proxy = core.ConcatenateTablesProxyModel()
                                                                                                                                                                                                                                          proxy.addSourceModel(self)
                                                                                                                                                                                                                                          proxy.addSourceModel(other)
                                                                                                                                                                                                                                          return proxy
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @overload
                                                                                                                                                                                                                                      def __getitem__(self, index: tuple[int, int] | int) -> core.ModelIndex: ...
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @overload
                                                                                                                                                                                                                                      def __getitem__(
                                                                                                                                                                                                                                          self, index: tuple[slice, int] | tuple[int, slice] | tuple[slice, slice]
                                                                                                                                                                                                                                      ) -> listdelegators.ListDelegator[core.ModelIndex]: ...
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getitem__(
                                                                                                                                                                                                                                          self, index: tuple[int | slice, int | slice] | int
                                                                                                                                                                                                                                      ) -> core.ModelIndex | listdelegators.ListDelegator[core.ModelIndex]:
                                                                                                                                                                                                                                          # TODO: do proxies need mapToSource here?
                                                                                                                                                                                                                                          rowcount = self.rowCount()
                                                                                                                                                                                                                                          colcount = self.columnCount()
                                                                                                                                                                                                                                          match index:
                                                                                                                                                                                                                                              case int() as row, int() as col:
                                                                                                                                                                                                                                                  if row < 0:
                                                                                                                                                                                                                                                      row += rowcount
                                                                                                                                                                                                                                                  if col < 0:
                                                                                                                                                                                                                                                      col += colcount
                                                                                                                                                                                                                                                  if not (0 <= row < rowcount and 0 <= col < colcount):
                                                                                                                                                                                                                                                      raise IndexError(index)
                                                                                                                                                                                                                                                  return self.index(row, col)
                                                                                                                                                                                                                                              case (int() | slice() as row, int() | slice() as col):
                                                                                                                                                                                                                                                  indexes = [
                                                                                                                                                                                                                                                      self.index(i, j)
                                                                                                                                                                                                                                                      for i, j in helpers.iter_positions(row, col, rowcount, colcount)
                                                                                                                                                                                                                                                  ]
                                                                                                                                                                                                                                                  return listdelegators.ListDelegator(indexes)
                                                                                                                                                                                                                                              case int() as row:
                                                                                                                                                                                                                                                  if row < 0:
                                                                                                                                                                                                                                                      row += rowcount
                                                                                                                                                                                                                                                  if not (0 <= row < rowcount):
                                                                                                                                                                                                                                                      raise IndexError(index)
                                                                                                                                                                                                                                                  # this here breaks PySide6 IPython test...
                                                                                                                                                                                                                                                  return self.index(row, 0)
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  raise TypeError(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_data(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          index: tuple[int | slice, int | slice] | core.ModelIndex,
                                                                                                                                                                                                                                          value: Any,
                                                                                                                                                                                                                                          role=constants.EDIT_ROLE,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          match index:
                                                                                                                                                                                                                                              case core.ModelIndex():
                                                                                                                                                                                                                                                  self.setData(index, value, role)
                                                                                                                                                                                                                                              case (row, col):
                                                                                                                                                                                                                                                  rowcount = self.rowCount()
                                                                                                                                                                                                                                                  colcount = self.columnCount()
                                                                                                                                                                                                                                                  for i, j in helpers.iter_positions(row, col, rowcount, colcount):
                                                                                                                                                                                                                                                      self.setData(self.index(i, j), value, role)
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  raise TypeError(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def check_index(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          index: core.ModelIndex,
                                                                                                                                                                                                                                          *,
                                                                                                                                                                                                                                          index_is_valid: bool = False,
                                                                                                                                                                                                                                          do_not_use_parent: bool = False,
                                                                                                                                                                                                                                          parent_is_invalid: bool = False,
                                                                                                                                                                                                                                      ) -> bool:
                                                                                                                                                                                                                                          flag = core.QAbstractItemModel.CheckIndexOption.NoOption
                                                                                                                                                                                                                                          if index_is_valid:
                                                                                                                                                                                                                                              flag |= core.QAbstractItemModel.CheckIndexOption.IndexIsValid
                                                                                                                                                                                                                                          if do_not_use_parent:
                                                                                                                                                                                                                                              flag |= core.QAbstractItemModel.CheckIndexOption.DoNotUseParent
                                                                                                                                                                                                                                          if parent_is_invalid:
                                                                                                                                                                                                                                              flag |= core.QAbstractItemModel.CheckIndexOption.ParentIsInvalid
                                                                                                                                                                                                                                          check_flag = core.QAbstractItemModel.CheckIndexOption(0) | flag
                                                                                                                                                                                                                                          return self.checkIndex(index, check_flag)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def change_layout(self):
                                                                                                                                                                                                                                          """Context manager to change the layout.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          wraps calls with correct signals
                                                                                                                                                                                                                                          emitted at beginning: layoutAboutToBeChanged
                                                                                                                                                                                                                                          emitted at end: layoutChanged
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.layoutAboutToBeChanged.emit()
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield None
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              self.layoutChanged.emit()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def reset_model(self):
                                                                                                                                                                                                                                          """Context manager to reset the model.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          wraps calls with correct signals
                                                                                                                                                                                                                                          emitted at beginning: beginResetModel
                                                                                                                                                                                                                                          emitted at end: endResetModel
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.beginResetModel()
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield None
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              self.endResetModel()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_column_type(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          column: int,
                                                                                                                                                                                                                                          *,
                                                                                                                                                                                                                                          rows_to_check: int = 10,
                                                                                                                                                                                                                                          role=constants.DISPLAY_ROLE,
                                                                                                                                                                                                                                      ) -> type | None:
                                                                                                                                                                                                                                          """Guess column data type by checking values of first rows with given role."""
                                                                                                                                                                                                                                          to_check = min(rows_to_check, self.rowCount())
                                                                                                                                                                                                                                          if to_check == 0:
                                                                                                                                                                                                                                              return None
                                                                                                                                                                                                                                          # cant combine these or make them a generator, so we do two list comps.
                                                                                                                                                                                                                                          indexes = [self.index(row, column) for row in range(to_check)]
                                                                                                                                                                                                                                          values = [self.data(i, role=role) for i in indexes]
                                                                                                                                                                                                                                          if all(isinstance(i, bool) for i in values):
                                                                                                                                                                                                                                              return bool
                                                                                                                                                                                                                                          if all(isinstance(i, str) for i in values):
                                                                                                                                                                                                                                              return str
                                                                                                                                                                                                                                          if all(isinstance(i, int) for i in values):
                                                                                                                                                                                                                                              return int
                                                                                                                                                                                                                                          if all(isinstance(i, float) for i in values):
                                                                                                                                                                                                                                              return float
                                                                                                                                                                                                                                          check_values = [self.data(i, role=constants.CHECKSTATE_ROLE) for i in indexes]
                                                                                                                                                                                                                                          return bool if None not in check_values else None
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def update_row(self, row: int):
                                                                                                                                                                                                                                          start_index = self.index(row, 0)
                                                                                                                                                                                                                                          end_index = self.index(row, self.columnCount() - 1)
                                                                                                                                                                                                                                          self.dataChanged.emit(start_index, end_index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def update_all(self):
                                                                                                                                                                                                                                          top_left = self.index(0, 0)
                                                                                                                                                                                                                                          bottom_right = self.index(self.rowCount() - 1, self.columnCount() - 1)
                                                                                                                                                                                                                                          self.dataChanged.emit(top_left, bottom_right)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def remove_row(self, row: int, parent: core.ModelIndex | None = None):
                                                                                                                                                                                                                                          parent = core.ModelIndex() if parent is None else parent
                                                                                                                                                                                                                                          self.beginRemoveRows(parent, row, row)
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield None
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              self.endRemoveRows()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def remove_rows(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          first: int | None = None,
                                                                                                                                                                                                                                          last: int | None = None,
                                                                                                                                                                                                                                          parent: core.ModelIndex | None = None,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          parent = core.ModelIndex() if parent is None else parent
                                                                                                                                                                                                                                          first = first or 0
                                                                                                                                                                                                                                          last = last if last is not None else self.rowCount(parent) - 1
                                                                                                                                                                                                                                          self.beginRemoveRows(parent, first, last)
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield None
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              self.endRemoveRows()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def remove_columns(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          first: int | None = None,
                                                                                                                                                                                                                                          last: int | None = None,
                                                                                                                                                                                                                                          parent: core.ModelIndex | None = None,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          parent = core.ModelIndex() if parent is None else parent
                                                                                                                                                                                                                                          first = first or 0
                                                                                                                                                                                                                                          last = last if last is not None else self.columnCount(parent) - 1
                                                                                                                                                                                                                                          self.beginRemoveColumns(parent, first, last)
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield None
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              self.endRemoveColumns()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def insert_row(self, row: int, parent: core.ModelIndex | None = None):
                                                                                                                                                                                                                                          parent = core.ModelIndex() if parent is None else parent
                                                                                                                                                                                                                                          self.beginInsertRows(parent, row, row)
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield None
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              self.endInsertRows()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def insert_rows(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          first: int | None = None,
                                                                                                                                                                                                                                          last: int | None = None,
                                                                                                                                                                                                                                          parent: core.ModelIndex | None = None,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          parent = core.ModelIndex() if parent is None else parent
                                                                                                                                                                                                                                          first = first or 0
                                                                                                                                                                                                                                          last = last if last is not None else first
                                                                                                                                                                                                                                          self.beginInsertRows(parent, first, last)
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield None
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              self.endInsertRows()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def append_rows(self, num_rows: int, parent: core.ModelIndex | None = None):
                                                                                                                                                                                                                                          parent = core.ModelIndex() if parent is None else parent
                                                                                                                                                                                                                                          row_count = self.rowCount(parent)
                                                                                                                                                                                                                                          self.beginInsertRows(parent, row_count, row_count + num_rows - 1)
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield None
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              self.endInsertRows()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def insert_columns(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          first: int | None = None,
                                                                                                                                                                                                                                          last: int | None = None,
                                                                                                                                                                                                                                          parent: core.ModelIndex | None = None,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          parent = core.ModelIndex() if parent is None else parent
                                                                                                                                                                                                                                          first = first or 0
                                                                                                                                                                                                                                          last = last if last is not None else first
                                                                                                                                                                                                                                          self.beginInsertColumns(parent, first, last)
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield None
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              self.endInsertColumns()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def force_reset(self):
                                                                                                                                                                                                                                          self.beginResetModel()
                                                                                                                                                                                                                                          self.endResetModel()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def force_layoutchange(self):
                                                                                                                                                                                                                                          self.layoutAboutToBeChanged.emit()
                                                                                                                                                                                                                                          self.layoutChanged.emit()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_role_names(self) -> bdct.bidict[int, str]:
                                                                                                                                                                                                                                          return bdct.bidict({
                                                                                                                                                                                                                                              i: bytes(v.data()).decode() for i, v in self.roleNames().items()
                                                                                                                                                                                                                                          })
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_breadcrumbs_path(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          index: core.ModelIndex,
                                                                                                                                                                                                                                          role: constants.ItemDataRole = constants.DISPLAY_ROLE,
                                                                                                                                                                                                                                      ) -> list[str]:
                                                                                                                                                                                                                                          """Get the path for the given index.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns a list containing data of all indexes up to the root for given role.
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          pieces = [index.data(role)]
                                                                                                                                                                                                                                          while (index := index.parent()).isValid():
                                                                                                                                                                                                                                              pieces.insert(0, index.data(role))
                                                                                                                                                                                                                                          return pieces
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def iter_tree(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          parent_index: core.ModelIndex | None = None,
                                                                                                                                                                                                                                          *,
                                                                                                                                                                                                                                          depth: int | None = None,
                                                                                                                                                                                                                                          fetch_more: bool = False,
                                                                                                                                                                                                                                      ) -> Iterator[core.ModelIndex]:
                                                                                                                                                                                                                                          """Iter through all indexes of the model tree.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              parent_index: parent index
                                                                                                                                                                                                                                              depth: maximum iteration depth
                                                                                                                                                                                                                                              fetch_more: call fetchMore for all indexes until canFetchMore returns False
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          if parent_index is None:
                                                                                                                                                                                                                                              # TODO: does this always equal AbstractItemView.rootIndex()?
                                                                                                                                                                                                                                              # parent_index = self.index(0, 0)
                                                                                                                                                                                                                                              parent_index = core.ModelIndex()
                                                                                                                                                                                                                                          if parent_index.isValid():
                                                                                                                                                                                                                                              yield parent_index
                                                                                                                                                                                                                                              if fetch_more:
                                                                                                                                                                                                                                                  while self.canFetchMore(parent_index):
                                                                                                                                                                                                                                                      self.fetchMore(parent_index)
                                                                                                                                                                                                                                          if depth is not None and (depth := depth - 1) < 0:
                                                                                                                                                                                                                                              return
                                                                                                                                                                                                                                          for i in range(self.rowCount(parent_index)):
                                                                                                                                                                                                                                              child_index = self.index(i, 0, parent_index)
                                                                                                                                                                                                                                              yield from self.iter_tree(child_index, depth=depth, fetch_more=fetch_more)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def search_tree(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          value: Any,
                                                                                                                                                                                                                                          *,
                                                                                                                                                                                                                                          role: constants.ItemDataRole | int = constants.DISPLAY_ROLE,
                                                                                                                                                                                                                                          parent_index: core.ModelIndex | None = None,
                                                                                                                                                                                                                                          max_results: int | None = None,
                                                                                                                                                                                                                                          depth: int | None = None,
                                                                                                                                                                                                                                      ) -> listdelegators.ListDelegator[core.ModelIndex]:
                                                                                                                                                                                                                                          """Search the tree for indexes with a given value in given role.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Compared to QAbstractItemModel.match, this method allows to set a maximum
                                                                                                                                                                                                                                          search depth and passing several values to search for as a list.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              value: Item or list of items to search for.
                                                                                                                                                                                                                                              role: Index role to search in.
                                                                                                                                                                                                                                              parent_index: start index for searching. If None, whole tree is searched.
                                                                                                                                                                                                                                              max_results: stop searching after x amount of hits. 'None' means no limit.
                                                                                                                                                                                                                                              depth: search depth. Search depth. 'None' means no limit.
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          results = []
                                                                                                                                                                                                                                          # This makes it impossible to search for lists. I think thats fine.
                                                                                                                                                                                                                                          if not isinstance(value, list):
                                                                                                                                                                                                                                              value = [value]
                                                                                                                                                                                                                                          for idx in self.iter_tree(parent_index, depth=depth):
                                                                                                                                                                                                                                              if self.data(idx, role) in value:
                                                                                                                                                                                                                                                  results.append(idx)
                                                                                                                                                                                                                                                  if len(results) == max_results:
                                                                                                                                                                                                                                                      break
                                                                                                                                                                                                                                          return listdelegators.ListDelegator(results)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_child_indexes(
                                                                                                                                                                                                                                          self, index: core.ModelIndex
                                                                                                                                                                                                                                      ) -> listdelegators.ListDelegator[core.ModelIndex]:
                                                                                                                                                                                                                                          """Get all child indexes for given index (first column only).
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          To get indexes recursively, use iter_tree.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              index: ModelIndex to get children from
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          indexes = [self.index(i, 0, index) for i in range(self.rowCount(index))]
                                                                                                                                                                                                                                          return listdelegators.ListDelegator(indexes)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_index_key(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          index: core.ModelIndex,
                                                                                                                                                                                                                                          *,
                                                                                                                                                                                                                                          include_column: bool = False,
                                                                                                                                                                                                                                          parent_index: core.ModelIndex | None = None,
                                                                                                                                                                                                                                      ) -> tuple[tuple[int, int] | int, ...]:
                                                                                                                                                                                                                                          """Return a key tuple for given ModelIndex.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          The key tuple consists either of row integers or (row, column) indices
                                                                                                                                                                                                                                          describing the index position from top to bottom.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              index: ModelIndex to get a key for
                                                                                                                                                                                                                                              include_column: whether to include the column in the index key.
                                                                                                                                                                                                                                              parent_index: Get key up to given ModelIndex. By default, get key up to root.
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          key_path: list[tuple[int, int] | int] = []
                                                                                                                                                                                                                                          parent = index
                                                                                                                                                                                                                                          while parent.isValid() and parent != parent_index:
                                                                                                                                                                                                                                              key = (parent.row(), parent.column()) if include_column else parent.row()
                                                                                                                                                                                                                                              key_path.append(key)
                                                                                                                                                                                                                                              parent = parent.parent()
                                                                                                                                                                                                                                          return tuple(reversed(key_path))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def index_from_key(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          key_path: Sequence[tuple[int, int] | int],
                                                                                                                                                                                                                                          *,
                                                                                                                                                                                                                                          parent_index: core.ModelIndex | None = None,
                                                                                                                                                                                                                                      ) -> core.ModelIndex:
                                                                                                                                                                                                                                          """Return a  ModelIndex for the given key path.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              key_path: Key path to get an index for.
                                                                                                                                                                                                                                                        Should be a sequence of either (row, column)  or row indices
                                                                                                                                                                                                                                              parent_index: ModelIndex to start indexing from. Defaults to root index.
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return modelhelpers.index_from_key(self, key_path, parent_index=parent_index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @staticmethod
                                                                                                                                                                                                                                      def to_checkstate(value: bool):
                                                                                                                                                                                                                                          return constants.CheckState.Checked if value else constants.CheckState.Unchecked
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @staticmethod
                                                                                                                                                                                                                                      def to_display_text(value: Any) -> str:
                                                                                                                                                                                                                                          """Convert an arbitrary value into a string suitable for DisplayRole."""
                                                                                                                                                                                                                                          match value:
                                                                                                                                                                                                                                              case None:
                                                                                                                                                                                                                                                  return ""
                                                                                                                                                                                                                                              case str():
                                                                                                                                                                                                                                                  return value
                                                                                                                                                                                                                                              case bool() | int() | float():
                                                                                                                                                                                                                                                  return str(value)
                                                                                                                                                                                                                                              case enum.Enum():
                                                                                                                                                                                                                                                  return value.name
                                                                                                                                                                                                                                          return repr(value)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @staticmethod
                                                                                                                                                                                                                                      def from_checkstate(value: Any) -> bool:
                                                                                                                                                                                                                                          """Convert a value passed to setData for CheckStateRole into a bool.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Views may pass either an int or a CheckState enum member, and enum members
                                                                                                                                                                                                                                          are always truthy, so `bool(value)` cannot be used.
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          match value:
                                                                                                                                                                                                                                              case constants.CheckState():
                                                                                                                                                                                                                                                  return value == constants.CheckState.Checked
                                                                                                                                                                                                                                              case bool():
                                                                                                                                                                                                                                                  return value
                                                                                                                                                                                                                                              case int():
                                                                                                                                                                                                                                                  return value == constants.CheckState.Checked.value
                                                                                                                                                                                                                                          return bool(value)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_header_index_for_value(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          label,
                                                                                                                                                                                                                                          orientation: (
                                                                                                                                                                                                                                              constants.Orientation | constants.OrientationStr
                                                                                                                                                                                                                                          ) = constants.HORIZONTAL,
                                                                                                                                                                                                                                          *,
                                                                                                                                                                                                                                          role: constants.ItemDataRole = constants.DISPLAY_ROLE,
                                                                                                                                                                                                                                      ) -> int | None:
                                                                                                                                                                                                                                          o = constants.ORIENTATION.get_enum_value(orientation)
                                                                                                                                                                                                                                          count = self.columnCount() if o == constants.HORIZONTAL else self.rowCount()
                                                                                                                                                                                                                                          return next(
                                                                                                                                                                                                                                              (i for i in range(count) if self.headerData(i, o, role) == label), None
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_table_data(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          *,
                                                                                                                                                                                                                                          include_index: bool = False,
                                                                                                                                                                                                                                          role: constants.ItemDataRole = constants.DISPLAY_ROLE,
                                                                                                                                                                                                                                          x_range: slice | int | None = None,
                                                                                                                                                                                                                                          y_range: slice | int | None = None,
                                                                                                                                                                                                                                          parent_index: core.ModelIndex | None = None,
                                                                                                                                                                                                                                          use_checkstate_role: bool = False,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          parent_index = parent_index or core.ModelIndex()
                                                                                                                                                                                                                                          # if self.canFetchMore(parent_index):
                                                                                                                                                                                                                                          #     self.fetchMore(parent_index)
                                                                                                                                                                                                                                          match x_range:
                                                                                                                                                                                                                                              case None:
                                                                                                                                                                                                                                                  colrange = range(self.columnCount(parent_index))
                                                                                                                                                                                                                                              case slice():
                                                                                                                                                                                                                                                  stop = x_range.stop or self.columnCount(parent_index)
                                                                                                                                                                                                                                                  colrange = range(x_range.start or 0, stop, x_range.step or 1)
                                                                                                                                                                                                                                              case int():
                                                                                                                                                                                                                                                  colrange = range(x_range, x_range + 1)
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  raise TypeError(x_range)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          match y_range:
                                                                                                                                                                                                                                              case None:
                                                                                                                                                                                                                                                  rowrange = range(self.rowCount(parent_index))
                                                                                                                                                                                                                                              case slice():
                                                                                                                                                                                                                                                  stop = y_range.stop or self.rowCount(parent_index)
                                                                                                                                                                                                                                                  rowrange = range(y_range.start or 0, stop, y_range.step or 1)
                                                                                                                                                                                                                                              case int():
                                                                                                                                                                                                                                                  rowrange = range(y_range, y_range + 1)
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  raise TypeError(y_range)
                                                                                                                                                                                                                                          data = [
                                                                                                                                                                                                                                              [self.index(i, j, parent_index).data(role) for j in colrange]
                                                                                                                                                                                                                                              for i in rowrange
                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                          if use_checkstate_role:
                                                                                                                                                                                                                                              check_data, _, __ = self.get_table_data(
                                                                                                                                                                                                                                                  role=constants.CHECKSTATE_ROLE,
                                                                                                                                                                                                                                                  x_range=x_range,
                                                                                                                                                                                                                                                  y_range=y_range,
                                                                                                                                                                                                                                                  parent_index=parent_index,
                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                              for i, row in enumerate(data):
                                                                                                                                                                                                                                                  for j, _column in enumerate(row):
                                                                                                                                                                                                                                                      if check_data[i][j] is not None:
                                                                                                                                                                                                                                                          data[i][j] = self.from_checkstate(check_data[i][j])
                                                                                                                                                                                                                                          h_header = [self.headerData(i, constants.HORIZONTAL) for i in colrange]
                                                                                                                                                                                                                                          v_header = (
                                                                                                                                                                                                                                              [self.headerData(i, constants.VERTICAL) for i in rowrange]
                                                                                                                                                                                                                                              if include_index
                                                                                                                                                                                                                                              else None
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                          return data, h_header, v_header
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def to_dataframe(self, **kwargs):
                                                                                                                                                                                                                                          import pandas as pd
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          data, h_header, v_header = self.get_table_data(**kwargs)
                                                                                                                                                                                                                                          return pd.DataFrame(data=data, columns=h_header, index=v_header)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  change_layout()

                                                                                                                                                                                                                                  Context manager to change the layout.

                                                                                                                                                                                                                                  wraps calls with correct signals emitted at beginning: layoutAboutToBeChanged emitted at end: layoutChanged

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractitemmodel.py
                                                                                                                                                                                                                                  @contextlib.contextmanager
                                                                                                                                                                                                                                  def change_layout(self):
                                                                                                                                                                                                                                      """Context manager to change the layout.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      wraps calls with correct signals
                                                                                                                                                                                                                                      emitted at beginning: layoutAboutToBeChanged
                                                                                                                                                                                                                                      emitted at end: layoutChanged
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.layoutAboutToBeChanged.emit()
                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          yield None
                                                                                                                                                                                                                                      finally:
                                                                                                                                                                                                                                          self.layoutChanged.emit()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  from_checkstate(value: Any) -> bool staticmethod

                                                                                                                                                                                                                                  Convert a value passed to setData for CheckStateRole into a bool.

                                                                                                                                                                                                                                  Views may pass either an int or a CheckState enum member, and enum members are always truthy, so bool(value) cannot be used.

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractitemmodel.py
                                                                                                                                                                                                                                  @staticmethod
                                                                                                                                                                                                                                  def from_checkstate(value: Any) -> bool:
                                                                                                                                                                                                                                      """Convert a value passed to setData for CheckStateRole into a bool.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Views may pass either an int or a CheckState enum member, and enum members
                                                                                                                                                                                                                                      are always truthy, so `bool(value)` cannot be used.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      match value:
                                                                                                                                                                                                                                          case constants.CheckState():
                                                                                                                                                                                                                                              return value == constants.CheckState.Checked
                                                                                                                                                                                                                                          case bool():
                                                                                                                                                                                                                                              return value
                                                                                                                                                                                                                                          case int():
                                                                                                                                                                                                                                              return value == constants.CheckState.Checked.value
                                                                                                                                                                                                                                      return bool(value)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_breadcrumbs_path(index: core.ModelIndex, role: constants.ItemDataRole = constants.DISPLAY_ROLE) -> list[str]

                                                                                                                                                                                                                                  Get the path for the given index.

                                                                                                                                                                                                                                  Returns a list containing data of all indexes up to the root for given role.

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractitemmodel.py
                                                                                                                                                                                                                                  def get_breadcrumbs_path(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      index: core.ModelIndex,
                                                                                                                                                                                                                                      role: constants.ItemDataRole = constants.DISPLAY_ROLE,
                                                                                                                                                                                                                                  ) -> list[str]:
                                                                                                                                                                                                                                      """Get the path for the given index.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns a list containing data of all indexes up to the root for given role.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      pieces = [index.data(role)]
                                                                                                                                                                                                                                      while (index := index.parent()).isValid():
                                                                                                                                                                                                                                          pieces.insert(0, index.data(role))
                                                                                                                                                                                                                                      return pieces
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_child_indexes(index: core.ModelIndex) -> listdelegators.ListDelegator[core.ModelIndex]

                                                                                                                                                                                                                                  Get all child indexes for given index (first column only).

                                                                                                                                                                                                                                  To get indexes recursively, use iter_tree.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  index ModelIndex

                                                                                                                                                                                                                                  ModelIndex to get children from

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractitemmodel.py
                                                                                                                                                                                                                                  def get_child_indexes(
                                                                                                                                                                                                                                      self, index: core.ModelIndex
                                                                                                                                                                                                                                  ) -> listdelegators.ListDelegator[core.ModelIndex]:
                                                                                                                                                                                                                                      """Get all child indexes for given index (first column only).
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      To get indexes recursively, use iter_tree.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          index: ModelIndex to get children from
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      indexes = [self.index(i, 0, index) for i in range(self.rowCount(index))]
                                                                                                                                                                                                                                      return listdelegators.ListDelegator(indexes)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_column_type(column: int, *, rows_to_check: int = 10, role=constants.DISPLAY_ROLE) -> type | None

                                                                                                                                                                                                                                  Guess column data type by checking values of first rows with given role.

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractitemmodel.py
                                                                                                                                                                                                                                  def get_column_type(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      column: int,
                                                                                                                                                                                                                                      *,
                                                                                                                                                                                                                                      rows_to_check: int = 10,
                                                                                                                                                                                                                                      role=constants.DISPLAY_ROLE,
                                                                                                                                                                                                                                  ) -> type | None:
                                                                                                                                                                                                                                      """Guess column data type by checking values of first rows with given role."""
                                                                                                                                                                                                                                      to_check = min(rows_to_check, self.rowCount())
                                                                                                                                                                                                                                      if to_check == 0:
                                                                                                                                                                                                                                          return None
                                                                                                                                                                                                                                      # cant combine these or make them a generator, so we do two list comps.
                                                                                                                                                                                                                                      indexes = [self.index(row, column) for row in range(to_check)]
                                                                                                                                                                                                                                      values = [self.data(i, role=role) for i in indexes]
                                                                                                                                                                                                                                      if all(isinstance(i, bool) for i in values):
                                                                                                                                                                                                                                          return bool
                                                                                                                                                                                                                                      if all(isinstance(i, str) for i in values):
                                                                                                                                                                                                                                          return str
                                                                                                                                                                                                                                      if all(isinstance(i, int) for i in values):
                                                                                                                                                                                                                                          return int
                                                                                                                                                                                                                                      if all(isinstance(i, float) for i in values):
                                                                                                                                                                                                                                          return float
                                                                                                                                                                                                                                      check_values = [self.data(i, role=constants.CHECKSTATE_ROLE) for i in indexes]
                                                                                                                                                                                                                                      return bool if None not in check_values else None
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_index_key(index: core.ModelIndex, *, include_column: bool = False, parent_index: core.ModelIndex | None = None) -> tuple[tuple[int, int] | int, ...]

                                                                                                                                                                                                                                  Return a key tuple for given ModelIndex.

                                                                                                                                                                                                                                  The key tuple consists either of row integers or (row, column) indices describing the index position from top to bottom.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  index ModelIndex

                                                                                                                                                                                                                                  ModelIndex to get a key for

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  include_column bool

                                                                                                                                                                                                                                  whether to include the column in the index key.

                                                                                                                                                                                                                                  False
                                                                                                                                                                                                                                  parent_index ModelIndex | None

                                                                                                                                                                                                                                  Get key up to given ModelIndex. By default, get key up to root.

                                                                                                                                                                                                                                  None
                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractitemmodel.py
                                                                                                                                                                                                                                  def get_index_key(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      index: core.ModelIndex,
                                                                                                                                                                                                                                      *,
                                                                                                                                                                                                                                      include_column: bool = False,
                                                                                                                                                                                                                                      parent_index: core.ModelIndex | None = None,
                                                                                                                                                                                                                                  ) -> tuple[tuple[int, int] | int, ...]:
                                                                                                                                                                                                                                      """Return a key tuple for given ModelIndex.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      The key tuple consists either of row integers or (row, column) indices
                                                                                                                                                                                                                                      describing the index position from top to bottom.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          index: ModelIndex to get a key for
                                                                                                                                                                                                                                          include_column: whether to include the column in the index key.
                                                                                                                                                                                                                                          parent_index: Get key up to given ModelIndex. By default, get key up to root.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      key_path: list[tuple[int, int] | int] = []
                                                                                                                                                                                                                                      parent = index
                                                                                                                                                                                                                                      while parent.isValid() and parent != parent_index:
                                                                                                                                                                                                                                          key = (parent.row(), parent.column()) if include_column else parent.row()
                                                                                                                                                                                                                                          key_path.append(key)
                                                                                                                                                                                                                                          parent = parent.parent()
                                                                                                                                                                                                                                      return tuple(reversed(key_path))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  index_from_key(key_path: Sequence[tuple[int, int] | int], *, parent_index: core.ModelIndex | None = None) -> core.ModelIndex

                                                                                                                                                                                                                                  Return a ModelIndex for the given key path.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  key_path Sequence[tuple[int, int] | int]

                                                                                                                                                                                                                                  Key path to get an index for. Should be a sequence of either (row, column) or row indices

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  parent_index ModelIndex | None

                                                                                                                                                                                                                                  ModelIndex to start indexing from. Defaults to root index.

                                                                                                                                                                                                                                  None
                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractitemmodel.py
                                                                                                                                                                                                                                  def index_from_key(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      key_path: Sequence[tuple[int, int] | int],
                                                                                                                                                                                                                                      *,
                                                                                                                                                                                                                                      parent_index: core.ModelIndex | None = None,
                                                                                                                                                                                                                                  ) -> core.ModelIndex:
                                                                                                                                                                                                                                      """Return a  ModelIndex for the given key path.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          key_path: Key path to get an index for.
                                                                                                                                                                                                                                                    Should be a sequence of either (row, column)  or row indices
                                                                                                                                                                                                                                          parent_index: ModelIndex to start indexing from. Defaults to root index.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return modelhelpers.index_from_key(self, key_path, parent_index=parent_index)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  iter_tree(parent_index: core.ModelIndex | None = None, *, depth: int | None = None, fetch_more: bool = False) -> Iterator[core.ModelIndex]

                                                                                                                                                                                                                                  Iter through all indexes of the model tree.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  parent_index ModelIndex | None

                                                                                                                                                                                                                                  parent index

                                                                                                                                                                                                                                  None
                                                                                                                                                                                                                                  depth int | None

                                                                                                                                                                                                                                  maximum iteration depth

                                                                                                                                                                                                                                  None
                                                                                                                                                                                                                                  fetch_more bool

                                                                                                                                                                                                                                  call fetchMore for all indexes until canFetchMore returns False

                                                                                                                                                                                                                                  False
                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractitemmodel.py
                                                                                                                                                                                                                                  def iter_tree(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      parent_index: core.ModelIndex | None = None,
                                                                                                                                                                                                                                      *,
                                                                                                                                                                                                                                      depth: int | None = None,
                                                                                                                                                                                                                                      fetch_more: bool = False,
                                                                                                                                                                                                                                  ) -> Iterator[core.ModelIndex]:
                                                                                                                                                                                                                                      """Iter through all indexes of the model tree.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          parent_index: parent index
                                                                                                                                                                                                                                          depth: maximum iteration depth
                                                                                                                                                                                                                                          fetch_more: call fetchMore for all indexes until canFetchMore returns False
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      if parent_index is None:
                                                                                                                                                                                                                                          # TODO: does this always equal AbstractItemView.rootIndex()?
                                                                                                                                                                                                                                          # parent_index = self.index(0, 0)
                                                                                                                                                                                                                                          parent_index = core.ModelIndex()
                                                                                                                                                                                                                                      if parent_index.isValid():
                                                                                                                                                                                                                                          yield parent_index
                                                                                                                                                                                                                                          if fetch_more:
                                                                                                                                                                                                                                              while self.canFetchMore(parent_index):
                                                                                                                                                                                                                                                  self.fetchMore(parent_index)
                                                                                                                                                                                                                                      if depth is not None and (depth := depth - 1) < 0:
                                                                                                                                                                                                                                          return
                                                                                                                                                                                                                                      for i in range(self.rowCount(parent_index)):
                                                                                                                                                                                                                                          child_index = self.index(i, 0, parent_index)
                                                                                                                                                                                                                                          yield from self.iter_tree(child_index, depth=depth, fetch_more=fetch_more)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  reset_model()

                                                                                                                                                                                                                                  Context manager to reset the model.

                                                                                                                                                                                                                                  wraps calls with correct signals emitted at beginning: beginResetModel emitted at end: endResetModel

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractitemmodel.py
                                                                                                                                                                                                                                  @contextlib.contextmanager
                                                                                                                                                                                                                                  def reset_model(self):
                                                                                                                                                                                                                                      """Context manager to reset the model.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      wraps calls with correct signals
                                                                                                                                                                                                                                      emitted at beginning: beginResetModel
                                                                                                                                                                                                                                      emitted at end: endResetModel
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.beginResetModel()
                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          yield None
                                                                                                                                                                                                                                      finally:
                                                                                                                                                                                                                                          self.endResetModel()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  search_tree(value: Any, *, role: constants.ItemDataRole | int = constants.DISPLAY_ROLE, parent_index: core.ModelIndex | None = None, max_results: int | None = None, depth: int | None = None) -> listdelegators.ListDelegator[core.ModelIndex]

                                                                                                                                                                                                                                  Search the tree for indexes with a given value in given role.

                                                                                                                                                                                                                                  Compared to QAbstractItemModel.match, this method allows to set a maximum search depth and passing several values to search for as a list.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  value Any

                                                                                                                                                                                                                                  Item or list of items to search for.

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  role ItemDataRole | int

                                                                                                                                                                                                                                  Index role to search in.

                                                                                                                                                                                                                                  DISPLAY_ROLE
                                                                                                                                                                                                                                  parent_index ModelIndex | None

                                                                                                                                                                                                                                  start index for searching. If None, whole tree is searched.

                                                                                                                                                                                                                                  None
                                                                                                                                                                                                                                  max_results int | None

                                                                                                                                                                                                                                  stop searching after x amount of hits. 'None' means no limit.

                                                                                                                                                                                                                                  None
                                                                                                                                                                                                                                  depth int | None

                                                                                                                                                                                                                                  search depth. Search depth. 'None' means no limit.

                                                                                                                                                                                                                                  None
                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractitemmodel.py
                                                                                                                                                                                                                                  def search_tree(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      value: Any,
                                                                                                                                                                                                                                      *,
                                                                                                                                                                                                                                      role: constants.ItemDataRole | int = constants.DISPLAY_ROLE,
                                                                                                                                                                                                                                      parent_index: core.ModelIndex | None = None,
                                                                                                                                                                                                                                      max_results: int | None = None,
                                                                                                                                                                                                                                      depth: int | None = None,
                                                                                                                                                                                                                                  ) -> listdelegators.ListDelegator[core.ModelIndex]:
                                                                                                                                                                                                                                      """Search the tree for indexes with a given value in given role.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Compared to QAbstractItemModel.match, this method allows to set a maximum
                                                                                                                                                                                                                                      search depth and passing several values to search for as a list.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          value: Item or list of items to search for.
                                                                                                                                                                                                                                          role: Index role to search in.
                                                                                                                                                                                                                                          parent_index: start index for searching. If None, whole tree is searched.
                                                                                                                                                                                                                                          max_results: stop searching after x amount of hits. 'None' means no limit.
                                                                                                                                                                                                                                          depth: search depth. Search depth. 'None' means no limit.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      results = []
                                                                                                                                                                                                                                      # This makes it impossible to search for lists. I think thats fine.
                                                                                                                                                                                                                                      if not isinstance(value, list):
                                                                                                                                                                                                                                          value = [value]
                                                                                                                                                                                                                                      for idx in self.iter_tree(parent_index, depth=depth):
                                                                                                                                                                                                                                          if self.data(idx, role) in value:
                                                                                                                                                                                                                                              results.append(idx)
                                                                                                                                                                                                                                              if len(results) == max_results:
                                                                                                                                                                                                                                                  break
                                                                                                                                                                                                                                      return listdelegators.ListDelegator(results)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  to_display_text(value: Any) -> str staticmethod

                                                                                                                                                                                                                                  Convert an arbitrary value into a string suitable for DisplayRole.

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractitemmodel.py
                                                                                                                                                                                                                                  @staticmethod
                                                                                                                                                                                                                                  def to_display_text(value: Any) -> str:
                                                                                                                                                                                                                                      """Convert an arbitrary value into a string suitable for DisplayRole."""
                                                                                                                                                                                                                                      match value:
                                                                                                                                                                                                                                          case None:
                                                                                                                                                                                                                                              return ""
                                                                                                                                                                                                                                          case str():
                                                                                                                                                                                                                                              return value
                                                                                                                                                                                                                                          case bool() | int() | float():
                                                                                                                                                                                                                                              return str(value)
                                                                                                                                                                                                                                          case enum.Enum():
                                                                                                                                                                                                                                              return value.name
                                                                                                                                                                                                                                      return repr(value)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  AbstractListModel

                                                                                                                                                                                                                                  Bases: AbstractListModelMixin, QAbstractListModel

                                                                                                                                                                                                                                  Abstract model that can be subclassed to create one-dimensional list models.

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractlistmodel.py
                                                                                                                                                                                                                                  class AbstractListModel(AbstractListModelMixin, core.QAbstractListModel):
                                                                                                                                                                                                                                      """Abstract model that can be subclassed to create one-dimensional list models."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  AbstractNativeEventFilter

                                                                                                                                                                                                                                  Bases: QAbstractNativeEventFilter

                                                                                                                                                                                                                                  Interface for receiving native events, such as MSG or XCB event structs.

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractnativeeventfilter.py
                                                                                                                                                                                                                                  4
                                                                                                                                                                                                                                  5
                                                                                                                                                                                                                                  6
                                                                                                                                                                                                                                  7
                                                                                                                                                                                                                                  8
                                                                                                                                                                                                                                  9
                                                                                                                                                                                                                                  class AbstractNativeEventFilter(QtCore.QAbstractNativeEventFilter):
                                                                                                                                                                                                                                      """Interface for receiving native events, such as MSG or XCB event structs."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def install(self):
                                                                                                                                                                                                                                          # theres also QCoreApplication::installNativeEventFilter. Not sure abt difference
                                                                                                                                                                                                                                          QtCore.QAbstractEventDispatcher.instance().installNativeEventFilter(self)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  AbstractProxyModel

                                                                                                                                                                                                                                  Bases: AbstractProxyModelMixin, QAbstractProxyModel

                                                                                                                                                                                                                                  Base class for proxy item models that can do sorting, filtering and processing.

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractproxymodel.py
                                                                                                                                                                                                                                  class AbstractProxyModel(AbstractProxyModelMixin, core.QAbstractProxyModel):
                                                                                                                                                                                                                                      """Base class for proxy item models that can do sorting, filtering and processing."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  AbstractProxyModelMixin

                                                                                                                                                                                                                                  Bases: AbstractItemModelMixin, _AbstractProxyModelBase

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractproxymodel.py
                                                                                                                                                                                                                                  class AbstractProxyModelMixin(core.AbstractItemModelMixin, _AbstractProxyModelBase):
                                                                                                                                                                                                                                      ID = ""
                                                                                                                                                                                                                                      ICON = "mdi.table-edit"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __pretty__(self, fmt: Callable[[Any], Any], **kwargs: Any) -> Generator[Any]:
                                                                                                                                                                                                                                          yield f"{type(self).__name__}("
                                                                                                                                                                                                                                          yield 1
                                                                                                                                                                                                                                          # yield 1
                                                                                                                                                                                                                                          yield f"objectName={self.objectName()}"
                                                                                                                                                                                                                                          yield 0
                                                                                                                                                                                                                                          for k, v in self.get_properties(include_super=False).items():
                                                                                                                                                                                                                                              yield f"{k}={v!r}"
                                                                                                                                                                                                                                              yield 0
                                                                                                                                                                                                                                          model = self.sourceModel()
                                                                                                                                                                                                                                          if (pretty := getattr(model, "__pretty__", None)) is not None:
                                                                                                                                                                                                                                              yield from pretty(fmt, **kwargs)
                                                                                                                                                                                                                                              yield 0
                                                                                                                                                                                                                                          yield -1
                                                                                                                                                                                                                                          # yield -1
                                                                                                                                                                                                                                          yield ")"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def parent(self, *args):
                                                                                                                                                                                                                                          # workaround: PyQt6 QIdentityproxymodel.parent() missing
                                                                                                                                                                                                                                          if not args and qt.API == "pyqt6":
                                                                                                                                                                                                                                              return core.QAbstractProxyModel.parent(self)
                                                                                                                                                                                                                                          return super().parent(*args)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def first_item_index(self) -> core.ModelIndex:
                                                                                                                                                                                                                                          """Return the first child of the root item."""
                                                                                                                                                                                                                                          # We cannot just call the same function of the source model because the first node
                                                                                                                                                                                                                                          # there may be hidden.
                                                                                                                                                                                                                                          proxy_root_index = self.mapFromSource(core.ModelIndex())
                                                                                                                                                                                                                                          return self.index(0, 0, proxy_root_index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_source_model(self, skip_proxies: bool = True):
                                                                                                                                                                                                                                          model = self.sourceModel()
                                                                                                                                                                                                                                          if skip_proxies:
                                                                                                                                                                                                                                              while isinstance(model, core.QAbstractProxyModel):
                                                                                                                                                                                                                                                  model = model.sourceModel()
                                                                                                                                                                                                                                          return model
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def remove(self):
                                                                                                                                                                                                                                          parent = self.parent()
                                                                                                                                                                                                                                          models = parent.get_models()
                                                                                                                                                                                                                                          idx = models.index(self)
                                                                                                                                                                                                                                          if idx == len(models) - 1:
                                                                                                                                                                                                                                              parent.set_model(models[idx - 1])
                                                                                                                                                                                                                                              self.setSourceModel(None)  # ty: ignore[invalid-argument-type]  # stub lacks None
                                                                                                                                                                                                                                          elif idx == 0 and len(models) > 0:
                                                                                                                                                                                                                                              parent.set_model(models[1])
                                                                                                                                                                                                                                          elif idx > 0 and len(models) > 2:  # noqa: PLR2004
                                                                                                                                                                                                                                              models[idx - 1].setSourceModel(models[idx + 1])
                                                                                                                                                                                                                                              self.setSourceModel(None)  # ty: ignore[invalid-argument-type]  # stub lacks None
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_source_mapping(self, leaves_only: bool = False):
                                                                                                                                                                                                                                          _source_key = []
                                                                                                                                                                                                                                          _source_offset = {}
                                                                                                                                                                                                                                          source = self.sourceModel()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          def create_mapping(
                                                                                                                                                                                                                                              model,
                                                                                                                                                                                                                                              index: core.ModelIndex,
                                                                                                                                                                                                                                              key_path: tuple[int, ...],
                                                                                                                                                                                                                                              leaves_only: bool = False,
                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                              if (rowcount := model.rowCount(index)) > 0:
                                                                                                                                                                                                                                                  if not leaves_only:
                                                                                                                                                                                                                                                      _source_offset[key_path] = len(_source_offset)
                                                                                                                                                                                                                                                      _source_key.append(key_path)
                                                                                                                                                                                                                                                  for i in range(rowcount):
                                                                                                                                                                                                                                                      child = model.index(i, 0, index)
                                                                                                                                                                                                                                                      create_mapping(model, child, (*key_path, i), leaves_only=leaves_only)
                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                  _source_offset[key_path] = len(_source_offset)
                                                                                                                                                                                                                                                  _source_key.append(key_path)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          for i in range(source.rowCount()):
                                                                                                                                                                                                                                              create_mapping(source, source.index(i, 0), (i,), leaves_only=leaves_only)
                                                                                                                                                                                                                                          return _source_key, _source_offset
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def source_index_from_key(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          key_path: Sequence[tuple[int, int] | int],
                                                                                                                                                                                                                                          parent_index: core.ModelIndex | None = None,
                                                                                                                                                                                                                                      ) -> core.ModelIndex:
                                                                                                                                                                                                                                          """Return a QModelIndex of the sourceModel for the given key.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              key_path: Key path to get an index for.
                                                                                                                                                                                                                                                        Should be a sequence of either (row, column)  or row indices
                                                                                                                                                                                                                                              parent_index: ModelIndex to start indexing from. Defaults to root index.
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          model = self.sourceModel()
                                                                                                                                                                                                                                          return modelhelpers.index_from_key(model, key_path, parent_index)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  first_item_index() -> core.ModelIndex

                                                                                                                                                                                                                                  Return the first child of the root item.

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractproxymodel.py
                                                                                                                                                                                                                                  def first_item_index(self) -> core.ModelIndex:
                                                                                                                                                                                                                                      """Return the first child of the root item."""
                                                                                                                                                                                                                                      # We cannot just call the same function of the source model because the first node
                                                                                                                                                                                                                                      # there may be hidden.
                                                                                                                                                                                                                                      proxy_root_index = self.mapFromSource(core.ModelIndex())
                                                                                                                                                                                                                                      return self.index(0, 0, proxy_root_index)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  source_index_from_key(key_path: Sequence[tuple[int, int] | int], parent_index: core.ModelIndex | None = None) -> core.ModelIndex

                                                                                                                                                                                                                                  Return a QModelIndex of the sourceModel for the given key.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  key_path Sequence[tuple[int, int] | int]

                                                                                                                                                                                                                                  Key path to get an index for. Should be a sequence of either (row, column) or row indices

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  parent_index ModelIndex | None

                                                                                                                                                                                                                                  ModelIndex to start indexing from. Defaults to root index.

                                                                                                                                                                                                                                  None
                                                                                                                                                                                                                                  Source code in prettyqt/core/abstractproxymodel.py
                                                                                                                                                                                                                                  def source_index_from_key(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      key_path: Sequence[tuple[int, int] | int],
                                                                                                                                                                                                                                      parent_index: core.ModelIndex | None = None,
                                                                                                                                                                                                                                  ) -> core.ModelIndex:
                                                                                                                                                                                                                                      """Return a QModelIndex of the sourceModel for the given key.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          key_path: Key path to get an index for.
                                                                                                                                                                                                                                                    Should be a sequence of either (row, column)  or row indices
                                                                                                                                                                                                                                          parent_index: ModelIndex to start indexing from. Defaults to root index.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      model = self.sourceModel()
                                                                                                                                                                                                                                      return modelhelpers.index_from_key(model, key_path, parent_index)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  AbstractTableModel

                                                                                                                                                                                                                                  Bases: AbstractTableModelMixin, QAbstractTableModel

                                                                                                                                                                                                                                  Abstract model that can be subclassed to create table models.

                                                                                                                                                                                                                                  Source code in prettyqt/core/abstracttablemodel.py
                                                                                                                                                                                                                                  class AbstractTableModel(AbstractTableModelMixin, core.QAbstractTableModel):
                                                                                                                                                                                                                                      """Abstract model that can be subclassed to create table models."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  AnimationGroup

                                                                                                                                                                                                                                  Bases: AnimationGroupMixin, QAnimationGroup

                                                                                                                                                                                                                                  Abstract base class for groups of animations.

                                                                                                                                                                                                                                  Source code in prettyqt/core/animationgroup.py
                                                                                                                                                                                                                                  class AnimationGroup(AnimationGroupMixin, core.QAnimationGroup):
                                                                                                                                                                                                                                      """Abstract base class for groups of animations."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  AnimationGroupMixin

                                                                                                                                                                                                                                  Bases: AbstractAnimationMixin, _AnimationGroupBase

                                                                                                                                                                                                                                  Source code in prettyqt/core/animationgroup.py
                                                                                                                                                                                                                                  class AnimationGroupMixin(core.AbstractAnimationMixin, _AnimationGroupBase):
                                                                                                                                                                                                                                      @overload
                                                                                                                                                                                                                                      def __getitem__(self, index: int) -> core.QAbstractAnimation: ...
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @overload
                                                                                                                                                                                                                                      def __getitem__(
                                                                                                                                                                                                                                          self, index: slice
                                                                                                                                                                                                                                      ) -> listdelegators.ListDelegator[core.QAbstractAnimation]: ...
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getitem__(self, index: int | slice):
                                                                                                                                                                                                                                          count = self.animationCount()
                                                                                                                                                                                                                                          match index:
                                                                                                                                                                                                                                              case int():
                                                                                                                                                                                                                                                  if index < 0:
                                                                                                                                                                                                                                                      index = count + index
                                                                                                                                                                                                                                                  if index >= count:
                                                                                                                                                                                                                                                      raise IndexError(index)
                                                                                                                                                                                                                                                  anim = self.animationAt(index)
                                                                                                                                                                                                                                                  if anim is None:
                                                                                                                                                                                                                                                      raise KeyError(index)
                                                                                                                                                                                                                                                  return anim
                                                                                                                                                                                                                                              case slice():
                                                                                                                                                                                                                                                  stop = index.stop or count
                                                                                                                                                                                                                                                  rng = range(index.start or 0, stop, index.step or 1)
                                                                                                                                                                                                                                                  anims = [self.animationAt(i) for i in rng]
                                                                                                                                                                                                                                                  return listdelegators.ListDelegator(anims)
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  raise TypeError(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __setitem__(self, index: int, value: core.QAbstractAnimation):
                                                                                                                                                                                                                                          if not (0 <= index < self.animationCount()):
                                                                                                                                                                                                                                              raise KeyError(index)
                                                                                                                                                                                                                                          self.takeAnimation(index)
                                                                                                                                                                                                                                          self.insertAnimation(index, value)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __iter__(self) -> Iterator[core.QAbstractAnimation]:
                                                                                                                                                                                                                                          return (self.animationAt(i) for i in range(self.animationCount()))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __len__(self):
                                                                                                                                                                                                                                          return self.animationCount()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __delitem__(self, index: int):
                                                                                                                                                                                                                                          if not (0 <= index < self.animationCount()):
                                                                                                                                                                                                                                              raise KeyError(index)
                                                                                                                                                                                                                                          self.takeAnimation(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __add__(self, other: core.QAbstractAnimation):
                                                                                                                                                                                                                                          self.addAnimation(other)
                                                                                                                                                                                                                                          return self
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def targetObject(self) -> core.QObject:
                                                                                                                                                                                                                                          """Return shared targetObject if existing."""
                                                                                                                                                                                                                                          targets = [
                                                                                                                                                                                                                                              anim.targetObject()
                                                                                                                                                                                                                                              for i in range(self.animationCount())
                                                                                                                                                                                                                                              if isinstance((anim := self.animationAt(i)), core.QPropertyAnimation)
                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                          if len(targets) != self.animationCount() or len(set(targets)) != 1:
                                                                                                                                                                                                                                              msg = "Could not find shared targetObject for all animations."
                                                                                                                                                                                                                                              raise RuntimeError(msg)
                                                                                                                                                                                                                                          return targets[0]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def add_property_animation(self, obj: types.MethodType) -> core.PropertyAnimation:
                                                                                                                                                                                                                                          anim = core.PropertyAnimation()
                                                                                                                                                                                                                                          anim.apply_to(obj)
                                                                                                                                                                                                                                          self.addAnimation(anim)
                                                                                                                                                                                                                                          return anim
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  targetObject() -> core.QObject

                                                                                                                                                                                                                                  Return shared targetObject if existing.

                                                                                                                                                                                                                                  Source code in prettyqt/core/animationgroup.py
                                                                                                                                                                                                                                  def targetObject(self) -> core.QObject:
                                                                                                                                                                                                                                      """Return shared targetObject if existing."""
                                                                                                                                                                                                                                      targets = [
                                                                                                                                                                                                                                          anim.targetObject()
                                                                                                                                                                                                                                          for i in range(self.animationCount())
                                                                                                                                                                                                                                          if isinstance((anim := self.animationAt(i)), core.QPropertyAnimation)
                                                                                                                                                                                                                                      ]
                                                                                                                                                                                                                                      if len(targets) != self.animationCount() or len(set(targets)) != 1:
                                                                                                                                                                                                                                          msg = "Could not find shared targetObject for all animations."
                                                                                                                                                                                                                                          raise RuntimeError(msg)
                                                                                                                                                                                                                                      return targets[0]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  AsyncBridge

                                                                                                                                                                                                                                  Runs a standard asyncio loop in a background thread bridged to Qt.

                                                                                                                                                                                                                                  Both submit() (Qt -> asyncio) and call_in_gui_thread() (asyncio -> Qt) propagate contextvars.Context, preserving OpenTelemetry spans and any other context variables seamlessly across thread boundaries.

                                                                                                                                                                                                                                  Source code in prettyqt/core/aio.py
                                                                                                                                                                                                                                  class AsyncBridge:
                                                                                                                                                                                                                                      """Runs a standard `asyncio` loop in a background thread bridged to Qt.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Both `submit()` (Qt -> asyncio) and `call_in_gui_thread()` (asyncio -> Qt)
                                                                                                                                                                                                                                      propagate `contextvars.Context`, preserving OpenTelemetry spans and any
                                                                                                                                                                                                                                      other context variables seamlessly across thread boundaries.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, *, debug: bool = False) -> None:
                                                                                                                                                                                                                                          self._debug = debug
                                                                                                                                                                                                                                          self._loop: asyncio.AbstractEventLoop | None = None
                                                                                                                                                                                                                                          self._thread: threading.Thread | None = None
                                                                                                                                                                                                                                          self._dispatcher: _GuiDispatcher | None = None
                                                                                                                                                                                                                                          self._started = threading.Event()
                                                                                                                                                                                                                                          self._lock = threading.Lock()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def is_running(self) -> bool:
                                                                                                                                                                                                                                          return self._loop is not None and self._loop.is_running()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def loop(self) -> asyncio.AbstractEventLoop:
                                                                                                                                                                                                                                          if self._loop is None or not self._loop.is_running():
                                                                                                                                                                                                                                              msg = "AsyncBridge is not running; call start() first."
                                                                                                                                                                                                                                              raise RuntimeError(msg)
                                                                                                                                                                                                                                          return self._loop
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def start(self) -> Self:
                                                                                                                                                                                                                                          """Start the background `asyncio` event loop thread."""
                                                                                                                                                                                                                                          with self._lock:
                                                                                                                                                                                                                                              if self.is_running:
                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                              self._started.clear()
                                                                                                                                                                                                                                              if QtCore.QCoreApplication.instance() is not None:
                                                                                                                                                                                                                                                  self._dispatcher = _GuiDispatcher()
                                                                                                                                                                                                                                              self._thread = threading.Thread(
                                                                                                                                                                                                                                                  target=self._run_loop,
                                                                                                                                                                                                                                                  name="prettyqt-asyncio",
                                                                                                                                                                                                                                                  daemon=True,
                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                              self._thread.start()
                                                                                                                                                                                                                                          self._started.wait()
                                                                                                                                                                                                                                          return self
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def stop(self, timeout: float = 5.0) -> None:
                                                                                                                                                                                                                                          """Cancel pending tasks and stop the background event loop thread."""
                                                                                                                                                                                                                                          with self._lock:
                                                                                                                                                                                                                                              loop = self._loop
                                                                                                                                                                                                                                              thread = self._thread
                                                                                                                                                                                                                                              if loop is None:
                                                                                                                                                                                                                                                  return
                                                                                                                                                                                                                                              if loop.is_running():
                                                                                                                                                                                                                                                  loop.call_soon_threadsafe(self._cancel_all_and_stop, loop)
                                                                                                                                                                                                                                          if thread is not None and thread is not threading.current_thread():
                                                                                                                                                                                                                                              thread.join(timeout=timeout)
                                                                                                                                                                                                                                          with self._lock:
                                                                                                                                                                                                                                              self._loop = None
                                                                                                                                                                                                                                              self._thread = None
                                                                                                                                                                                                                                              self._dispatcher = None
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __enter__(self) -> Self:
                                                                                                                                                                                                                                          return self.start()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __exit__(self, *exc_info: object) -> None:
                                                                                                                                                                                                                                          self.stop()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def _run_loop(self) -> None:
                                                                                                                                                                                                                                          loop = asyncio.new_event_loop()
                                                                                                                                                                                                                                          loop.set_debug(self._debug)
                                                                                                                                                                                                                                          asyncio.set_event_loop(loop)
                                                                                                                                                                                                                                          self._loop = loop
                                                                                                                                                                                                                                          _loop_to_bridge[loop] = self
                                                                                                                                                                                                                                          loop.call_soon(self._started.set)
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              loop.run_forever()
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              try:
                                                                                                                                                                                                                                                  pending = asyncio.all_tasks(loop)
                                                                                                                                                                                                                                                  for task in pending:
                                                                                                                                                                                                                                                      task.cancel()
                                                                                                                                                                                                                                                  if pending:
                                                                                                                                                                                                                                                      loop.run_until_complete(
                                                                                                                                                                                                                                                          asyncio.gather(*pending, return_exceptions=True)
                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                  loop.run_until_complete(loop.shutdown_asyncgens())
                                                                                                                                                                                                                                                  loop.run_until_complete(loop.shutdown_default_executor())
                                                                                                                                                                                                                                              finally:
                                                                                                                                                                                                                                                  loop.close()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @staticmethod
                                                                                                                                                                                                                                      def _cancel_all_and_stop(loop: asyncio.AbstractEventLoop) -> None:
                                                                                                                                                                                                                                          for task in asyncio.all_tasks(loop):
                                                                                                                                                                                                                                              task.cancel()
                                                                                                                                                                                                                                          loop.stop()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def submit[T](
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          coro: Coroutine[Any, Any, T],
                                                                                                                                                                                                                                          *,
                                                                                                                                                                                                                                          context: contextvars.Context | None = None,
                                                                                                                                                                                                                                          on_error: Callable[[BaseException], Any] | None = None,
                                                                                                                                                                                                                                      ) -> concurrent.futures.Future[T]:
                                                                                                                                                                                                                                          """Submit a coroutine to the background loop, preserving `contextvars`."""
                                                                                                                                                                                                                                          loop = self.loop
                                                                                                                                                                                                                                          ctx = contextvars.copy_context() if context is None else context
                                                                                                                                                                                                                                          result_fut: concurrent.futures.Future[T] = concurrent.futures.Future()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          def _start() -> None:
                                                                                                                                                                                                                                              if result_fut.cancelled():
                                                                                                                                                                                                                                                  coro.close()
                                                                                                                                                                                                                                                  return
                                                                                                                                                                                                                                              task = loop.create_task(coro, context=ctx)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                              def _on_done(done_task: asyncio.Task[T]) -> None:
                                                                                                                                                                                                                                                  if result_fut.done():
                                                                                                                                                                                                                                                      return
                                                                                                                                                                                                                                                  if done_task.cancelled():
                                                                                                                                                                                                                                                      result_fut.cancel()
                                                                                                                                                                                                                                                  elif (exc := done_task.exception()) is not None:
                                                                                                                                                                                                                                                      result_fut.set_exception(exc)
                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                      result_fut.set_result(done_task.result())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                              task.add_done_callback(_on_done)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          if on_error is not None:
                                                                                                                                                                                                                                              result_fut.add_done_callback(lambda f: _report_future_error(f, on_error))
                                                                                                                                                                                                                                          loop.call_soon_threadsafe(_start)
                                                                                                                                                                                                                                          return result_fut
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def call_in_gui_thread[T](
                                                                                                                                                                                                                                          self, fn: Callable[..., T], *args: Any, **kwargs: Any
                                                                                                                                                                                                                                      ) -> asyncio.Future[T]:
                                                                                                                                                                                                                                          """Marshal `fn(*args, **kwargs)` onto the Qt main thread and await its result."""
                                                                                                                                                                                                                                          running_loop = asyncio.get_running_loop()
                                                                                                                                                                                                                                          fut: asyncio.Future[T] = running_loop.create_future()
                                                                                                                                                                                                                                          app = QtCore.QCoreApplication.instance()
                                                                                                                                                                                                                                          if app is None or QtCore.QThread.currentThread() == app.thread():
                                                                                                                                                                                                                                              try:
                                                                                                                                                                                                                                                  fut.set_result(fn(*args, **kwargs))
                                                                                                                                                                                                                                              except BaseException as exc:  # noqa: BLE001
                                                                                                                                                                                                                                                  fut.set_exception(exc)
                                                                                                                                                                                                                                              return fut
                                                                                                                                                                                                                                          if self._dispatcher is None:
                                                                                                                                                                                                                                              msg = "No QCoreApplication available for GUI thread dispatch."
                                                                                                                                                                                                                                              raise RuntimeError(msg)
                                                                                                                                                                                                                                          ctx = contextvars.copy_context()
                                                                                                                                                                                                                                          self._dispatcher._invoke.emit((ctx, fn, args, kwargs, running_loop, fut))
                                                                                                                                                                                                                                          return fut
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  call_in_gui_thread(fn: Callable[..., T], *args: Any, **kwargs: Any) -> asyncio.Future[T]

                                                                                                                                                                                                                                  Marshal fn(*args, **kwargs) onto the Qt main thread and await its result.

                                                                                                                                                                                                                                  Source code in prettyqt/core/aio.py
                                                                                                                                                                                                                                  def call_in_gui_thread[T](
                                                                                                                                                                                                                                      self, fn: Callable[..., T], *args: Any, **kwargs: Any
                                                                                                                                                                                                                                  ) -> asyncio.Future[T]:
                                                                                                                                                                                                                                      """Marshal `fn(*args, **kwargs)` onto the Qt main thread and await its result."""
                                                                                                                                                                                                                                      running_loop = asyncio.get_running_loop()
                                                                                                                                                                                                                                      fut: asyncio.Future[T] = running_loop.create_future()
                                                                                                                                                                                                                                      app = QtCore.QCoreApplication.instance()
                                                                                                                                                                                                                                      if app is None or QtCore.QThread.currentThread() == app.thread():
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              fut.set_result(fn(*args, **kwargs))
                                                                                                                                                                                                                                          except BaseException as exc:  # noqa: BLE001
                                                                                                                                                                                                                                              fut.set_exception(exc)
                                                                                                                                                                                                                                          return fut
                                                                                                                                                                                                                                      if self._dispatcher is None:
                                                                                                                                                                                                                                          msg = "No QCoreApplication available for GUI thread dispatch."
                                                                                                                                                                                                                                          raise RuntimeError(msg)
                                                                                                                                                                                                                                      ctx = contextvars.copy_context()
                                                                                                                                                                                                                                      self._dispatcher._invoke.emit((ctx, fn, args, kwargs, running_loop, fut))
                                                                                                                                                                                                                                      return fut
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  start() -> Self

                                                                                                                                                                                                                                  Start the background asyncio event loop thread.

                                                                                                                                                                                                                                  Source code in prettyqt/core/aio.py
                                                                                                                                                                                                                                  def start(self) -> Self:
                                                                                                                                                                                                                                      """Start the background `asyncio` event loop thread."""
                                                                                                                                                                                                                                      with self._lock:
                                                                                                                                                                                                                                          if self.is_running:
                                                                                                                                                                                                                                              return self
                                                                                                                                                                                                                                          self._started.clear()
                                                                                                                                                                                                                                          if QtCore.QCoreApplication.instance() is not None:
                                                                                                                                                                                                                                              self._dispatcher = _GuiDispatcher()
                                                                                                                                                                                                                                          self._thread = threading.Thread(
                                                                                                                                                                                                                                              target=self._run_loop,
                                                                                                                                                                                                                                              name="prettyqt-asyncio",
                                                                                                                                                                                                                                              daemon=True,
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                          self._thread.start()
                                                                                                                                                                                                                                      self._started.wait()
                                                                                                                                                                                                                                      return self
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  stop(timeout: float = 5.0) -> None

                                                                                                                                                                                                                                  Cancel pending tasks and stop the background event loop thread.

                                                                                                                                                                                                                                  Source code in prettyqt/core/aio.py
                                                                                                                                                                                                                                  def stop(self, timeout: float = 5.0) -> None:
                                                                                                                                                                                                                                      """Cancel pending tasks and stop the background event loop thread."""
                                                                                                                                                                                                                                      with self._lock:
                                                                                                                                                                                                                                          loop = self._loop
                                                                                                                                                                                                                                          thread = self._thread
                                                                                                                                                                                                                                          if loop is None:
                                                                                                                                                                                                                                              return
                                                                                                                                                                                                                                          if loop.is_running():
                                                                                                                                                                                                                                              loop.call_soon_threadsafe(self._cancel_all_and_stop, loop)
                                                                                                                                                                                                                                      if thread is not None and thread is not threading.current_thread():
                                                                                                                                                                                                                                          thread.join(timeout=timeout)
                                                                                                                                                                                                                                      with self._lock:
                                                                                                                                                                                                                                          self._loop = None
                                                                                                                                                                                                                                          self._thread = None
                                                                                                                                                                                                                                          self._dispatcher = None
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  submit(coro: Coroutine[Any, Any, T], *, context: contextvars.Context | None = None, on_error: Callable[[BaseException], Any] | None = None) -> concurrent.futures.Future[T]

                                                                                                                                                                                                                                  Submit a coroutine to the background loop, preserving contextvars.

                                                                                                                                                                                                                                  Source code in prettyqt/core/aio.py
                                                                                                                                                                                                                                  def submit[T](
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      coro: Coroutine[Any, Any, T],
                                                                                                                                                                                                                                      *,
                                                                                                                                                                                                                                      context: contextvars.Context | None = None,
                                                                                                                                                                                                                                      on_error: Callable[[BaseException], Any] | None = None,
                                                                                                                                                                                                                                  ) -> concurrent.futures.Future[T]:
                                                                                                                                                                                                                                      """Submit a coroutine to the background loop, preserving `contextvars`."""
                                                                                                                                                                                                                                      loop = self.loop
                                                                                                                                                                                                                                      ctx = contextvars.copy_context() if context is None else context
                                                                                                                                                                                                                                      result_fut: concurrent.futures.Future[T] = concurrent.futures.Future()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def _start() -> None:
                                                                                                                                                                                                                                          if result_fut.cancelled():
                                                                                                                                                                                                                                              coro.close()
                                                                                                                                                                                                                                              return
                                                                                                                                                                                                                                          task = loop.create_task(coro, context=ctx)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          def _on_done(done_task: asyncio.Task[T]) -> None:
                                                                                                                                                                                                                                              if result_fut.done():
                                                                                                                                                                                                                                                  return
                                                                                                                                                                                                                                              if done_task.cancelled():
                                                                                                                                                                                                                                                  result_fut.cancel()
                                                                                                                                                                                                                                              elif (exc := done_task.exception()) is not None:
                                                                                                                                                                                                                                                  result_fut.set_exception(exc)
                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                  result_fut.set_result(done_task.result())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          task.add_done_callback(_on_done)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      if on_error is not None:
                                                                                                                                                                                                                                          result_fut.add_done_callback(lambda f: _report_future_error(f, on_error))
                                                                                                                                                                                                                                      loop.call_soon_threadsafe(_start)
                                                                                                                                                                                                                                      return result_fut
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  BasicTimer

                                                                                                                                                                                                                                  Bases: QBasicTimer

                                                                                                                                                                                                                                  Timer events for objects.

                                                                                                                                                                                                                                  Source code in prettyqt/core/basictimer.py
                                                                                                                                                                                                                                  class BasicTimer(core.QBasicTimer):
                                                                                                                                                                                                                                      """Timer events for objects."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return self.isActive()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def start_timer(
                                                                                                                                                                                                                                          self, msec: int, obj: core.QObject, timer_type: constants.TimerTypeStr
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          self.start(msec, constants.TIMER_TYPE.get_enum_value(timer_type), obj)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  BluetoothPermission

                                                                                                                                                                                                                                  Bases: QBluetoothPermission

                                                                                                                                                                                                                                  Access Bluetooth peripherals.

                                                                                                                                                                                                                                  Source code in prettyqt/core/bluetoothpermission.py
                                                                                                                                                                                                                                  class BluetoothPermission(QtCore.QBluetoothPermission):
                                                                                                                                                                                                                                      """Access Bluetooth peripherals."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_communication_modes(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          modes: CommunicationModeStr | QtCore.QBluetoothPermission.CommunicationMode,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Set the Bluetooth communication modes.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              modes: communication modes to set
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setCommunicationModes(COMMUNICATION_MODE.get_enum_value(modes))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_communication_modes(self) -> list[CommunicationModeStr]:
                                                                                                                                                                                                                                          """Return the active Bluetooth communication modes.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              list of communication modes
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          modes = self.communicationModes()
                                                                                                                                                                                                                                          return [k for k, v in COMMUNICATION_MODE.items() if v.value & modes.value]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_communication_modes() -> list[CommunicationModeStr]

                                                                                                                                                                                                                                  Return the active Bluetooth communication modes.

                                                                                                                                                                                                                                  Source code in prettyqt/core/bluetoothpermission.py
                                                                                                                                                                                                                                  def get_communication_modes(self) -> list[CommunicationModeStr]:
                                                                                                                                                                                                                                      """Return the active Bluetooth communication modes.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          list of communication modes
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      modes = self.communicationModes()
                                                                                                                                                                                                                                      return [k for k, v in COMMUNICATION_MODE.items() if v.value & modes.value]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_communication_modes(modes: CommunicationModeStr | QtCore.QBluetoothPermission.CommunicationMode)

                                                                                                                                                                                                                                  Set the Bluetooth communication modes.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  modes CommunicationModeStr | CommunicationMode

                                                                                                                                                                                                                                  communication modes to set

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/bluetoothpermission.py
                                                                                                                                                                                                                                  def set_communication_modes(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      modes: CommunicationModeStr | QtCore.QBluetoothPermission.CommunicationMode,
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Set the Bluetooth communication modes.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          modes: communication modes to set
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setCommunicationModes(COMMUNICATION_MODE.get_enum_value(modes))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Buffer

                                                                                                                                                                                                                                  Bases: IODeviceMixin, QBuffer

                                                                                                                                                                                                                                  QIODevice interface for a QByteArray.

                                                                                                                                                                                                                                  Source code in prettyqt/core/buffer.py
                                                                                                                                                                                                                                  class Buffer(core.IODeviceMixin, core.QBuffer):
                                                                                                                                                                                                                                      """QIODevice interface for a QByteArray."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  ByteArray

                                                                                                                                                                                                                                  Bases: QByteArray

                                                                                                                                                                                                                                  Array of bytes.

                                                                                                                                                                                                                                  Source code in prettyqt/core/bytearray.py
                                                                                                                                                                                                                                  4
                                                                                                                                                                                                                                  5
                                                                                                                                                                                                                                  6
                                                                                                                                                                                                                                  7
                                                                                                                                                                                                                                  8
                                                                                                                                                                                                                                  class ByteArray(QtCore.QByteArray):
                                                                                                                                                                                                                                      """Array of bytes."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (bytes(self.data()),)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  ByteArrayMatcher

                                                                                                                                                                                                                                  Bases: QByteArrayMatcher

                                                                                                                                                                                                                                  Holds a sequence of bytes that can be quickly matched in a byte array.

                                                                                                                                                                                                                                  Source code in prettyqt/core/bytearraymatcher.py
                                                                                                                                                                                                                                  class ByteArrayMatcher(QtCore.QByteArrayMatcher):
                                                                                                                                                                                                                                      """Holds a sequence of bytes that can be quickly matched in a byte array."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.get_pattern())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_pattern(self) -> bytes:
                                                                                                                                                                                                                                          return bytes(self.pattern().data())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Calendar

                                                                                                                                                                                                                                  Bases: QCalendar

                                                                                                                                                                                                                                  Describes calendar systems.

                                                                                                                                                                                                                                  Source code in prettyqt/core/_calendar.py
                                                                                                                                                                                                                                  class Calendar(core.QCalendar):
                                                                                                                                                                                                                                      """Describes calendar systems."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, system: str | core.QCalendar.System = "gregorian"):
                                                                                                                                                                                                                                          typ = system if isinstance(system, core.QCalendar.System) else SYSTEM[system]
                                                                                                                                                                                                                                          super().__init__(typ)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.name())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.name().lower().replace(" ", "_"),)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      # def __bool__(self):
                                                                                                                                                                                                                                      #     return self.isValid()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_date_from_parts(self, year: int, month: int, day: int) -> core.Date:
                                                                                                                                                                                                                                          return core.Date(self.dateFromParts(year, month, day))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  CalendarPermission

                                                                                                                                                                                                                                  Bases: QCalendarPermission

                                                                                                                                                                                                                                  Access the user's calendar.

                                                                                                                                                                                                                                  Source code in prettyqt/core/calendarpermission.py
                                                                                                                                                                                                                                  class CalendarPermission(QtCore.QCalendarPermission):
                                                                                                                                                                                                                                      """Access the user's calendar."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_access_mode(
                                                                                                                                                                                                                                          self, mode: AccessModeStr | QtCore.QCalendarPermission.AccessMode
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Set the calendar access mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              mode: access mode to use
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setAccessMode(ACCESS_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_access_mode(self) -> AccessModeStr:
                                                                                                                                                                                                                                          """Return current calendar access mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              access mode
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return ACCESS_MODE.inverse[self.accessMode()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_access_mode() -> AccessModeStr

                                                                                                                                                                                                                                  Return current calendar access mode.

                                                                                                                                                                                                                                  Source code in prettyqt/core/calendarpermission.py
                                                                                                                                                                                                                                  def get_access_mode(self) -> AccessModeStr:
                                                                                                                                                                                                                                      """Return current calendar access mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          access mode
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return ACCESS_MODE.inverse[self.accessMode()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_access_mode(mode: AccessModeStr | QtCore.QCalendarPermission.AccessMode)

                                                                                                                                                                                                                                  Set the calendar access mode.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  mode AccessModeStr | AccessMode

                                                                                                                                                                                                                                  access mode to use

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/calendarpermission.py
                                                                                                                                                                                                                                  def set_access_mode(
                                                                                                                                                                                                                                      self, mode: AccessModeStr | QtCore.QCalendarPermission.AccessMode
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Set the calendar access mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          mode: access mode to use
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setAccessMode(ACCESS_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  CameraPermission

                                                                                                                                                                                                                                  Bases: QCameraPermission

                                                                                                                                                                                                                                  Access the camera for taking pictures or videos.

                                                                                                                                                                                                                                  Source code in prettyqt/core/camerapermission.py
                                                                                                                                                                                                                                  class CameraPermission(QtCore.QCameraPermission):
                                                                                                                                                                                                                                      """Access the camera for taking pictures or videos."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Collator

                                                                                                                                                                                                                                  Bases: QCollator

                                                                                                                                                                                                                                  Compares strings according to a localized collation algorithm.

                                                                                                                                                                                                                                  Source code in prettyqt/core/collator.py
                                                                                                                                                                                                                                  class Collator(core.QCollator):
                                                                                                                                                                                                                                      """Compares strings according to a localized collation algorithm."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.get_locale())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_locale(self) -> core.Locale:
                                                                                                                                                                                                                                          return core.Locale(self.locale())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_case_sensitive(self, state: bool):
                                                                                                                                                                                                                                          """Set case sensitivity.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              state: case sensitive
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          sensitivity = (
                                                                                                                                                                                                                                              constants.CaseSensitivity.CaseSensitive
                                                                                                                                                                                                                                              if state
                                                                                                                                                                                                                                              else constants.CaseSensitivity.CaseInsensitive
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                          self.setCaseSensitivity(sensitivity)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def is_case_sensitive(self) -> bool:
                                                                                                                                                                                                                                          """Return case sensitivity.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              case sensitivity
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return bool(self.caseSensitivity())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_sort_key(self, string: str) -> core.CollatorSortKey:
                                                                                                                                                                                                                                          return core.CollatorSortKey(self.sortKey(string))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  is_case_sensitive() -> bool

                                                                                                                                                                                                                                  Return case sensitivity.

                                                                                                                                                                                                                                  Source code in prettyqt/core/collator.py
                                                                                                                                                                                                                                  def is_case_sensitive(self) -> bool:
                                                                                                                                                                                                                                      """Return case sensitivity.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          case sensitivity
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return bool(self.caseSensitivity())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_case_sensitive(state: bool)

                                                                                                                                                                                                                                  Set case sensitivity.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  state bool

                                                                                                                                                                                                                                  case sensitive

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/collator.py
                                                                                                                                                                                                                                  def set_case_sensitive(self, state: bool):
                                                                                                                                                                                                                                      """Set case sensitivity.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          state: case sensitive
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      sensitivity = (
                                                                                                                                                                                                                                          constants.CaseSensitivity.CaseSensitive
                                                                                                                                                                                                                                          if state
                                                                                                                                                                                                                                          else constants.CaseSensitivity.CaseInsensitive
                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                      self.setCaseSensitivity(sensitivity)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  CollatorSortKey

                                                                                                                                                                                                                                  Bases: QCollatorSortKey

                                                                                                                                                                                                                                  Can be used to speed up string collation.

                                                                                                                                                                                                                                  Source code in prettyqt/core/collatorsortkey.py
                                                                                                                                                                                                                                  class CollatorSortKey(QtCore.QCollatorSortKey):
                                                                                                                                                                                                                                      """Can be used to speed up string collation."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  CommandLineOption

                                                                                                                                                                                                                                  Bases: QCommandLineOption

                                                                                                                                                                                                                                  Defines a possible command-line option.

                                                                                                                                                                                                                                  Source code in prettyqt/core/commandlineoption.py
                                                                                                                                                                                                                                  class CommandLineOption(core.QCommandLineOption):
                                                                                                                                                                                                                                      """Defines a possible command-line option."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  CommandLineParser

                                                                                                                                                                                                                                  Bases: QCommandLineParser

                                                                                                                                                                                                                                  Means for handling the command line options.

                                                                                                                                                                                                                                  Source code in prettyqt/core/commandlineparser.py
                                                                                                                                                                                                                                  class CommandLineParser(core.QCommandLineParser):
                                                                                                                                                                                                                                      """Means for handling the command line options."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_single_dash_word_option_mode(self, mode: SingleDashWordStr):
                                                                                                                                                                                                                                          """Set the single dash word option mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              mode: single dash word option mode
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setSingleDashWordOptionMode(SINGLE_DASH_WORD.get_enum_value(mode))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_options_after_positional_arguments_mode(
                                                                                                                                                                                                                                          self, mode: OptionsAfterPosArgStr | mod.OptionsAfterPositionalArgumentsMode
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Set the options after positional arguments mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              mode: options after positional arguments mode
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          val = OPTIONS_AFTER_POS_ARG.get_enum_value(mode)
                                                                                                                                                                                                                                          self.setOptionsAfterPositionalArgumentsMode(val)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def add_option(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          name: str,
                                                                                                                                                                                                                                          description: str | None = None,
                                                                                                                                                                                                                                          value_name: str | None = None,
                                                                                                                                                                                                                                          default_value: str | None = None,
                                                                                                                                                                                                                                      ) -> core.CommandLineOption:
                                                                                                                                                                                                                                          if description is None:
                                                                                                                                                                                                                                              description = ""
                                                                                                                                                                                                                                          if value_name is None:
                                                                                                                                                                                                                                              value_name = ""
                                                                                                                                                                                                                                          if default_value is None:
                                                                                                                                                                                                                                              default_value = ""
                                                                                                                                                                                                                                          option = core.CommandLineOption(name, description, value_name, default_value)
                                                                                                                                                                                                                                          self.addOption(option)
                                                                                                                                                                                                                                          return option
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_options_after_positional_arguments_mode(mode: OptionsAfterPosArgStr | mod.OptionsAfterPositionalArgumentsMode)

                                                                                                                                                                                                                                  Set the options after positional arguments mode.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  mode OptionsAfterPosArgStr | OptionsAfterPositionalArgumentsMode

                                                                                                                                                                                                                                  options after positional arguments mode

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/commandlineparser.py
                                                                                                                                                                                                                                  def set_options_after_positional_arguments_mode(
                                                                                                                                                                                                                                      self, mode: OptionsAfterPosArgStr | mod.OptionsAfterPositionalArgumentsMode
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Set the options after positional arguments mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          mode: options after positional arguments mode
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      val = OPTIONS_AFTER_POS_ARG.get_enum_value(mode)
                                                                                                                                                                                                                                      self.setOptionsAfterPositionalArgumentsMode(val)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_single_dash_word_option_mode(mode: SingleDashWordStr)

                                                                                                                                                                                                                                  Set the single dash word option mode.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  mode SingleDashWordStr

                                                                                                                                                                                                                                  single dash word option mode

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/commandlineparser.py
                                                                                                                                                                                                                                  def set_single_dash_word_option_mode(self, mode: SingleDashWordStr):
                                                                                                                                                                                                                                      """Set the single dash word option mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          mode: single dash word option mode
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setSingleDashWordOptionMode(SINGLE_DASH_WORD.get_enum_value(mode))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  ConcatenateTablesProxyModel

                                                                                                                                                                                                                                  Bases: AbstractItemModelMixin, QConcatenateTablesProxyModel

                                                                                                                                                                                                                                  Proxies multiple source models, concatenating their rows.

                                                                                                                                                                                                                                  Source code in prettyqt/core/concatenatetablesproxymodel.py
                                                                                                                                                                                                                                  class ConcatenateTablesProxyModel(
                                                                                                                                                                                                                                      core.AbstractItemModelMixin, core.QConcatenateTablesProxyModel
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Proxies multiple source models, concatenating their rows."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      ID = "concatenate"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def parent(self, *args):
                                                                                                                                                                                                                                          # workaround: PyQt6 QConcatenateTablesProxyModel.parent() missing
                                                                                                                                                                                                                                          if not args and qt.API == "pyqt6":
                                                                                                                                                                                                                                              return core.QAbstractItemModel.parent(self)
                                                                                                                                                                                                                                          return super().parent(*args)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  ContactsPermission

                                                                                                                                                                                                                                  Bases: QContactsPermission

                                                                                                                                                                                                                                  Access the user's contacts.

                                                                                                                                                                                                                                  Source code in prettyqt/core/contactspermission.py
                                                                                                                                                                                                                                  class ContactsPermission(QtCore.QContactsPermission):
                                                                                                                                                                                                                                      """Access the user's contacts."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_access_mode(
                                                                                                                                                                                                                                          self, mode: AccessModeStr | QtCore.QContactsPermission.AccessMode
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Set the contacts access mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              mode: access mode to use
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setAccessMode(ACCESS_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_access_mode(self) -> AccessModeStr:
                                                                                                                                                                                                                                          """Return current contacts access mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              access mode
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return ACCESS_MODE.inverse[self.accessMode()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_access_mode() -> AccessModeStr

                                                                                                                                                                                                                                  Return current contacts access mode.

                                                                                                                                                                                                                                  Source code in prettyqt/core/contactspermission.py
                                                                                                                                                                                                                                  def get_access_mode(self) -> AccessModeStr:
                                                                                                                                                                                                                                      """Return current contacts access mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          access mode
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return ACCESS_MODE.inverse[self.accessMode()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_access_mode(mode: AccessModeStr | QtCore.QContactsPermission.AccessMode)

                                                                                                                                                                                                                                  Set the contacts access mode.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  mode AccessModeStr | AccessMode

                                                                                                                                                                                                                                  access mode to use

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/contactspermission.py
                                                                                                                                                                                                                                  def set_access_mode(
                                                                                                                                                                                                                                      self, mode: AccessModeStr | QtCore.QContactsPermission.AccessMode
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Set the contacts access mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          mode: access mode to use
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setAccessMode(ACCESS_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  CoreApplication

                                                                                                                                                                                                                                  Bases: CoreApplicationMixin, QCoreApplication

                                                                                                                                                                                                                                  Event loop for Qt applications without UI.

                                                                                                                                                                                                                                  Source code in prettyqt/core/coreapplication.py
                                                                                                                                                                                                                                  class CoreApplication(CoreApplicationMixin, core.QCoreApplication):
                                                                                                                                                                                                                                      """Event loop for Qt applications without UI."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  CoreApplicationMixin

                                                                                                                                                                                                                                  Bases: ObjectMixin, _CoreApplicationBase

                                                                                                                                                                                                                                  Source code in prettyqt/core/coreapplication.py
                                                                                                                                                                                                                                  class CoreApplicationMixin(core.ObjectMixin, _CoreApplicationBase):
                                                                                                                                                                                                                                      translators: ClassVar[dict[str, core.Translator]] = {}
                                                                                                                                                                                                                                      _notify_hook: ClassVar[
                                                                                                                                                                                                                                          Callable[[Any, Any, Callable[[Any, Any], bool]], bool] | None
                                                                                                                                                                                                                                      ] = None
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def notify(self, receiver: core.QObject, event: core.QEvent) -> bool:
                                                                                                                                                                                                                                          hook = self._notify_hook
                                                                                                                                                                                                                                          if hook is None:
                                                                                                                                                                                                                                              return super().notify(receiver, event)
                                                                                                                                                                                                                                          return hook(receiver, event, super().notify)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def call_on_exit(cls, func: Callable):
                                                                                                                                                                                                                                          instance = cls.instance()
                                                                                                                                                                                                                                          if instance is None:
                                                                                                                                                                                                                                              msg = "No QApplication running"
                                                                                                                                                                                                                                              raise RuntimeError(msg)
                                                                                                                                                                                                                                          instance.aboutToQuit.connect(func)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_application_file_path(cls) -> pathlib.Path:
                                                                                                                                                                                                                                          return pathlib.Path(cls.applicationFilePath())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_application_dir_path(cls) -> pathlib.Path:
                                                                                                                                                                                                                                          return pathlib.Path(cls.applicationDirPath())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def add_library_path(cls, path: datatypes.PathType):
                                                                                                                                                                                                                                          cls.addLibraryPath(os.fspath(path))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_library_paths(cls) -> list[pathlib.Path]:
                                                                                                                                                                                                                                          return [pathlib.Path(i) for i in cls.libraryPaths()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_application_name(self, name: str):
                                                                                                                                                                                                                                          if os.name == "nt" and name and not getattr(sys, "frozen", False):
                                                                                                                                                                                                                                              import ctypes
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                              ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(name)
                                                                                                                                                                                                                                          self.setApplicationName(name)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_metadata(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          app_name: str | None = None,
                                                                                                                                                                                                                                          app_version: datatypes.SemanticVersionType | None = None,
                                                                                                                                                                                                                                          org_name: str | None = None,
                                                                                                                                                                                                                                          org_domain: str | None = None,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          if app_name is not None:
                                                                                                                                                                                                                                              self.setApplicationName(app_name)
                                                                                                                                                                                                                                          match app_version:
                                                                                                                                                                                                                                              case None:
                                                                                                                                                                                                                                                  pass
                                                                                                                                                                                                                                              case core.QVersionNumber():
                                                                                                                                                                                                                                                  app_version = app_version.toString()
                                                                                                                                                                                                                                                  self.setApplicationVersion(app_version)
                                                                                                                                                                                                                                              case tuple():
                                                                                                                                                                                                                                                  app_version = ".".join(str(i) for i in app_version)
                                                                                                                                                                                                                                                  self.setApplicationVersion(app_version)
                                                                                                                                                                                                                                              case str():
                                                                                                                                                                                                                                                  self.setApplicationVersion(app_version)
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  raise TypeError(app_version)
                                                                                                                                                                                                                                          if org_name is not None:
                                                                                                                                                                                                                                              self.setOrganizationName(org_name)
                                                                                                                                                                                                                                          if org_domain is not None:
                                                                                                                                                                                                                                              self.setOrganizationDomain(org_domain)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def load_language_file(cls, file: datatypes.PathType) -> core.Translator:
                                                                                                                                                                                                                                          translator = core.Translator()
                                                                                                                                                                                                                                          translator.load_file(file)
                                                                                                                                                                                                                                          cls.installTranslator(translator)
                                                                                                                                                                                                                                          cls.translators[str(file)] = translator
                                                                                                                                                                                                                                          return translator
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def load_language(cls, language: str) -> core.Translator:
                                                                                                                                                                                                                                          translator = core.Translator.for_language(language)
                                                                                                                                                                                                                                          cls.installTranslator(translator)
                                                                                                                                                                                                                                          cls.translators[language] = translator
                                                                                                                                                                                                                                          return translator
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def post_event(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          obj: core.QObject,
                                                                                                                                                                                                                                          event: core.QEvent,
                                                                                                                                                                                                                                          priority: int | constants.EventPriorityStr = "normal",
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          match priority:
                                                                                                                                                                                                                                              case int():
                                                                                                                                                                                                                                                  prio = priority
                                                                                                                                                                                                                                              case str():
                                                                                                                                                                                                                                                  prio = constants.EVENT_PRIORITY[priority]
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  raise TypeError(priority)
                                                                                                                                                                                                                                          return self.postEvent(obj, event, prio)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def in_main_thread(self) -> bool:
                                                                                                                                                                                                                                          """Check if we are in the thread in which QApplication object was created.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              True if we are in the main thread, False otherwise.
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return self.thread() == core.Thread.currentThread()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def main_loop(self) -> int:
                                                                                                                                                                                                                                          return self.exec()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @staticmethod
                                                                                                                                                                                                                                      def run_async(
                                                                                                                                                                                                                                          coro: Coroutine[Any, Any, Any] | None = None,
                                                                                                                                                                                                                                          keep_running: bool = True,
                                                                                                                                                                                                                                          quit_qapp: bool = True,
                                                                                                                                                                                                                                          *,
                                                                                                                                                                                                                                          backend: aio.AsyncBackendStr = "auto",
                                                                                                                                                                                                                                          handle_sigint: bool = False,
                                                                                                                                                                                                                                          debug: bool | None = None,
                                                                                                                                                                                                                                      ) -> int:
                                                                                                                                                                                                                                          from prettyqt.core import aio as _aio
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          return _aio.run_async(
                                                                                                                                                                                                                                              coro=coro,
                                                                                                                                                                                                                                              backend=backend,
                                                                                                                                                                                                                                              keep_running=keep_running,
                                                                                                                                                                                                                                              quit_qapp=quit_qapp,
                                                                                                                                                                                                                                              handle_sigint=handle_sigint,
                                                                                                                                                                                                                                              debug=debug,
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @staticmethod
                                                                                                                                                                                                                                      def enable_async_slots(*, on_error: Callable[[BaseException], Any] | None = None):
                                                                                                                                                                                                                                          """Allow connecting `async def` functions directly to Qt signals."""
                                                                                                                                                                                                                                          from prettyqt.core import aio as _aio
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          return _aio.enable_async_slots(on_error=on_error)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @staticmethod
                                                                                                                                                                                                                                      def disable_async_slots() -> None:
                                                                                                                                                                                                                                          """Disable direct `async def` signal connections."""
                                                                                                                                                                                                                                          from prettyqt.core import aio as _aio
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          _aio.disable_async_slots()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @staticmethod
                                                                                                                                                                                                                                      def restart():
                                                                                                                                                                                                                                          os.execl(sys.executable, sys.executable, *sys.argv)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  disable_async_slots() -> None staticmethod

                                                                                                                                                                                                                                  Disable direct async def signal connections.

                                                                                                                                                                                                                                  Source code in prettyqt/core/coreapplication.py
                                                                                                                                                                                                                                  @staticmethod
                                                                                                                                                                                                                                  def disable_async_slots() -> None:
                                                                                                                                                                                                                                      """Disable direct `async def` signal connections."""
                                                                                                                                                                                                                                      from prettyqt.core import aio as _aio
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      _aio.disable_async_slots()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  enable_async_slots(*, on_error: Callable[[BaseException], Any] | None = None) staticmethod

                                                                                                                                                                                                                                  Allow connecting async def functions directly to Qt signals.

                                                                                                                                                                                                                                  Source code in prettyqt/core/coreapplication.py
                                                                                                                                                                                                                                  @staticmethod
                                                                                                                                                                                                                                  def enable_async_slots(*, on_error: Callable[[BaseException], Any] | None = None):
                                                                                                                                                                                                                                      """Allow connecting `async def` functions directly to Qt signals."""
                                                                                                                                                                                                                                      from prettyqt.core import aio as _aio
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      return _aio.enable_async_slots(on_error=on_error)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  in_main_thread() -> bool

                                                                                                                                                                                                                                  Check if we are in the thread in which QApplication object was created.

                                                                                                                                                                                                                                  Source code in prettyqt/core/coreapplication.py
                                                                                                                                                                                                                                  def in_main_thread(self) -> bool:
                                                                                                                                                                                                                                      """Check if we are in the thread in which QApplication object was created.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          True if we are in the main thread, False otherwise.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return self.thread() == core.Thread.currentThread()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  CryptographicHash

                                                                                                                                                                                                                                  Bases: QCryptographicHash

                                                                                                                                                                                                                                  Way to generate cryptographic hashes.

                                                                                                                                                                                                                                  Source code in prettyqt/core/cryptographichash.py
                                                                                                                                                                                                                                  class CryptographicHash(QtCore.QCryptographicHash):
                                                                                                                                                                                                                                      """Way to generate cryptographic hashes."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, method: QtCore.QCryptographicHash.Algorithm | AlgorithmStr):
                                                                                                                                                                                                                                          if isinstance(method, QtCore.QCryptographicHash.Algorithm):
                                                                                                                                                                                                                                              arg = method
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              arg = ALGORITHM[method]
                                                                                                                                                                                                                                          super().__init__(arg)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      # def __str__(self):
                                                                                                                                                                                                                                      #     return bytes(self.result()).decode()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bytes__(self):
                                                                                                                                                                                                                                          return self.get_result()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_result(self) -> bytes:
                                                                                                                                                                                                                                          return bytes(self.result().data())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @staticmethod
                                                                                                                                                                                                                                      def get_hash_length(
                                                                                                                                                                                                                                          method: AlgorithmStr | QtCore.QCryptographicHash.Algorithm,
                                                                                                                                                                                                                                      ) -> int:
                                                                                                                                                                                                                                          return CryptographicHash.hashLength(ALGORITHM.get_enum_value(method))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  DataStream

                                                                                                                                                                                                                                  Bases: QDataStream

                                                                                                                                                                                                                                  Serialization of binary data to a QIODevice.

                                                                                                                                                                                                                                  Source code in prettyqt/core/datastream.py
                                                                                                                                                                                                                                  class DataStream(QtCore.QDataStream):
                                                                                                                                                                                                                                      """Serialization of binary data to a QIODevice."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_byte_order(self, order: ByteOrderStr | QtCore.QDataStream.ByteOrder):
                                                                                                                                                                                                                                          """Set byte order.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              order: byte order to use
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setByteOrder(BYTE_ORDER.get_enum_value(order))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_byte_order(self) -> ByteOrderStr:
                                                                                                                                                                                                                                          """Return byte order.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              byte order
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return BYTE_ORDER.inverse[self.byteOrder()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_status(self, status: StatusStr):
                                                                                                                                                                                                                                          """Set status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              status: status to use
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setStatus(STATUS.get_enum_value(status))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_status(self) -> StatusStr:
                                                                                                                                                                                                                                          """Return status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              status
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return STATUS.inverse[self.status()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_floating_point_precision(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          precision: FloatingPointPrecisionStr | QtCore.QDataStream.FloatingPointPrecision,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Set floating point precision.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              precision: floating point precision
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setFloatingPointPrecision(FLOATING_POINT_PRECISION.get_enum_value(precision))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_floating_point_precision(self) -> FloatingPointPrecisionStr:
                                                                                                                                                                                                                                          """Return floating point precision.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              floating point precision
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return FLOATING_POINT_PRECISION.inverse[self.floatingPointPrecision()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def create_bytearray(cls, data: datatypes.QtSerializableType) -> QtCore.QByteArray:
                                                                                                                                                                                                                                          ba = QtCore.QByteArray()
                                                                                                                                                                                                                                          stream = cls(ba, QtCore.QIODeviceBase.OpenModeFlag.WriteOnly)
                                                                                                                                                                                                                                          stream << data
                                                                                                                                                                                                                                          return ba
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def write_bytearray(
                                                                                                                                                                                                                                          cls, ba: datatypes.ByteArrayType, write_to: datatypes.QtSerializableType
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          ba = datatypes.to_bytearray(ba)
                                                                                                                                                                                                                                          stream = cls(ba, QtCore.QIODeviceBase.OpenModeFlag.ReadOnly)
                                                                                                                                                                                                                                          stream >> write_to
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def copy_data(
                                                                                                                                                                                                                                          cls, source: datatypes.QtSerializableType, dest: datatypes.QtSerializableType
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          ba = cls.create_bytearray(source)
                                                                                                                                                                                                                                          cls.write_bytearray(ba, dest)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_byte_order() -> ByteOrderStr

                                                                                                                                                                                                                                  Return byte order.

                                                                                                                                                                                                                                  Source code in prettyqt/core/datastream.py
                                                                                                                                                                                                                                  def get_byte_order(self) -> ByteOrderStr:
                                                                                                                                                                                                                                      """Return byte order.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          byte order
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return BYTE_ORDER.inverse[self.byteOrder()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_floating_point_precision() -> FloatingPointPrecisionStr

                                                                                                                                                                                                                                  Return floating point precision.

                                                                                                                                                                                                                                  Source code in prettyqt/core/datastream.py
                                                                                                                                                                                                                                  def get_floating_point_precision(self) -> FloatingPointPrecisionStr:
                                                                                                                                                                                                                                      """Return floating point precision.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          floating point precision
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return FLOATING_POINT_PRECISION.inverse[self.floatingPointPrecision()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_status() -> StatusStr

                                                                                                                                                                                                                                  Return status.

                                                                                                                                                                                                                                  Source code in prettyqt/core/datastream.py
                                                                                                                                                                                                                                  def get_status(self) -> StatusStr:
                                                                                                                                                                                                                                      """Return status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          status
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return STATUS.inverse[self.status()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_byte_order(order: ByteOrderStr | QtCore.QDataStream.ByteOrder)

                                                                                                                                                                                                                                  Set byte order.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  order ByteOrderStr | ByteOrder

                                                                                                                                                                                                                                  byte order to use

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/datastream.py
                                                                                                                                                                                                                                  def set_byte_order(self, order: ByteOrderStr | QtCore.QDataStream.ByteOrder):
                                                                                                                                                                                                                                      """Set byte order.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          order: byte order to use
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setByteOrder(BYTE_ORDER.get_enum_value(order))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_floating_point_precision(precision: FloatingPointPrecisionStr | QtCore.QDataStream.FloatingPointPrecision)

                                                                                                                                                                                                                                  Set floating point precision.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  precision FloatingPointPrecisionStr | FloatingPointPrecision

                                                                                                                                                                                                                                  floating point precision

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/datastream.py
                                                                                                                                                                                                                                  def set_floating_point_precision(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      precision: FloatingPointPrecisionStr | QtCore.QDataStream.FloatingPointPrecision,
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Set floating point precision.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          precision: floating point precision
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setFloatingPointPrecision(FLOATING_POINT_PRECISION.get_enum_value(precision))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_status(status: StatusStr)

                                                                                                                                                                                                                                  Set status.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  status StatusStr

                                                                                                                                                                                                                                  status to use

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/datastream.py
                                                                                                                                                                                                                                  def set_status(self, status: StatusStr):
                                                                                                                                                                                                                                      """Set status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          status: status to use
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setStatus(STATUS.get_enum_value(status))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Date

                                                                                                                                                                                                                                  Bases: QDate

                                                                                                                                                                                                                                  Date functions.

                                                                                                                                                                                                                                  Source code in prettyqt/core/date.py
                                                                                                                                                                                                                                  class Date(QtCore.QDate):
                                                                                                                                                                                                                                      """Date functions."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          template = super().__repr__().split("(")[1]
                                                                                                                                                                                                                                          return f"{type(self).__name__}({template}"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return self.toString("yyyy-MM-dd")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __format__(self, format_spec: str):
                                                                                                                                                                                                                                          return self.toString(format_spec)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _year(self) -> int:
                                                                                                                                                                                                                                          return self.year()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _month(self) -> int:
                                                                                                                                                                                                                                          return self.month()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _day(self) -> int:
                                                                                                                                                                                                                                          return self.day()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      __match_args__ = ("_year", "_month", "_day")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.year(), self.month(), self.day())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def add_days(self, days: int) -> Self:
                                                                                                                                                                                                                                          return type(self)(self.addDays(days))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def add_months(self, months: int, calendar: QtCore.QCalendar | None = None) -> Self:
                                                                                                                                                                                                                                          if calendar:
                                                                                                                                                                                                                                              return type(self)(self.addMonths(months, calendar))
                                                                                                                                                                                                                                          return type(self)(self.addMonths(months))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def add_years(self, years: int, calendar: QtCore.QCalendar | None = None) -> Self:
                                                                                                                                                                                                                                          if calendar:
                                                                                                                                                                                                                                              return type(self)(self.addYears(years, calendar))
                                                                                                                                                                                                                                          return type(self)(self.addYears(years))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_current_date(cls) -> Self:
                                                                                                                                                                                                                                          return cls(cls.currentDate())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def from_string(cls, text: str, date_format: constants.DateFormatStr | str) -> Self:
                                                                                                                                                                                                                                          fmt = (
                                                                                                                                                                                                                                              constants.DATE_FORMAT[date_format]  # noqa: SIM401
                                                                                                                                                                                                                                              if date_format in constants.DATE_FORMAT
                                                                                                                                                                                                                                              else date_format
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                          return cls(cls.fromString(text, fmt))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def replace(
                                                                                                                                                                                                                                          self, year: int | None = None, month: int | None = None, day: int | None = None
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          self.setDate(
                                                                                                                                                                                                                                              year if year is not None else self.year(),
                                                                                                                                                                                                                                              month if month is not None else self.month(),
                                                                                                                                                                                                                                              day if day is not None else self.day(),
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  DateTime

                                                                                                                                                                                                                                  Bases: QDateTime

                                                                                                                                                                                                                                  DateTime funcitons.

                                                                                                                                                                                                                                  Source code in prettyqt/core/_datetime.py
                                                                                                                                                                                                                                  class DateTime(core.QDateTime):
                                                                                                                                                                                                                                      """DateTime funcitons."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          super_repr = super().__repr__()
                                                                                                                                                                                                                                          template = str(super_repr).split("(")[1]
                                                                                                                                                                                                                                          return f"{type(self).__name__}({template}"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return self.toString("yyyy-MM-dd hh:mm:ss.zzzzzz")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.date(), self.time(), self.get_timezone())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __format__(self, format_spec: str):
                                                                                                                                                                                                                                          if format_spec in constants.DATE_FORMAT:
                                                                                                                                                                                                                                              return self.toString(constants.DATE_FORMAT[format_spec])
                                                                                                                                                                                                                                          return self.toString(format_spec)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def from_seconds(cls, seconds: float) -> Self:
                                                                                                                                                                                                                                          new = cls()
                                                                                                                                                                                                                                          new.setMSecsSinceEpoch(int(seconds * 1000))
                                                                                                                                                                                                                                          return new
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_value(self) -> dt.datetime:
                                                                                                                                                                                                                                          return self.toPython()  # type: ignore
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_date(self) -> core.Date:
                                                                                                                                                                                                                                          return core.Date(self.date())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_time(self) -> core.Time:
                                                                                                                                                                                                                                          return core.Time(self.time())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_timezone(self) -> core.TimeZone:
                                                                                                                                                                                                                                          return core.TimeZone(self.timeZone())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_timezone(self, zone: str | core.QTimeZone):
                                                                                                                                                                                                                                          if isinstance(zone, str):
                                                                                                                                                                                                                                              self.setTimeZone(core.TimeZone(zone))
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              self.setTimeZone(zone)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_time_spec(self, spec: constants.TimeSpecStr | constants.TimeSpec):
                                                                                                                                                                                                                                          """Set the time specification.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              spec: time specification to use
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          time_spec = constants.TIME_SPEC.get_enum_value(spec)
                                                                                                                                                                                                                                          if time_spec == constants.TimeSpec.UTC:
                                                                                                                                                                                                                                              self.setTimeZone(core.QTimeZone(core.QTimeZone.Initialization.UTC))
                                                                                                                                                                                                                                          elif time_spec == constants.TimeSpec.LocalTime:
                                                                                                                                                                                                                                              self.setTimeZone(core.QTimeZone(core.QTimeZone.Initialization.LocalTime))
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              self.setTimeSpec(time_spec)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_time_spec(self) -> constants.TimeSpecStr:
                                                                                                                                                                                                                                          """Return current time specification.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              time specification
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return constants.TIME_SPEC.inverse[self.timeSpec()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def to_format(self, fmt: constants.DateFormatStr):
                                                                                                                                                                                                                                          return self.toString(constants.DATE_FORMAT[fmt])
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_time_spec() -> constants.TimeSpecStr

                                                                                                                                                                                                                                  Return current time specification.

                                                                                                                                                                                                                                  Source code in prettyqt/core/_datetime.py
                                                                                                                                                                                                                                  def get_time_spec(self) -> constants.TimeSpecStr:
                                                                                                                                                                                                                                      """Return current time specification.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          time specification
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return constants.TIME_SPEC.inverse[self.timeSpec()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_time_spec(spec: constants.TimeSpecStr | constants.TimeSpec)

                                                                                                                                                                                                                                  Set the time specification.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  spec TimeSpecStr | TimeSpec

                                                                                                                                                                                                                                  time specification to use

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/_datetime.py
                                                                                                                                                                                                                                  def set_time_spec(self, spec: constants.TimeSpecStr | constants.TimeSpec):
                                                                                                                                                                                                                                      """Set the time specification.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          spec: time specification to use
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      time_spec = constants.TIME_SPEC.get_enum_value(spec)
                                                                                                                                                                                                                                      if time_spec == constants.TimeSpec.UTC:
                                                                                                                                                                                                                                          self.setTimeZone(core.QTimeZone(core.QTimeZone.Initialization.UTC))
                                                                                                                                                                                                                                      elif time_spec == constants.TimeSpec.LocalTime:
                                                                                                                                                                                                                                          self.setTimeZone(core.QTimeZone(core.QTimeZone.Initialization.LocalTime))
                                                                                                                                                                                                                                      else:
                                                                                                                                                                                                                                          self.setTimeSpec(time_spec)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  DeadlineTimer

                                                                                                                                                                                                                                  Bases: QDeadlineTimer

                                                                                                                                                                                                                                  Marks a deadline in the future.

                                                                                                                                                                                                                                  Source code in prettyqt/core/deadlinetimer.py
                                                                                                                                                                                                                                  class DeadlineTimer(QtCore.QDeadlineTimer):
                                                                                                                                                                                                                                      """Marks a deadline in the future."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_type(self, typ: constants.TimerTypeStr | constants.TimerType):
                                                                                                                                                                                                                                          """Set the timer type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              typ: timer type
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setTimerType(constants.TIMER_TYPE.get_enum_value(typ))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_type(self) -> constants.TimerTypeStr:
                                                                                                                                                                                                                                          """Return current timer type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              timer type
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return constants.TIMER_TYPE.inverse[self.timerType()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_type() -> constants.TimerTypeStr

                                                                                                                                                                                                                                  Return current timer type.

                                                                                                                                                                                                                                  Source code in prettyqt/core/deadlinetimer.py
                                                                                                                                                                                                                                  def get_type(self) -> constants.TimerTypeStr:
                                                                                                                                                                                                                                      """Return current timer type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          timer type
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return constants.TIMER_TYPE.inverse[self.timerType()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_type(typ: constants.TimerTypeStr | constants.TimerType)

                                                                                                                                                                                                                                  Set the timer type.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  typ TimerTypeStr | TimerType

                                                                                                                                                                                                                                  timer type

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/deadlinetimer.py
                                                                                                                                                                                                                                  def set_type(self, typ: constants.TimerTypeStr | constants.TimerType):
                                                                                                                                                                                                                                      """Set the timer type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          typ: timer type
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setTimerType(constants.TIMER_TYPE.get_enum_value(typ))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Dir

                                                                                                                                                                                                                                  Bases: QDir

                                                                                                                                                                                                                                  Access to directory structures and their contents.

                                                                                                                                                                                                                                  Source code in prettyqt/core/dir.py
                                                                                                                                                                                                                                  class Dir(core.QDir):
                                                                                                                                                                                                                                      """Access to directory structures and their contents."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getattr__(self, attr: str):
                                                                                                                                                                                                                                          return getattr(self.to_path(), attr)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.absolutePath())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return self.absolutePath()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.absolutePath(),)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __truediv__(self, other: datatypes.PathType) -> pathlib.Path:
                                                                                                                                                                                                                                          return self.to_path() / os.fspath(other)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __fspath__(self) -> str:
                                                                                                                                                                                                                                          return self.absolutePath()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return self.exists()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __abs__(self) -> str:
                                                                                                                                                                                                                                          return self.absolutePath()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _absolutePath(self) -> str:
                                                                                                                                                                                                                                          return self.absolutePath()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      __match_args__ = ("_absolutePath",)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def to_path(self) -> pathlib.Path:
                                                                                                                                                                                                                                          return pathlib.Path(self.absolutePath())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_filter(self, *filters: FilterStr):
                                                                                                                                                                                                                                          flags = FILTERS.merge_flags(filters)
                                                                                                                                                                                                                                          self.setFilter(flags)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_filter(self) -> list[FilterStr]:
                                                                                                                                                                                                                                          return FILTERS.get_list(self.filter())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_entry_info_list(
                                                                                                                                                                                                                                          self, sort_mode: SortFlagStr = "no_sort", filters: FilterStr = "none"
                                                                                                                                                                                                                                      ) -> list[core.FileInfo]:
                                                                                                                                                                                                                                          return [
                                                                                                                                                                                                                                              core.FileInfo(i)
                                                                                                                                                                                                                                              for i in self.entryInfoList(
                                                                                                                                                                                                                                                  sort=SORT_FLAG[sort_mode],
                                                                                                                                                                                                                                                  filters=self.Filter.AllEntries | FILTERS[filters],
                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_entry_list(
                                                                                                                                                                                                                                          self, sort_mode: SortFlagStr = "no_sort", filters: FilterStr = "none"
                                                                                                                                                                                                                                      ) -> list[pathlib.Path]:
                                                                                                                                                                                                                                          return [
                                                                                                                                                                                                                                              pathlib.Path(i)
                                                                                                                                                                                                                                              for i in self.entryList(sort=SORT_FLAG[sort_mode], filters=FILTERS[filters])
                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_current(cls) -> Self:
                                                                                                                                                                                                                                          return cls(cls.current())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_home(cls) -> Self:
                                                                                                                                                                                                                                          return cls(cls.home())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_current_path(cls) -> pathlib.Path:
                                                                                                                                                                                                                                          return pathlib.Path(cls.currentPath())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_home_path(cls) -> pathlib.Path:
                                                                                                                                                                                                                                          return pathlib.Path(cls.homePath())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_temp_path(cls) -> pathlib.Path:
                                                                                                                                                                                                                                          return pathlib.Path(cls.tempPath())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_drives(cls) -> list[core.FileInfo]:
                                                                                                                                                                                                                                          return [core.FileInfo(i) for i in cls.drives()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def add_search_path(cls, prefix: str, path: datatypes.PathType):
                                                                                                                                                                                                                                          cls.addSearchPath(prefix, os.fspath(path))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def set_search_paths(cls, prefix: str, paths: Iterable[datatypes.PathType]):
                                                                                                                                                                                                                                          cls.setSearchPaths(prefix, [os.fspath(p) for p in paths])
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  DirIterator

                                                                                                                                                                                                                                  Bases: QDirIterator

                                                                                                                                                                                                                                  Iterator for directory entrylists.

                                                                                                                                                                                                                                  Source code in prettyqt/core/diriterator.py
                                                                                                                                                                                                                                  class DirIterator(core.QDirIterator):
                                                                                                                                                                                                                                      """Iterator for directory entrylists."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __iter__(self):
                                                                                                                                                                                                                                          return self
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __next__(self):
                                                                                                                                                                                                                                          if self.hasNext():
                                                                                                                                                                                                                                              return self.next()
                                                                                                                                                                                                                                          raise StopIteration
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_file_path(self) -> pathlib.Path:
                                                                                                                                                                                                                                          return pathlib.Path(self.filePath())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_file_info(self) -> core.FileInfo:
                                                                                                                                                                                                                                          return core.FileInfo(self.fileInfo())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  EasingCurve

                                                                                                                                                                                                                                  Bases: SerializeMixin, QEasingCurve

                                                                                                                                                                                                                                  Easing curves for controlling animation.

                                                                                                                                                                                                                                  Source code in prettyqt/core/easingcurve.py
                                                                                                                                                                                                                                  class EasingCurve(serializemixin.SerializeMixin, QtCore.QEasingCurve):
                                                                                                                                                                                                                                      """Easing curves for controlling animation."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, other_or_type: TypeStr | int | QtCore.QEasingCurve = "linear"):
                                                                                                                                                                                                                                          match other_or_type:
                                                                                                                                                                                                                                              case str():
                                                                                                                                                                                                                                                  super().__init__(TYPE[other_or_type])
                                                                                                                                                                                                                                              case int():
                                                                                                                                                                                                                                                  super().__init__(QtCore.QEasingCurve.Type(other_or_type))
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  super().__init__(other_or_type)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getitem__(self, value: float) -> float:
                                                                                                                                                                                                                                          return self.valueForProgress(value)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.get_type())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_custom_type(self, method: CurveMethod):
                                                                                                                                                                                                                                          self.setCustomType(method)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_custom_type(self) -> CurveMethod:
                                                                                                                                                                                                                                          return self.customType()  # type: ignore
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_type(self, typ: TypeStr | QtCore.QEasingCurve.Type):
                                                                                                                                                                                                                                          """Set easing curve type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              typ: easing curve type
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setType(TYPE.get_enum_value(typ))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_type(self) -> TypeStr:
                                                                                                                                                                                                                                          """Get the current easing curve type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              easing curve type
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return TYPE.inverse[self.type()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_type() -> TypeStr

                                                                                                                                                                                                                                  Get the current easing curve type.

                                                                                                                                                                                                                                  Source code in prettyqt/core/easingcurve.py
                                                                                                                                                                                                                                  def get_type(self) -> TypeStr:
                                                                                                                                                                                                                                      """Get the current easing curve type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          easing curve type
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return TYPE.inverse[self.type()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_type(typ: TypeStr | QtCore.QEasingCurve.Type)

                                                                                                                                                                                                                                  Set easing curve type.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  typ TypeStr | Type

                                                                                                                                                                                                                                  easing curve type

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/easingcurve.py
                                                                                                                                                                                                                                  def set_type(self, typ: TypeStr | QtCore.QEasingCurve.Type):
                                                                                                                                                                                                                                      """Set easing curve type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          typ: easing curve type
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setType(TYPE.get_enum_value(typ))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  ElapsedTimer

                                                                                                                                                                                                                                  Bases: QElapsedTimer

                                                                                                                                                                                                                                  Fast way to calculate elapsed times.

                                                                                                                                                                                                                                  Source code in prettyqt/core/elapsedtimer.py
                                                                                                                                                                                                                                  class ElapsedTimer(QtCore.QElapsedTimer):
                                                                                                                                                                                                                                      """Fast way to calculate elapsed times."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return self.isValid()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_clock_type(self) -> ClockTypeStr:
                                                                                                                                                                                                                                          """Return current clock type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              clock type
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return CLOCK_TYPE.inverse[self.clockType()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_clock_type() -> ClockTypeStr

                                                                                                                                                                                                                                  Return current clock type.

                                                                                                                                                                                                                                  Source code in prettyqt/core/elapsedtimer.py
                                                                                                                                                                                                                                  def get_clock_type(self) -> ClockTypeStr:
                                                                                                                                                                                                                                      """Return current clock type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          clock type
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return CLOCK_TYPE.inverse[self.clockType()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Event

                                                                                                                                                                                                                                  Bases: QEvent

                                                                                                                                                                                                                                  The base class of all event classes. Event objects contain event parameters.

                                                                                                                                                                                                                                  Source code in prettyqt/core/event.py
                                                                                                                                                                                                                                  class Event(QtCore.QEvent):
                                                                                                                                                                                                                                      """The base class of all event classes. Event objects contain event parameters."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.type())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  EventLoop

                                                                                                                                                                                                                                  Bases: ObjectMixin, QEventLoop

                                                                                                                                                                                                                                  Means of entering and leaving an event loop.

                                                                                                                                                                                                                                  Source code in prettyqt/core/eventloop.py
                                                                                                                                                                                                                                  class EventLoop(core.ObjectMixin, core.QEventLoop):
                                                                                                                                                                                                                                      """Means of entering and leaving an event loop."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, *args, **kwargs) -> None:
                                                                                                                                                                                                                                          super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                          self._executing = False
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def execute(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          user_input: bool = True,
                                                                                                                                                                                                                                          socket_notifiers: bool = True,
                                                                                                                                                                                                                                          wait_for_more: bool = False,
                                                                                                                                                                                                                                      ) -> int:
                                                                                                                                                                                                                                          if self._executing:
                                                                                                                                                                                                                                              msg = "Eventloop is already running!"
                                                                                                                                                                                                                                              raise AssertionError(msg)
                                                                                                                                                                                                                                          self._executing = True
                                                                                                                                                                                                                                          flags = core.QEventLoop.ProcessEventsFlag
                                                                                                                                                                                                                                          flag = flags.AllEvents
                                                                                                                                                                                                                                          if not user_input:
                                                                                                                                                                                                                                              flag |= flags.ExcludeUserInputEvents
                                                                                                                                                                                                                                          if not socket_notifiers:
                                                                                                                                                                                                                                              flag |= flags.ExcludeSocketNotifiers
                                                                                                                                                                                                                                          if wait_for_more:
                                                                                                                                                                                                                                              flag |= flags.WaitForMoreEvents
                                                                                                                                                                                                                                          status = self.exec(flag)
                                                                                                                                                                                                                                          self._executing = False
                                                                                                                                                                                                                                          return status
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  File

                                                                                                                                                                                                                                  Bases: FileMixin, QFile

                                                                                                                                                                                                                                  Interface for reading from and writing to files.

                                                                                                                                                                                                                                  Source code in prettyqt/core/file.py
                                                                                                                                                                                                                                  class File(FileMixin, core.QFile):
                                                                                                                                                                                                                                      """Interface for reading from and writing to files."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  FileDeviceMixin

                                                                                                                                                                                                                                  Bases: IODeviceMixin, _FileDeviceBase

                                                                                                                                                                                                                                  Interface for reading from and writing to open files.

                                                                                                                                                                                                                                  Source code in prettyqt/core/filedevice.py
                                                                                                                                                                                                                                  class FileDeviceMixin(core.IODeviceMixin, _FileDeviceBase):
                                                                                                                                                                                                                                      """Interface for reading from and writing to open files."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.fileName())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return self.fileName()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      # def __fspath__(self) -> str:
                                                                                                                                                                                                                                      #     return self.fileName()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_permissions(self) -> list[PermissionStr]:
                                                                                                                                                                                                                                          return PERMISSIONS.get_list(self.permissions())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_file_time(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          file_time: datatypes.DateTimeType,
                                                                                                                                                                                                                                          typ: FileTimeStr | core.QFileDevice.FileTime,
                                                                                                                                                                                                                                      ) -> bool:
                                                                                                                                                                                                                                          """Set file time.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              file_time: file time to set
                                                                                                                                                                                                                                              typ: file time type
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          file_time = datatypes.to_datetime(file_time)
                                                                                                                                                                                                                                          return self.setFileTime(file_time, FILE_TIME.get_enum_value(typ))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_file_time(
                                                                                                                                                                                                                                          self, typ: FileTimeStr | core.QFileDevice.FileTime
                                                                                                                                                                                                                                      ) -> dt.datetime | None:
                                                                                                                                                                                                                                          """Return current file time.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              file time
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          if date := self.fileTime(FILE_TIME.get_enum_value(typ)):
                                                                                                                                                                                                                                              return date.toPython()  # type: ignore
                                                                                                                                                                                                                                          return None
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_error(self) -> FileErrorStr:
                                                                                                                                                                                                                                          """Return file error status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              file error status
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return FILE_ERROR.inverse[self.error()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def is_readable(self) -> bool:
                                                                                                                                                                                                                                          """Returns whether file has ReadUser permission flag."""
                                                                                                                                                                                                                                          return bool(self.permissions() & core.QFileDevice.Permission.ReadUser)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def is_writable(self) -> bool:
                                                                                                                                                                                                                                          """Returns whether file has WriteUser permission flag."""
                                                                                                                                                                                                                                          return bool(self.permissions() & core.QFileDevice.Permission.WriteUser)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def is_executable(self) -> bool:
                                                                                                                                                                                                                                          """Returns whether file has ExeUser permission flag."""
                                                                                                                                                                                                                                          return bool(self.permissions() & core.QFileDevice.Permission.ExeUser)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_error() -> FileErrorStr

                                                                                                                                                                                                                                  Return file error status.

                                                                                                                                                                                                                                  Source code in prettyqt/core/filedevice.py
                                                                                                                                                                                                                                  def get_error(self) -> FileErrorStr:
                                                                                                                                                                                                                                      """Return file error status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          file error status
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return FILE_ERROR.inverse[self.error()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_file_time(typ: FileTimeStr | core.QFileDevice.FileTime) -> dt.datetime | None

                                                                                                                                                                                                                                  Return current file time.

                                                                                                                                                                                                                                  Source code in prettyqt/core/filedevice.py
                                                                                                                                                                                                                                  def get_file_time(
                                                                                                                                                                                                                                      self, typ: FileTimeStr | core.QFileDevice.FileTime
                                                                                                                                                                                                                                  ) -> dt.datetime | None:
                                                                                                                                                                                                                                      """Return current file time.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          file time
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      if date := self.fileTime(FILE_TIME.get_enum_value(typ)):
                                                                                                                                                                                                                                          return date.toPython()  # type: ignore
                                                                                                                                                                                                                                      return None
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  is_executable() -> bool

                                                                                                                                                                                                                                  Returns whether file has ExeUser permission flag.

                                                                                                                                                                                                                                  Source code in prettyqt/core/filedevice.py
                                                                                                                                                                                                                                  def is_executable(self) -> bool:
                                                                                                                                                                                                                                      """Returns whether file has ExeUser permission flag."""
                                                                                                                                                                                                                                      return bool(self.permissions() & core.QFileDevice.Permission.ExeUser)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  is_readable() -> bool

                                                                                                                                                                                                                                  Returns whether file has ReadUser permission flag.

                                                                                                                                                                                                                                  Source code in prettyqt/core/filedevice.py
                                                                                                                                                                                                                                  def is_readable(self) -> bool:
                                                                                                                                                                                                                                      """Returns whether file has ReadUser permission flag."""
                                                                                                                                                                                                                                      return bool(self.permissions() & core.QFileDevice.Permission.ReadUser)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  is_writable() -> bool

                                                                                                                                                                                                                                  Returns whether file has WriteUser permission flag.

                                                                                                                                                                                                                                  Source code in prettyqt/core/filedevice.py
                                                                                                                                                                                                                                  def is_writable(self) -> bool:
                                                                                                                                                                                                                                      """Returns whether file has WriteUser permission flag."""
                                                                                                                                                                                                                                      return bool(self.permissions() & core.QFileDevice.Permission.WriteUser)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_file_time(file_time: datatypes.DateTimeType, typ: FileTimeStr | core.QFileDevice.FileTime) -> bool

                                                                                                                                                                                                                                  Set file time.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  file_time DateTimeType

                                                                                                                                                                                                                                  file time to set

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  typ FileTimeStr | FileTime

                                                                                                                                                                                                                                  file time type

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/filedevice.py
                                                                                                                                                                                                                                  def set_file_time(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      file_time: datatypes.DateTimeType,
                                                                                                                                                                                                                                      typ: FileTimeStr | core.QFileDevice.FileTime,
                                                                                                                                                                                                                                  ) -> bool:
                                                                                                                                                                                                                                      """Set file time.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          file_time: file time to set
                                                                                                                                                                                                                                          typ: file time type
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      file_time = datatypes.to_datetime(file_time)
                                                                                                                                                                                                                                      return self.setFileTime(file_time, FILE_TIME.get_enum_value(typ))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  FileInfo

                                                                                                                                                                                                                                  Bases: QFileInfo

                                                                                                                                                                                                                                  System-independent file information.

                                                                                                                                                                                                                                  Source code in prettyqt/core/fileinfo.py
                                                                                                                                                                                                                                  class FileInfo(core.QFileInfo):
                                                                                                                                                                                                                                      """System-independent file information."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                          if len(args) == 1 and isinstance(args[0], os.PathLike):
                                                                                                                                                                                                                                              super().__init__(os.fspath(args[0]))
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.absoluteFilePath())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _absoluteFilePath(self) -> str:
                                                                                                                                                                                                                                          return self.absoluteFilePath()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      __match_args__ = ("_absoluteFilePath",)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return self.absoluteFilePath()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __fspath__(self) -> str:
                                                                                                                                                                                                                                          return self.absoluteFilePath()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getattr__(self, attr: str) -> Any:
                                                                                                                                                                                                                                          return getattr(self.get_absolute_file_path(), attr)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.absoluteFilePath(),)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_dir(self) -> pathlib.Path:
                                                                                                                                                                                                                                          return pathlib.Path(self.dir().absolutePath())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_absolute_file_path(self) -> pathlib.Path:
                                                                                                                                                                                                                                          return pathlib.Path(self.absoluteFilePath())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_birth_time(self) -> core.DateTime:
                                                                                                                                                                                                                                          return core.DateTime(self.birthTime())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_metadata_change_time(self) -> core.DateTime:
                                                                                                                                                                                                                                          return core.DateTime(self.metadataChangeTime())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_last_modified(self) -> core.DateTime:
                                                                                                                                                                                                                                          return core.DateTime(self.lastModified())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_last_read(self) -> core.DateTime:
                                                                                                                                                                                                                                          return core.DateTime(self.lastRead())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  FileSelector

                                                                                                                                                                                                                                  Bases: ObjectMixin, QFileSelector

                                                                                                                                                                                                                                  Convenient way of selecting file variants.

                                                                                                                                                                                                                                  Source code in prettyqt/core/fileselector.py
                                                                                                                                                                                                                                  class FileSelector(core.ObjectMixin, core.QFileSelector):
                                                                                                                                                                                                                                      """Convenient way of selecting file variants."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def select_path(self, path: datatypes.PathType) -> str:
                                                                                                                                                                                                                                          return self.select(os.fspath(path))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def select_url(self, url: datatypes.UrlType) -> core.Url:
                                                                                                                                                                                                                                          return core.Url(self.select(datatypes.to_url(url)))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  FileSystemWatcher

                                                                                                                                                                                                                                  Bases: ObjectMixin, QFileSystemWatcher

                                                                                                                                                                                                                                  Interface for monitoring files and directories for modifications.

                                                                                                                                                                                                                                  Source code in prettyqt/core/filesystemwatcher.py
                                                                                                                                                                                                                                  class FileSystemWatcher(core.ObjectMixin, core.QFileSystemWatcher):
                                                                                                                                                                                                                                      """Interface for monitoring files and directories for modifications."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.directories() + self.files())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_directories(self) -> list[pathlib.Path]:
                                                                                                                                                                                                                                          return [pathlib.Path(p) for p in self.directories()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_files(self) -> list[pathlib.Path]:
                                                                                                                                                                                                                                          return [pathlib.Path(p) for p in self.files()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_paths(self) -> list[pathlib.Path]:
                                                                                                                                                                                                                                          return self.get_directories() + self.get_files()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def add_path(self, path: datatypes.PathType) -> bool:
                                                                                                                                                                                                                                          return self.addPath(os.fspath(path))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def add_paths(self, paths: Iterable[datatypes.PathType]):
                                                                                                                                                                                                                                          self.addPaths([os.fspath(p) for p in paths])
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  IODevice

                                                                                                                                                                                                                                  Bases: IODeviceMixin, QIODevice

                                                                                                                                                                                                                                  The base interface class of all I/O devices in Qt.

                                                                                                                                                                                                                                  Source code in prettyqt/core/iodevice.py
                                                                                                                                                                                                                                  class IODevice(IODeviceMixin, core.QIODevice):
                                                                                                                                                                                                                                      """The base interface class of all I/O devices in Qt."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  IdentityProxyModel

                                                                                                                                                                                                                                  Bases: AbstractProxyModelMixin, QIdentityProxyModel

                                                                                                                                                                                                                                  Proxies its source model unmodified.

                                                                                                                                                                                                                                  Source code in prettyqt/core/identityproxymodel.py
                                                                                                                                                                                                                                  4
                                                                                                                                                                                                                                  5
                                                                                                                                                                                                                                  6
                                                                                                                                                                                                                                  7
                                                                                                                                                                                                                                  class IdentityProxyModel(core.AbstractProxyModelMixin, core.QIdentityProxyModel):
                                                                                                                                                                                                                                      """Proxies its source model unmodified."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      ID = "identity"
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  ItemSelection

                                                                                                                                                                                                                                  Bases: QItemSelection

                                                                                                                                                                                                                                  Manages information about selected items in a model.

                                                                                                                                                                                                                                  Source code in prettyqt/core/itemselection.py
                                                                                                                                                                                                                                  class ItemSelection(QtCore.QItemSelection):
                                                                                                                                                                                                                                      """Manages information about selected items in a model."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  ItemSelectionModel

                                                                                                                                                                                                                                  Bases: ObjectMixin, QItemSelectionModel

                                                                                                                                                                                                                                  Keeps track of a view's selected items.

                                                                                                                                                                                                                                  Source code in prettyqt/core/itemselectionmodel.py
                                                                                                                                                                                                                                  class ItemSelectionModel(core.ObjectMixin, core.QItemSelectionModel):
                                                                                                                                                                                                                                      """Keeps track of a view's selected items."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __contains__(self, index: core.ModelIndex) -> bool:
                                                                                                                                                                                                                                          return self.isSelected(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_current_index(self, index, flag: SelectionFlagStr):
                                                                                                                                                                                                                                          self.setCurrentIndex(index, SELECTION_FLAG[flag])
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  ItemSelectionRange

                                                                                                                                                                                                                                  Bases: QItemSelectionRange

                                                                                                                                                                                                                                  Manages information about a range of selected items in a model.

                                                                                                                                                                                                                                  Source code in prettyqt/core/itemselectionrange.py
                                                                                                                                                                                                                                  class ItemSelectionRange(core.QItemSelectionRange):
                                                                                                                                                                                                                                      """Manages information about a range of selected items in a model."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __contains__(self, other: core.ModelIndex):
                                                                                                                                                                                                                                          return self.contains(other)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return not self.isEmpty()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __iter__(self) -> Iterator[core.ModelIndex]:
                                                                                                                                                                                                                                          return iter(self.indexes())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __len__(self):
                                                                                                                                                                                                                                          return len(self.indexes())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __and__(self, other: core.QItemSelectionRange):
                                                                                                                                                                                                                                          return self.intersected(other)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  JsonDocument

                                                                                                                                                                                                                                  Bases: QJsonDocument

                                                                                                                                                                                                                                  Way to read and write JSON documents.

                                                                                                                                                                                                                                  Source code in prettyqt/core/jsondocument.py
                                                                                                                                                                                                                                  class JsonDocument(core.QJsonDocument):
                                                                                                                                                                                                                                      """Way to read and write JSON documents."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return str(self.toVariant())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __format__(self, fmt):
                                                                                                                                                                                                                                          if fmt in JSON_FORMAT:
                                                                                                                                                                                                                                              return self.to_string(fmt == "indented")
                                                                                                                                                                                                                                          return super().__format__(fmt)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.toVariant())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getitem__(self, index: int | str):
                                                                                                                                                                                                                                          val = self.array() if self.isArray() else self.object()
                                                                                                                                                                                                                                          return core.JsonValue(val[index])  # type: ignore
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __setitem__(self, index: int | str, value):
                                                                                                                                                                                                                                          if self.isArray():
                                                                                                                                                                                                                                              if not isinstance(index, int):
                                                                                                                                                                                                                                                  raise TypeError
                                                                                                                                                                                                                                              array = self.array()
                                                                                                                                                                                                                                              if isinstance(array, list):  # PyQt6 returns a list
                                                                                                                                                                                                                                                  array[index] = value
                                                                                                                                                                                                                                              else:  # PySide6 returns a QJsonArray, which has no item assignment
                                                                                                                                                                                                                                                  array.replace(index, core.QJsonValue(value))
                                                                                                                                                                                                                                              self.setArray(array)
                                                                                                                                                                                                                                          elif self.isObject():
                                                                                                                                                                                                                                              if not isinstance(index, str):
                                                                                                                                                                                                                                                  raise TypeError
                                                                                                                                                                                                                                              obj = self.object()
                                                                                                                                                                                                                                              obj[index] = value
                                                                                                                                                                                                                                              self.setObject(obj)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def to_string(self, indented: bool = False) -> str:
                                                                                                                                                                                                                                          flag = self.JsonFormat.Indented if indented else self.JsonFormat.Compact
                                                                                                                                                                                                                                          return bytes(self.toJson(flag).data()).decode()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def from_variant(cls, obj) -> Self:
                                                                                                                                                                                                                                          doc = cls.fromVariant(obj)
                                                                                                                                                                                                                                          new = cls()
                                                                                                                                                                                                                                          if doc.isArray():
                                                                                                                                                                                                                                              new.setArray(doc.array())
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              new.setObject(doc.object())
                                                                                                                                                                                                                                          return new
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  JsonValue

                                                                                                                                                                                                                                  Bases: QJsonValue

                                                                                                                                                                                                                                  Encapsulates a value in JSON.

                                                                                                                                                                                                                                  Source code in prettyqt/core/jsonvalue.py
                                                                                                                                                                                                                                  class JsonValue(QtCore.QJsonValue):
                                                                                                                                                                                                                                      """Encapsulates a value in JSON."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return str(self.toVariant())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.toVariant())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  KeyCombination

                                                                                                                                                                                                                                  Bases: SerializeMixin, QKeyCombination

                                                                                                                                                                                                                                  Stores a combination of a key with optional modifiers.

                                                                                                                                                                                                                                  Source code in prettyqt/core/keycombination.py
                                                                                                                                                                                                                                  class KeyCombination(serializemixin.SerializeMixin, QtCore.QKeyCombination):
                                                                                                                                                                                                                                      """Stores a combination of a key with optional modifiers."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                          match args:
                                                                                                                                                                                                                                              case (str(),) if args[0] in MODIFIERS.inverse.values():
                                                                                                                                                                                                                                                  mods = args[0].split("+")
                                                                                                                                                                                                                                                  qtmod = functools.reduce(or_, [MODIFIERS[m] for m in mods])
                                                                                                                                                                                                                                                  super().__init__(qtmod, Keys.No)
                                                                                                                                                                                                                                                  return
                                                                                                                                                                                                                                              case (str(),):
                                                                                                                                                                                                                                                  *mods, btn = args[0].split("+")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                  # get modifiler
                                                                                                                                                                                                                                                  qtmod = (
                                                                                                                                                                                                                                                      functools.reduce(or_, [MODIFIERS[m] for m in mods])
                                                                                                                                                                                                                                                      if mods
                                                                                                                                                                                                                                                      else Mod.NoModifier
                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                  # get button
                                                                                                                                                                                                                                                  if btn in _SYMBOLS:
                                                                                                                                                                                                                                                      btn = _SYMBOLS[btn]
                                                                                                                                                                                                                                                  if btn.isalnum():
                                                                                                                                                                                                                                                      btn = btn.upper()
                                                                                                                                                                                                                                                  qtkey = getattr(Key, f"Key_{btn}") if btn != "{}" else Keys.Any
                                                                                                                                                                                                                                                  super().__init__(qtmod, qtkey)
                                                                                                                                                                                                                                              case (QtCore.QEvent(),):
                                                                                                                                                                                                                                                  modifier = args[0].modifiers() & ~Mod.KeypadModifier
                                                                                                                                                                                                                                                  key = Key(args[0].key())
                                                                                                                                                                                                                                                  if key in MODIFIER_KEYS:  # modifier only
                                                                                                                                                                                                                                                      key = Keys.No
                                                                                                                                                                                                                                                  super().__init__(modifier, key)
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __eq__(self, other):
                                                                                                                                                                                                                                          if isinstance(other, str | Key):
                                                                                                                                                                                                                                              other = KeyCombination(other)
                                                                                                                                                                                                                                          return super().__eq__(other)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __add__(self, other):
                                                                                                                                                                                                                                          from prettyqt import gui
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          return gui.KeySequence(self, other)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.key(), self.keyboardModifiers())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def is_typing(self) -> bool:
                                                                                                                                                                                                                                          """True if key is a letter or number."""
                                                                                                                                                                                                                                          mod_ok = self.keyboardModifiers() in (Mod.NoModifier, Mod.ShiftModifier)
                                                                                                                                                                                                                                          key = self.key()
                                                                                                                                                                                                                                          key_ok = (
                                                                                                                                                                                                                                              Key.Key_Exclam <= key <= Key.Key_ydiaeresis
                                                                                                                                                                                                                                              or Keys.ALPHA <= key <= Keys.OMEGA
                                                                                                                                                                                                                                              or Keys.CYR_A <= key <= Keys.CYR_YA
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                          return mod_ok and key_ok
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def is_moving(self) -> bool:
                                                                                                                                                                                                                                          """True if arrows are pushed."""
                                                                                                                                                                                                                                          return self.key() in ARROW_KEYS
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def is_moving_func(self) -> bool:
                                                                                                                                                                                                                                          """True if function arrows are pushed."""
                                                                                                                                                                                                                                          return self.key() in FUNC_ARROW_KEYS
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def has_modifier(self, modifier: constants.KeyboardModifierStr) -> bool:
                                                                                                                                                                                                                                          """True if keycombo contains modifier."""
                                                                                                                                                                                                                                          return bool(self.keyboardModifiers() & constants.KEYBOARD_MODIFIERS[modifier])
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def has_key(self) -> bool:
                                                                                                                                                                                                                                          """True if non-modifier key is pressed."""
                                                                                                                                                                                                                                          return self.key() != Keys.No
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_key(self) -> constants.KeyStr:
                                                                                                                                                                                                                                          return constants.KEY.inverse[self.key()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_modifiers(self) -> list[constants.KeyboardModifierStr]:
                                                                                                                                                                                                                                          return constants.KEYBOARD_MODIFIERS.get_list(self.keyboardModifiers())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  has_key() -> bool

                                                                                                                                                                                                                                  True if non-modifier key is pressed.

                                                                                                                                                                                                                                  Source code in prettyqt/core/keycombination.py
                                                                                                                                                                                                                                  def has_key(self) -> bool:
                                                                                                                                                                                                                                      """True if non-modifier key is pressed."""
                                                                                                                                                                                                                                      return self.key() != Keys.No
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  has_modifier(modifier: constants.KeyboardModifierStr) -> bool

                                                                                                                                                                                                                                  True if keycombo contains modifier.

                                                                                                                                                                                                                                  Source code in prettyqt/core/keycombination.py
                                                                                                                                                                                                                                  def has_modifier(self, modifier: constants.KeyboardModifierStr) -> bool:
                                                                                                                                                                                                                                      """True if keycombo contains modifier."""
                                                                                                                                                                                                                                      return bool(self.keyboardModifiers() & constants.KEYBOARD_MODIFIERS[modifier])
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  is_moving() -> bool

                                                                                                                                                                                                                                  True if arrows are pushed.

                                                                                                                                                                                                                                  Source code in prettyqt/core/keycombination.py
                                                                                                                                                                                                                                  def is_moving(self) -> bool:
                                                                                                                                                                                                                                      """True if arrows are pushed."""
                                                                                                                                                                                                                                      return self.key() in ARROW_KEYS
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  is_moving_func() -> bool

                                                                                                                                                                                                                                  True if function arrows are pushed.

                                                                                                                                                                                                                                  Source code in prettyqt/core/keycombination.py
                                                                                                                                                                                                                                  def is_moving_func(self) -> bool:
                                                                                                                                                                                                                                      """True if function arrows are pushed."""
                                                                                                                                                                                                                                      return self.key() in FUNC_ARROW_KEYS
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  is_typing() -> bool

                                                                                                                                                                                                                                  True if key is a letter or number.

                                                                                                                                                                                                                                  Source code in prettyqt/core/keycombination.py
                                                                                                                                                                                                                                  def is_typing(self) -> bool:
                                                                                                                                                                                                                                      """True if key is a letter or number."""
                                                                                                                                                                                                                                      mod_ok = self.keyboardModifiers() in (Mod.NoModifier, Mod.ShiftModifier)
                                                                                                                                                                                                                                      key = self.key()
                                                                                                                                                                                                                                      key_ok = (
                                                                                                                                                                                                                                          Key.Key_Exclam <= key <= Key.Key_ydiaeresis
                                                                                                                                                                                                                                          or Keys.ALPHA <= key <= Keys.OMEGA
                                                                                                                                                                                                                                          or Keys.CYR_A <= key <= Keys.CYR_YA
                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                      return mod_ok and key_ok
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Library

                                                                                                                                                                                                                                  Bases: ObjectMixin, QLibrary

                                                                                                                                                                                                                                  Loads shared libraries at runtime.

                                                                                                                                                                                                                                  Source code in prettyqt/core/library.py
                                                                                                                                                                                                                                  class Library(core.ObjectMixin, core.QLibrary):
                                                                                                                                                                                                                                      """Loads shared libraries at runtime."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return self.isLoaded()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.fileName())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_load_hints(self) -> list[LoadHintStr]:
                                                                                                                                                                                                                                          return LOAD_HINTS.get_list(self.loadHints())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_load_hints(self, **kwargs):
                                                                                                                                                                                                                                          flag = core.QLibrary.LoadHint(0)
                                                                                                                                                                                                                                          for k, v in kwargs.items():
                                                                                                                                                                                                                                              if v is True:
                                                                                                                                                                                                                                                  flag |= LOAD_HINTS[k]
                                                                                                                                                                                                                                          self.setLoadHints(flag)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  LibraryInfo

                                                                                                                                                                                                                                  Bases: QLibraryInfo

                                                                                                                                                                                                                                  Information about the Qt library.

                                                                                                                                                                                                                                  Source code in prettyqt/core/libraryinfo.py
                                                                                                                                                                                                                                  class LibraryInfo(core.QLibraryInfo):
                                                                                                                                                                                                                                      """Information about the Qt library."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_location(cls, location: LocationStr) -> pathlib.Path:
                                                                                                                                                                                                                                          path = cls.path(LOCATION.get_enum_value(location))
                                                                                                                                                                                                                                          return pathlib.Path(path)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_version(cls) -> core.VersionNumber:
                                                                                                                                                                                                                                          return core.VersionNumber(cls.version())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Line

                                                                                                                                                                                                                                  Bases: QLine

                                                                                                                                                                                                                                  Two-dimensional vector using integer precision.

                                                                                                                                                                                                                                  Source code in prettyqt/core/line.py
                                                                                                                                                                                                                                  class Line(core.QLine):
                                                                                                                                                                                                                                      """Two-dimensional vector using integer precision."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.get_p1(), self.get_p2())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _x1(self) -> int:
                                                                                                                                                                                                                                          return self.x1()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _y1(self) -> int:
                                                                                                                                                                                                                                          return self.y1()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _x2(self) -> int:
                                                                                                                                                                                                                                          return self.x2()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _y2(self) -> int:
                                                                                                                                                                                                                                          return self.y2()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      __match_args__ = ("_x1", "_y1", "_x2", "_y2")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.get_p1(), self.get_p2())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __abs__(self) -> float:
                                                                                                                                                                                                                                          p = self.get_p2() - self.get_p1()
                                                                                                                                                                                                                                          return math.sqrt((p.x() * p.x()) + (p.y() * p.y()))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reversed__(self) -> Self:
                                                                                                                                                                                                                                          return type(self)(self.get_p2(), self.get_p1())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __iter__(self) -> Iterator[core.Point]:
                                                                                                                                                                                                                                          yield self.get_p1()
                                                                                                                                                                                                                                          yield self.get_p2()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getitem__(self, index: Literal[0, 1]) -> core.Point:
                                                                                                                                                                                                                                          match index:
                                                                                                                                                                                                                                              case 0:
                                                                                                                                                                                                                                                  return self.get_p1()
                                                                                                                                                                                                                                              case 1:
                                                                                                                                                                                                                                                  return self.get_p2()
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  raise IndexError(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __setitem__(self, index: Literal[0, 1], value: datatypes.PointType):
                                                                                                                                                                                                                                          match index:
                                                                                                                                                                                                                                              case 0:
                                                                                                                                                                                                                                                  self.set_p1(value)
                                                                                                                                                                                                                                              case 1:
                                                                                                                                                                                                                                                  self.set_p2(value)
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  raise KeyError(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_p1(self) -> core.Point:
                                                                                                                                                                                                                                          return core.Point(self.p1())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_p1(self, point: datatypes.PointType):
                                                                                                                                                                                                                                          self.setP1(datatypes.to_point(point))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_p2(self) -> core.Point:
                                                                                                                                                                                                                                          return core.Point(self.p2())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_p2(self, point: datatypes.PointType):
                                                                                                                                                                                                                                          self.setP2(datatypes.to_point(point))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_center(self) -> core.Point:
                                                                                                                                                                                                                                          return core.Point(self.center())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  LineF

                                                                                                                                                                                                                                  Bases: QLineF

                                                                                                                                                                                                                                  Two-dimensional vector using floating point precision.

                                                                                                                                                                                                                                  Source code in prettyqt/core/linef.py
                                                                                                                                                                                                                                  class LineF(core.QLineF):
                                                                                                                                                                                                                                      """Two-dimensional vector using floating point precision."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.get_p1(), self.get_p2())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _x1(self) -> float:
                                                                                                                                                                                                                                          return self.x1()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _y1(self) -> float:
                                                                                                                                                                                                                                          return self.y1()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _x2(self) -> float:
                                                                                                                                                                                                                                          return self.x2()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _y2(self) -> float:
                                                                                                                                                                                                                                          return self.y2()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      __match_args__ = ("_x1", "_y1", "_x2", "_y2")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.get_p1(), self.get_p2())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reversed__(self):
                                                                                                                                                                                                                                          return LineF(self.get_p2(), self.get_p1())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __abs__(self) -> float:
                                                                                                                                                                                                                                          return self.length()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __iter__(self) -> Iterator[core.PointF]:
                                                                                                                                                                                                                                          yield self.get_p1()
                                                                                                                                                                                                                                          yield self.get_p2()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getitem__(self, index: Literal[0, 1]) -> core.PointF:
                                                                                                                                                                                                                                          match index:
                                                                                                                                                                                                                                              case 0:
                                                                                                                                                                                                                                                  return self.get_p1()
                                                                                                                                                                                                                                              case 1:
                                                                                                                                                                                                                                                  return self.get_p2()
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  raise KeyError(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __setitem__(self, index: Literal[0, 1], value: datatypes.PointFType):
                                                                                                                                                                                                                                          match index:
                                                                                                                                                                                                                                              case 0:
                                                                                                                                                                                                                                                  self.set_p1(value)
                                                                                                                                                                                                                                              case 1:
                                                                                                                                                                                                                                                  self.set_p2(value)
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  raise KeyError(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_p1(self, point: datatypes.PointFType):
                                                                                                                                                                                                                                          self.setP1(datatypes.to_pointf(point))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_p1(self) -> core.PointF:
                                                                                                                                                                                                                                          return core.PointF(self.p1())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_p2(self, point: datatypes.PointFType):
                                                                                                                                                                                                                                          self.setP2(datatypes.to_pointf(point))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_p2(self) -> core.PointF:
                                                                                                                                                                                                                                          return core.PointF(self.p2())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_center(self) -> core.PointF:
                                                                                                                                                                                                                                          return core.PointF(self.center())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_normal_vector(self) -> Self:
                                                                                                                                                                                                                                          return type(self)(self.normalVector())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_unit_vector(self) -> Self:
                                                                                                                                                                                                                                          return type(self)(self.unitVector())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def to_line(self) -> core.Line:
                                                                                                                                                                                                                                          return core.Line(self.toLine())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Locale

                                                                                                                                                                                                                                  Bases: QLocale

                                                                                                                                                                                                                                  Converts between numbers and their string representations in various languages.

                                                                                                                                                                                                                                  Source code in prettyqt/core/_locale.py
                                                                                                                                                                                                                                  class Locale(QtCore.QLocale):
                                                                                                                                                                                                                                      """Converts between numbers and their string representations in various languages."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.bcp47Name())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.bcp47Name(),)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_flag_unicode(self):
                                                                                                                                                                                                                                          name = self.name().split("_")[1]
                                                                                                                                                                                                                                          name = [c for c in name.lower() if c.isalnum()]
                                                                                                                                                                                                                                          return "".join([chr(ord(c.upper()) + OFFSET) for c in name])
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_system_locale(cls) -> Self:
                                                                                                                                                                                                                                          return cls(cls.system())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_c_locale(cls) -> Self:
                                                                                                                                                                                                                                          return cls(cls.c())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_system_language(cls) -> str:
                                                                                                                                                                                                                                          return cls.get_system_locale().uiLanguages()[0]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_country(self):
                                                                                                                                                                                                                                          return COUNTRY.inverse[self.country()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_measurement_system(self) -> MeasurementSystemStr:
                                                                                                                                                                                                                                          return MEASUREMENT_SYSTEM.inverse[self.measurementSystem()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_formatted_data_size(
                                                                                                                                                                                                                                          self, size: int, precision: int = 2, fmt: DataSizeFormatStr = "iec"
                                                                                                                                                                                                                                      ) -> str:
                                                                                                                                                                                                                                          if size < 0:
                                                                                                                                                                                                                                              return ""
                                                                                                                                                                                                                                          return self.formattedDataSize(size, precision, DATA_SIZE_FORMAT[fmt])
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_first_day_of_week(self) -> constants.DayOfWeekStr:
                                                                                                                                                                                                                                          return constants.DAY_OF_WEEK.inverse[self.firstDayOfWeek()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_text_direction(self) -> constants.LayoutDirectionStr:
                                                                                                                                                                                                                                          return constants.LAYOUT_DIRECTION.inverse[self.textDirection()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_weekdays(self) -> list[constants.DayOfWeekStr]:
                                                                                                                                                                                                                                          return [constants.DAY_OF_WEEK.inverse[i] for i in self.weekdays()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_day_name(self, day: int, format_type: FormatTypeStr = "long") -> str:
                                                                                                                                                                                                                                          return self.dayName(day, FORMAT_TYPE[format_type])
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_month_name(self, month: int, format_type: FormatTypeStr = "long") -> str:
                                                                                                                                                                                                                                          return self.monthName(month, FORMAT_TYPE[format_type])
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_standalone_day_name(
                                                                                                                                                                                                                                          self, day: int, format_type: FormatTypeStr = "long"
                                                                                                                                                                                                                                      ) -> str:
                                                                                                                                                                                                                                          return self.standaloneDayName(day, FORMAT_TYPE[format_type])
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_time_format(self, format_type: FormatTypeStr = "long") -> str:
                                                                                                                                                                                                                                          return self.timeFormat(FORMAT_TYPE[format_type])
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_date_format(self, format_type: FormatTypeStr = "long") -> str:
                                                                                                                                                                                                                                          return self.dateFormat(FORMAT_TYPE[format_type])
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_datetime_format(self, format_type: FormatTypeStr = "long") -> str:
                                                                                                                                                                                                                                          return self.dateTimeFormat(FORMAT_TYPE[format_type])
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def to_datetime(
                                                                                                                                                                                                                                          self, text: str, format_type: FormatTypeStr | str = "long"
                                                                                                                                                                                                                                      ) -> QtCore.QDateTime:
                                                                                                                                                                                                                                          fmt = FORMAT_TYPE[format_type] if format_type in FORMAT_TYPE else format_type  # noqa: SIM401
                                                                                                                                                                                                                                          return self.toDateTime(text, fmt)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def to_date(
                                                                                                                                                                                                                                          self, text: str, format_type: FormatTypeStr | str = "long"
                                                                                                                                                                                                                                      ) -> QtCore.QDate:
                                                                                                                                                                                                                                          fmt = FORMAT_TYPE[format_type] if format_type in FORMAT_TYPE else format_type  # noqa: SIM401
                                                                                                                                                                                                                                          return self.toDate(text, fmt)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def to_time(
                                                                                                                                                                                                                                          self, text: str, format_type: FormatTypeStr | str = "long"
                                                                                                                                                                                                                                      ) -> QtCore.QTime:
                                                                                                                                                                                                                                          fmt = FORMAT_TYPE[format_type] if format_type in FORMAT_TYPE else format_type  # noqa: SIM401
                                                                                                                                                                                                                                          return self.toTime(text, fmt)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_standalone_month_name(
                                                                                                                                                                                                                                          self, month: int, format_type: FormatTypeStr = "long"
                                                                                                                                                                                                                                      ) -> str:
                                                                                                                                                                                                                                          return self.standaloneMonthName(month, FORMAT_TYPE[format_type])
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def quote_string(self, string: str, alternate_style: bool = False) -> str:
                                                                                                                                                                                                                                          flag = (
                                                                                                                                                                                                                                              self.QuotationStyle.AlternateQuotation
                                                                                                                                                                                                                                              if alternate_style
                                                                                                                                                                                                                                              else self.QuotationStyle.StandardQuotation
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                          return self.quoteString(string, flag)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_all_locales(cls) -> list[Self]:
                                                                                                                                                                                                                                          return [
                                                                                                                                                                                                                                              cls(i)
                                                                                                                                                                                                                                              for i in cls.matchingLocales(
                                                                                                                                                                                                                                                  cls.Language.AnyLanguage, cls.Script.AnyScript, cls.Country.AnyCountry
                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  LocationPermission

                                                                                                                                                                                                                                  Bases: QLocationPermission

                                                                                                                                                                                                                                  Access the user's location.

                                                                                                                                                                                                                                  Source code in prettyqt/core/locationpermission.py
                                                                                                                                                                                                                                  class LocationPermission(QtCore.QLocationPermission):
                                                                                                                                                                                                                                      """Access the user's location."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_accuracy(self, accuracy: AccuracyStr | QtCore.QLocationPermission.Accuracy):
                                                                                                                                                                                                                                          """Set the desired location accuracy.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              accuracy: accuracy to use
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setAccuracy(ACCURACY.get_enum_value(accuracy))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_accuracy(self) -> AccuracyStr:
                                                                                                                                                                                                                                          """Return current location accuracy.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              location accuracy
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return ACCURACY.inverse[self.accuracy()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_availability(
                                                                                                                                                                                                                                          self, availability: AvailabilityStr | QtCore.QLocationPermission.Availability
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Set the desired location availability.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              availability: availability to use
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setAvailability(AVAILABILITY.get_enum_value(availability))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_availability(self) -> AvailabilityStr:
                                                                                                                                                                                                                                          """Return current location availability.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              location availability
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return AVAILABILITY.inverse[self.availability()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_accuracy() -> AccuracyStr

                                                                                                                                                                                                                                  Return current location accuracy.

                                                                                                                                                                                                                                  Source code in prettyqt/core/locationpermission.py
                                                                                                                                                                                                                                  def get_accuracy(self) -> AccuracyStr:
                                                                                                                                                                                                                                      """Return current location accuracy.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          location accuracy
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return ACCURACY.inverse[self.accuracy()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_availability() -> AvailabilityStr

                                                                                                                                                                                                                                  Return current location availability.

                                                                                                                                                                                                                                  Source code in prettyqt/core/locationpermission.py
                                                                                                                                                                                                                                  def get_availability(self) -> AvailabilityStr:
                                                                                                                                                                                                                                      """Return current location availability.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          location availability
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return AVAILABILITY.inverse[self.availability()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_accuracy(accuracy: AccuracyStr | QtCore.QLocationPermission.Accuracy)

                                                                                                                                                                                                                                  Set the desired location accuracy.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  accuracy AccuracyStr | Accuracy

                                                                                                                                                                                                                                  accuracy to use

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/locationpermission.py
                                                                                                                                                                                                                                  def set_accuracy(self, accuracy: AccuracyStr | QtCore.QLocationPermission.Accuracy):
                                                                                                                                                                                                                                      """Set the desired location accuracy.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          accuracy: accuracy to use
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setAccuracy(ACCURACY.get_enum_value(accuracy))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_availability(availability: AvailabilityStr | QtCore.QLocationPermission.Availability)

                                                                                                                                                                                                                                  Set the desired location availability.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  availability AvailabilityStr | Availability

                                                                                                                                                                                                                                  availability to use

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/locationpermission.py
                                                                                                                                                                                                                                  def set_availability(
                                                                                                                                                                                                                                      self, availability: AvailabilityStr | QtCore.QLocationPermission.Availability
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Set the desired location availability.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          availability: availability to use
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setAvailability(AVAILABILITY.get_enum_value(availability))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  LockFile

                                                                                                                                                                                                                                  Bases: QLockFile

                                                                                                                                                                                                                                  Locking between processes using a file.

                                                                                                                                                                                                                                  Source code in prettyqt/core/lockfile.py
                                                                                                                                                                                                                                  class LockFile(QtCore.QLockFile):
                                                                                                                                                                                                                                      """Locking between processes using a file."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, path: datatypes.PathType):
                                                                                                                                                                                                                                          super().__init__(os.fspath(path))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_error(self) -> LockErrorStr:
                                                                                                                                                                                                                                          return LOCK_ERROR.inverse[self.error()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def lock_file(self):
                                                                                                                                                                                                                                          self.lock()
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield self
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              self.unlock()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  LoggingCategory

                                                                                                                                                                                                                                  Bases: QLoggingCategory

                                                                                                                                                                                                                                  Represents a category, or 'area' in the logging infrastructure.

                                                                                                                                                                                                                                  Source code in prettyqt/core/loggingcategory.py
                                                                                                                                                                                                                                  class LoggingCategory(QtCore.QLoggingCategory):
                                                                                                                                                                                                                                      """Represents a category, or 'area' in the logging infrastructure."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_level(self) -> MsgTypeStr:
                                                                                                                                                                                                                                          if self.isDebugEnabled():
                                                                                                                                                                                                                                              return "debug"
                                                                                                                                                                                                                                          if self.isInfoEnabled():
                                                                                                                                                                                                                                              return "info"
                                                                                                                                                                                                                                          if self.isWarningEnabled():
                                                                                                                                                                                                                                              return "warning"
                                                                                                                                                                                                                                          if self.isCriticalEnabled():
                                                                                                                                                                                                                                              return "critical"
                                                                                                                                                                                                                                          return "fatal"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_enabled(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          level: MsgTypeStr,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          self.setEnabled(MSG_TYPE[level], True)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_disabled(self, level: MsgTypeStr):
                                                                                                                                                                                                                                          self.setEnabled(MSG_TYPE[level], False)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Margins

                                                                                                                                                                                                                                  Bases: QMargins

                                                                                                                                                                                                                                  Defines the four margins of a rectangle.

                                                                                                                                                                                                                                  Source code in prettyqt/core/margins.py
                                                                                                                                                                                                                                  class Margins(QtCore.QMargins):
                                                                                                                                                                                                                                      """Defines the four margins of a rectangle."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.left(), self.top(), self.right(), self.bottom())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.left(), self.top(), self.right(), self.bottom())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _left(self) -> int:
                                                                                                                                                                                                                                          return self.left()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _top(self) -> int:
                                                                                                                                                                                                                                          return self.top()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _right(self) -> int:
                                                                                                                                                                                                                                          return self.right()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _bottom(self) -> int:
                                                                                                                                                                                                                                          return self.bottom()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      __match_args__ = ("_left", "_top", "_right", "_bottom")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return not self.isNull()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __iter__(self) -> Iterator[int]:
                                                                                                                                                                                                                                          yield self.left()
                                                                                                                                                                                                                                          yield self.top()
                                                                                                                                                                                                                                          yield self.right()
                                                                                                                                                                                                                                          yield self.bottom()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  MarginsF

                                                                                                                                                                                                                                  Bases: QMarginsF

                                                                                                                                                                                                                                  Defines the four margins of a rectangle (floating point precision).

                                                                                                                                                                                                                                  Source code in prettyqt/core/marginsf.py
                                                                                                                                                                                                                                  class MarginsF(QtCore.QMarginsF):
                                                                                                                                                                                                                                      """Defines the four margins of a rectangle (floating point precision)."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.left(), self.top(), self.right(), self.bottom())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _left(self) -> float:
                                                                                                                                                                                                                                          return self.left()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _top(self) -> float:
                                                                                                                                                                                                                                          return self.top()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _right(self) -> float:
                                                                                                                                                                                                                                          return self.right()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _bottom(self) -> float:
                                                                                                                                                                                                                                          return self.bottom()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      __match_args__ = ("_left", "_top", "_right", "_bottom")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.left(), self.top(), self.right(), self.bottom())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return not self.isNull()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __iter__(self) -> Iterator[float]:
                                                                                                                                                                                                                                          yield self.left()
                                                                                                                                                                                                                                          yield self.top()
                                                                                                                                                                                                                                          yield self.right()
                                                                                                                                                                                                                                          yield self.bottom()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  MessageAuthenticationCode

                                                                                                                                                                                                                                  Bases: QMessageAuthenticationCode

                                                                                                                                                                                                                                  Way to generate hash-based message authentication codes (HMAC).

                                                                                                                                                                                                                                  Source code in prettyqt/core/messageauthenticationcode.py
                                                                                                                                                                                                                                  class MessageAuthenticationCode(QtCore.QMessageAuthenticationCode):
                                                                                                                                                                                                                                      """Way to generate hash-based message authentication codes (HMAC)."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          method: core.cryptographichash.AlgorithmStr | QtCore.QCryptographicHash.Algorithm,
                                                                                                                                                                                                                                          key: datatypes.ByteArrayType = b"",
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          algo = core.cryptographichash.ALGORITHM.get_enum_value(method)
                                                                                                                                                                                                                                          super().__init__(algo, datatypes.to_bytearray(key))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bytes__(self):
                                                                                                                                                                                                                                          return self.get_result()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_key(self, key: datatypes.ByteArrayType):
                                                                                                                                                                                                                                          self.setKey(datatypes.to_bytearray(key))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def add_data(self, data: datatypes.ByteArrayType):
                                                                                                                                                                                                                                          self.addData(datatypes.to_bytearray(data))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_result(self) -> bytes:
                                                                                                                                                                                                                                          return bytes(self.result().data())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @staticmethod
                                                                                                                                                                                                                                      def compute_hash(
                                                                                                                                                                                                                                          message: datatypes.ByteArrayType,
                                                                                                                                                                                                                                          key: datatypes.ByteArrayType,
                                                                                                                                                                                                                                          method: core.cryptographichash.AlgorithmStr | QtCore.QCryptographicHash.Algorithm,
                                                                                                                                                                                                                                      ) -> bytes:
                                                                                                                                                                                                                                          algo = core.cryptographichash.ALGORITHM.get_enum_value(method)
                                                                                                                                                                                                                                          result = QtCore.QMessageAuthenticationCode.hash(
                                                                                                                                                                                                                                              datatypes.to_bytearray(message),
                                                                                                                                                                                                                                              datatypes.to_bytearray(key),
                                                                                                                                                                                                                                              algo,
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                          return bytes(result.data())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  MetaEnum

                                                                                                                                                                                                                                  Meta-data about an enumerator.

                                                                                                                                                                                                                                  Source code in prettyqt/core/metaenum.py
                                                                                                                                                                                                                                  class MetaEnum:
                                                                                                                                                                                                                                      """Meta-data about an enumerator."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, metaenum: QtCore.QMetaEnum):
                                                                                                                                                                                                                                          self.item = metaenum
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getattr__(self, val):
                                                                                                                                                                                                                                          return getattr(self.item, val)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return self.item.isValid()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getitem__(self, index: str | tuple[str, str]) -> int:
                                                                                                                                                                                                                                          match index:
                                                                                                                                                                                                                                              case str():
                                                                                                                                                                                                                                                  result = self.item.keyToValue(index)[0]  # type: ignore
                                                                                                                                                                                                                                              case (str(), str()):
                                                                                                                                                                                                                                                  val = "|".join(index)
                                                                                                                                                                                                                                                  result = self.item.keysToValue(val)[0]  # type: ignore
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  raise TypeError(index)
                                                                                                                                                                                                                                          if result == -1:
                                                                                                                                                                                                                                              raise KeyError(index)
                                                                                                                                                                                                                                          return result
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.get_name())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __len__(self):
                                                                                                                                                                                                                                          return self.item.keyCount()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_enum_name(self) -> str:
                                                                                                                                                                                                                                          return self.item.enumName()  # type: ignore
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_scope(self) -> str:
                                                                                                                                                                                                                                          return self.item.scope()  # type: ignore
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_scope_object(self):
                                                                                                                                                                                                                                          scope = self.get_scope()
                                                                                                                                                                                                                                          return QtCore.Qt if scope == "Qt" else classhelpers.get_class_by_name(scope)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_name(self) -> str:
                                                                                                                                                                                                                                          return self.item.name()  # type: ignore
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def list_options(self):
                                                                                                                                                                                                                                          return [self.value(i) for i in range(self.keyCount())]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  MetaMethod

                                                                                                                                                                                                                                  Meta-data about an member method.

                                                                                                                                                                                                                                  Source code in prettyqt/core/metamethod.py
                                                                                                                                                                                                                                  class MetaMethod:
                                                                                                                                                                                                                                      """Meta-data about an member method."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, metamethod: core.QMetaMethod):
                                                                                                                                                                                                                                          self.item = metamethod
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getattr__(self, val):
                                                                                                                                                                                                                                          return getattr(self.item, val)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return self.item.isValid()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.get_name())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_access(self) -> AccessStr:
                                                                                                                                                                                                                                          return ACCESS.inverse[self.item.access()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_method_type(self) -> MethodTypeStr:
                                                                                                                                                                                                                                          return METHOD_TYPE.inverse[self.item.methodType()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_method_signature(self) -> str:
                                                                                                                                                                                                                                          return bytes(self.item.methodSignature().data()).decode()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_normalized_method_signature(self) -> str:
                                                                                                                                                                                                                                          """Returns something like 'objectNameChanged(QString)'."""
                                                                                                                                                                                                                                          sig = self.item.methodSignature()
                                                                                                                                                                                                                                          # PySide6's stub says bytes, but only str works at runtime.
                                                                                                                                                                                                                                          normalized = core.QMetaObject.normalizedSignature(bytes(sig.data()).decode())  # ty: ignore[invalid-argument-type]
                                                                                                                                                                                                                                          return bytes(normalized.data()).decode()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_name(self) -> str:
                                                                                                                                                                                                                                          return bytes(self.item.name().data()).decode()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_parameters(self) -> list[core.MetaType]:
                                                                                                                                                                                                                                          count = self.parameterCount()
                                                                                                                                                                                                                                          return [core.MetaType(self.parameterMetaType(i).id()) for i in range(count)]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_return_type(self) -> core.MetaType:
                                                                                                                                                                                                                                          return core.MetaType(self.returnMetaType().id())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_parameter_types(self) -> list[str]:
                                                                                                                                                                                                                                          """Returns sth. like ['QString']."""
                                                                                                                                                                                                                                          return [i.data().decode() for i in self.parameterTypes()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_normalized_method_signature() -> str

                                                                                                                                                                                                                                  Returns something like 'objectNameChanged(QString)'.

                                                                                                                                                                                                                                  Source code in prettyqt/core/metamethod.py
                                                                                                                                                                                                                                  def get_normalized_method_signature(self) -> str:
                                                                                                                                                                                                                                      """Returns something like 'objectNameChanged(QString)'."""
                                                                                                                                                                                                                                      sig = self.item.methodSignature()
                                                                                                                                                                                                                                      # PySide6's stub says bytes, but only str works at runtime.
                                                                                                                                                                                                                                      normalized = core.QMetaObject.normalizedSignature(bytes(sig.data()).decode())  # ty: ignore[invalid-argument-type]
                                                                                                                                                                                                                                      return bytes(normalized.data()).decode()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_parameter_types() -> list[str]

                                                                                                                                                                                                                                  Returns sth. like ['QString'].

                                                                                                                                                                                                                                  Source code in prettyqt/core/metamethod.py
                                                                                                                                                                                                                                  def get_parameter_types(self) -> list[str]:
                                                                                                                                                                                                                                      """Returns sth. like ['QString']."""
                                                                                                                                                                                                                                      return [i.data().decode() for i in self.parameterTypes()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  MetaObject

                                                                                                                                                                                                                                  Contains meta-information about Qt objects.

                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  class MetaObject:
                                                                                                                                                                                                                                      """Contains meta-information about Qt objects."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, metaobject: core.QMetaObject):
                                                                                                                                                                                                                                          self.item = metaobject
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getattr__(self, val):
                                                                                                                                                                                                                                          return getattr(self.item, val)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_super_class(self) -> MetaObject | None:
                                                                                                                                                                                                                                          """Get SuperClass MetaObject."""
                                                                                                                                                                                                                                          return MetaObject(klass) if (klass := self.superClass()) is not None else None
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_all_super_classes(self) -> list[MetaObject]:
                                                                                                                                                                                                                                          """Get SuperClass MetaObject."""
                                                                                                                                                                                                                                          klasses = []
                                                                                                                                                                                                                                          while klass := self.superClass():
                                                                                                                                                                                                                                              klasses.append(MetaObject(klass))
                                                                                                                                                                                                                                          return klasses
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_name(self) -> str:
                                                                                                                                                                                                                                          """Get MetaObject class name."""
                                                                                                                                                                                                                                          return self.className()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_class_info(self, include_super: bool = True) -> dict[str, str]:
                                                                                                                                                                                                                                          """Get MetaObject class info.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              include_super: Whether to include class info from parent classes.
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          start = 0 if include_super else self.item.classInfoOffset()
                                                                                                                                                                                                                                          count = self.item.classInfoCount()
                                                                                                                                                                                                                                          classinfos = [self.item.classInfo(i) for i in range(start, count)]
                                                                                                                                                                                                                                          return {_to_str(i.name()): _to_str(i.value()) for i in classinfos}
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_method(self, index: int | str) -> core.MetaMethod:
                                                                                                                                                                                                                                          """Get MetaMethod based on index or name.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              index: index or method name
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          if isinstance(index, int):
                                                                                                                                                                                                                                              method = core.MetaMethod(self.item.method(index))
                                                                                                                                                                                                                                              if not method.isValid():
                                                                                                                                                                                                                                                  raise KeyError(index)
                                                                                                                                                                                                                                              return method
                                                                                                                                                                                                                                          for method in self.get_methods():
                                                                                                                                                                                                                                              if method.get_name() in [index, helpers.to_lower_camel(index)]:
                                                                                                                                                                                                                                                  return method
                                                                                                                                                                                                                                          raise KeyError(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_enum(self, index: int | str) -> core.MetaEnum:
                                                                                                                                                                                                                                          """Get MetaEnum based on index or name.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              index: index or Enum name
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          if isinstance(index, int):
                                                                                                                                                                                                                                              enum = core.MetaEnum(self.item.enumerator(index))
                                                                                                                                                                                                                                              if not enum.isValid():
                                                                                                                                                                                                                                                  raise KeyError(index)
                                                                                                                                                                                                                                              return enum
                                                                                                                                                                                                                                          for enumerator in self.get_enums():
                                                                                                                                                                                                                                              if enumerator.get_name() in [index, helpers.to_lower_camel(index)]:
                                                                                                                                                                                                                                                  return enumerator
                                                                                                                                                                                                                                          raise KeyError(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def has_property(self, name: str):
                                                                                                                                                                                                                                          """Check if a property with given name exists.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Only checks for non-dynamic properties.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              name: property name
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              self.get_property(name)
                                                                                                                                                                                                                                          except KeyError:
                                                                                                                                                                                                                                              return False
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              return True
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_property(self, index: int | str) -> core.MetaProperty:
                                                                                                                                                                                                                                          """Get MetaProperty based on index or name.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Only returns non-dynamic properties.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              index: index or property name
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          if isinstance(index, int):
                                                                                                                                                                                                                                              prop = core.MetaProperty(self.item.property(index))
                                                                                                                                                                                                                                              if not prop.isValid():
                                                                                                                                                                                                                                                  raise KeyError(index)
                                                                                                                                                                                                                                              return prop
                                                                                                                                                                                                                                          for prop in self.get_properties():
                                                                                                                                                                                                                                              if prop.get_name() in [index, helpers.to_lower_camel(index)]:
                                                                                                                                                                                                                                                  return prop
                                                                                                                                                                                                                                          raise KeyError(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_constructor(self, index: int | str) -> core.MetaMethod:
                                                                                                                                                                                                                                          """Get ctor MetaMethod based on index or name.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              index: index or constructor name
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          if isinstance(index, int):
                                                                                                                                                                                                                                              method = core.MetaMethod(self.item.constructor(index))
                                                                                                                                                                                                                                              if not method.isValid():
                                                                                                                                                                                                                                                  raise KeyError(index)
                                                                                                                                                                                                                                              return method
                                                                                                                                                                                                                                          for method in self.get_constructors():
                                                                                                                                                                                                                                              if method.get_name() in [index, helpers.to_lower_camel(index)]:
                                                                                                                                                                                                                                                  return method
                                                                                                                                                                                                                                          raise KeyError(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_methods(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          include_super: bool = True,
                                                                                                                                                                                                                                          type_filter: core.metamethod.MethodTypeStr | None = None,
                                                                                                                                                                                                                                          filter_internal: bool = True,
                                                                                                                                                                                                                                      ) -> list[core.MetaMethod]:
                                                                                                                                                                                                                                          """Get all MetaMethods based on given criteria.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              include_super: Whether to include Methods from parent classes
                                                                                                                                                                                                                                              type_filter: Method type to filter for.
                                                                                                                                                                                                                                              filter_internal: Filter Qt-internal methods
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          start = 0 if include_super else self.item.methodOffset()
                                                                                                                                                                                                                                          methods = [
                                                                                                                                                                                                                                              method
                                                                                                                                                                                                                                              for i in range(start, self.item.methodCount())
                                                                                                                                                                                                                                              if not (method := self.get_method(i)).get_name().startswith("_q_")
                                                                                                                                                                                                                                              or not filter_internal
                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                          if type_filter is None:
                                                                                                                                                                                                                                              return methods
                                                                                                                                                                                                                                          return [i for i in methods if i.get_method_type() == type_filter]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_enums(self, include_super: bool = True) -> list[core.MetaEnum]:
                                                                                                                                                                                                                                          """Get all MetaEnums based on given criteria.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              include_super: Whether to include Enums from parent classes.
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          start = 0 if include_super else self.item.enumeratorOffset()
                                                                                                                                                                                                                                          return [self.get_enum(i) for i in range(start, self.item.enumeratorCount())]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_constructors(self) -> list[core.MetaMethod]:
                                                                                                                                                                                                                                          """Get all ctor MetaMethods."""
                                                                                                                                                                                                                                          count = self.item.constructorCount()
                                                                                                                                                                                                                                          return [core.MetaMethod(self.item.constructor(i)) for i in range(count)]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_properties(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          include_super: bool = True,
                                                                                                                                                                                                                                          only_writable: bool = False,
                                                                                                                                                                                                                                          only_stored: bool = False,
                                                                                                                                                                                                                                          only_bindable: bool = False,
                                                                                                                                                                                                                                          only_designable: bool = False,
                                                                                                                                                                                                                                          only_final: bool = False,
                                                                                                                                                                                                                                          only_required: bool = False,
                                                                                                                                                                                                                                          only_enum_type: bool = False,
                                                                                                                                                                                                                                          only_flag_type: bool = False,
                                                                                                                                                                                                                                          only_with_notifiers: bool = False,
                                                                                                                                                                                                                                          only_with_type_name: str = "",
                                                                                                                                                                                                                                      ) -> list[core.MetaProperty]:
                                                                                                                                                                                                                                          """Get all MetaProperties based on given criteria.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              include_super: Whether to include properties from parent classes,
                                                                                                                                                                                                                                              only_writable: Whether to filter for writable properties.
                                                                                                                                                                                                                                              only_stored: Whether to filter for stored properties.
                                                                                                                                                                                                                                              only_bindable: Whether to filter for bindable properties.
                                                                                                                                                                                                                                              only_designable: Whether to filter for designable properties.
                                                                                                                                                                                                                                              only_final: Whether to filter for final properties.
                                                                                                                                                                                                                                              only_required: Whether to filter for required properties.
                                                                                                                                                                                                                                              only_enum_type: Whether to filter for Enum type properties.
                                                                                                                                                                                                                                              only_flag_type: Whether to filter for Flag_type properties.
                                                                                                                                                                                                                                              only_with_notifiers: Whether to filter for properties with notifier.
                                                                                                                                                                                                                                              only_with_type_name: Only include properties with given give name as type.
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          start = 0 if include_super else self.item.propertyOffset()
                                                                                                                                                                                                                                          count = self.item.propertyCount()
                                                                                                                                                                                                                                          prop_list = []
                                                                                                                                                                                                                                          for i in range(start, count):
                                                                                                                                                                                                                                              prop = self.item.property(i)
                                                                                                                                                                                                                                              if (
                                                                                                                                                                                                                                                  (only_writable and not prop.isWritable())
                                                                                                                                                                                                                                                  or (only_stored and not prop.isStored())
                                                                                                                                                                                                                                                  or (only_bindable and not prop.isBindable())
                                                                                                                                                                                                                                                  or (only_designable and not prop.isDesignable())
                                                                                                                                                                                                                                                  or (only_final and not prop.isFinal())
                                                                                                                                                                                                                                                  or (only_required and not prop.isRequired())
                                                                                                                                                                                                                                                  or (only_enum_type and not prop.isEnumType())
                                                                                                                                                                                                                                                  or (only_flag_type and not prop.isFlagType())
                                                                                                                                                                                                                                                  or (only_with_notifiers and not prop.hasNotifySignal())
                                                                                                                                                                                                                                                  or (only_with_type_name and prop.typeName() != only_with_type_name)
                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                  continue
                                                                                                                                                                                                                                              prop_list.append(core.MetaProperty(prop))
                                                                                                                                                                                                                                          return prop_list
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_property_values(
                                                                                                                                                                                                                                          self, qobject: core.QObject, cast_types: bool = False
                                                                                                                                                                                                                                      ) -> dict[str, Any]:
                                                                                                                                                                                                                                          """Get a dictionary containing all MetaProperties values from given qobject.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              qobject: QObject to get properties from
                                                                                                                                                                                                                                              cast_types: Whether to cast types to PrettyQt classes.
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          vals = {prop.get_name(): prop.read(qobject) for prop in self.get_properties()}
                                                                                                                                                                                                                                          if cast_types:
                                                                                                                                                                                                                                              return {k: datatypes.make_serializable(v) for k, v in vals.items()}
                                                                                                                                                                                                                                          return vals
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_signals(
                                                                                                                                                                                                                                          self, include_super: bool = True, only_notifiers: bool = False
                                                                                                                                                                                                                                      ) -> list[core.MetaMethod]:
                                                                                                                                                                                                                                          """Get all signal MetaMethods based on given criteria.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              include_super: Whether to include Signals from parent classes
                                                                                                                                                                                                                                              only_notifiers: Whether to filter for property notifier signals
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          if only_notifiers:
                                                                                                                                                                                                                                              return [  # type: ignore
                                                                                                                                                                                                                                                  prop.get_notify_signal()
                                                                                                                                                                                                                                                  for prop in self.get_properties(include_super)
                                                                                                                                                                                                                                                  if prop.hasNotifySignal()
                                                                                                                                                                                                                                              ]
                                                                                                                                                                                                                                          return self.get_methods(include_super=include_super, type_filter="signal")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_slots(self, include_super: bool = True) -> list[core.MetaMethod]:
                                                                                                                                                                                                                                          """Get all slot MetaMethods based on given criteria.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              include_super: Whether to include Slots from parent classes
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return self.get_methods(include_super=include_super, type_filter="slot")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_plain_methods(self, include_super: bool = True) -> list[core.MetaMethod]:
                                                                                                                                                                                                                                          """Get all plain MetaMethods based on given criteria.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              include_super: Whether to include plain methods from parent classes
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return self.get_methods(include_super=include_super, type_filter="method")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_meta_type(self) -> core.MetaType:
                                                                                                                                                                                                                                          """Get Meta type of this MetaObject."""
                                                                                                                                                                                                                                          return core.MetaType(self.metaType().id())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_user_property(self) -> core.MetaProperty | None:
                                                                                                                                                                                                                                          """Get MetaProperty marked as userprop."""
                                                                                                                                                                                                                                          return core.MetaProperty(p) if (p := self.userProperty()).isValid() else None
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      # just experimenting
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def invoke_method(
                                                                                                                                                                                                                                          cls,
                                                                                                                                                                                                                                          obj: core.QObject,
                                                                                                                                                                                                                                          method: str,
                                                                                                                                                                                                                                          *args,
                                                                                                                                                                                                                                          connection_type: constants.ConnectionTypeStr = "auto",
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          conn = constants.CONNECTION_TYPE[connection_type]
                                                                                                                                                                                                                                          args = tuple(core.Q_ARG(type(arg), arg) for arg in args)
                                                                                                                                                                                                                                          return core.QMetaObject.invokeMethod(obj, method, conn, *args)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_new_instance(self, *args, **kwargs):
                                                                                                                                                                                                                                          args = tuple(core.Q_ARG(type(i), i) for i in args)
                                                                                                                                                                                                                                          kwargs = {k: core.Q_ARG(type(v), v) for k, v in kwargs.items()}
                                                                                                                                                                                                                                          # requires core.QGenericArgumentHolder for PySide6
                                                                                                                                                                                                                                          self.newInstance(*args, **kwargs)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def connect_signals(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          source_qobject: core.QObject,
                                                                                                                                                                                                                                          fn_or_qobject: Callable | core.QObject,
                                                                                                                                                                                                                                          only_notifiers: bool = False,
                                                                                                                                                                                                                                      ) -> list[core.QMetaObject.Connection]:
                                                                                                                                                                                                                                          """Connect all signals of a given qobject.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Either connect all signals to a function or connect each signal
                                                                                                                                                                                                                                          to the corresponding signal of the receiver.
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          handles = []
                                                                                                                                                                                                                                          for signal in self.get_signals(only_notifiers=only_notifiers):
                                                                                                                                                                                                                                              signal_name = signal.get_name()
                                                                                                                                                                                                                                              if not hasattr(source_qobject, signal_name):
                                                                                                                                                                                                                                                  # PyQt6 reports applicationNameChanged for QCoreApplication,
                                                                                                                                                                                                                                                  # but it doesnt exist...
                                                                                                                                                                                                                                                  logger.warning("Signal %r does not exist.", signal_name)
                                                                                                                                                                                                                                                  continue
                                                                                                                                                                                                                                              signal_instance = getattr(source_qobject, signal_name)
                                                                                                                                                                                                                                              slot = (
                                                                                                                                                                                                                                                  getattr(fn_or_qobject, signal_name)
                                                                                                                                                                                                                                                  if isinstance(fn_or_qobject, core.QObject)
                                                                                                                                                                                                                                                  else fn_or_qobject
                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                              handle = signal_instance.connect(slot)
                                                                                                                                                                                                                                              handles.append(handle)
                                                                                                                                                                                                                                          logger.debug("connected %s signals to %s.", len(handles), fn_or_qobject)
                                                                                                                                                                                                                                          return handles
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def copy(self, qobject: T, forward_signals: bool = True) -> T:
                                                                                                                                                                                                                                          """Create a copy of given QObject.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              qobject: QObject to create a copied instance for.
                                                                                                                                                                                                                                              forward_signals: Whether to connect all signals from qobject to the new
                                                                                                                                                                                                                                                               instance.
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              new = type(qobject)()
                                                                                                                                                                                                                                          except TypeError:
                                                                                                                                                                                                                                              # this should should cover most cases.
                                                                                                                                                                                                                                              new = type(qobject)(qobject.orientation())  # ty: ignore[missing-attribute]
                                                                                                                                                                                                                                          for prop in self.get_properties(only_writable=True):
                                                                                                                                                                                                                                              val = prop.read(qobject)
                                                                                                                                                                                                                                              prop.write(new, val)
                                                                                                                                                                                                                                          if forward_signals:
                                                                                                                                                                                                                                              self.connect_signals(new, qobject)
                                                                                                                                                                                                                                          logger.debug("copied %r", qobject)
                                                                                                                                                                                                                                          return new
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def copy_properties_to(cls, source: core.QObject, target: core.QObject):
                                                                                                                                                                                                                                          """Sets all properties of target to value of source.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Only sets properties which exist for both QObjects.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              source: Source QObject
                                                                                                                                                                                                                                              target: Target QObject
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          source_metaobj = cls(source.metaObject())
                                                                                                                                                                                                                                          target_metaobj = cls(target.metaObject())
                                                                                                                                                                                                                                          for prop in target_metaobj.get_properties(only_writable=True):
                                                                                                                                                                                                                                              if source_metaobj.has_property(prop_name := prop.get_name()):
                                                                                                                                                                                                                                                  target.setProperty(prop_name, source.property(prop_name))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_property_class_affiliations(self) -> dict[str, list[core.MetaProperty]]:
                                                                                                                                                                                                                                          """Get a mapping of class -> property affiliations."""
                                                                                                                                                                                                                                          mapper = {}
                                                                                                                                                                                                                                          metaclass = self
                                                                                                                                                                                                                                          while metaclass is not None:
                                                                                                                                                                                                                                              mapper[metaclass.get_name()] = [
                                                                                                                                                                                                                                                  metaclass.get_property(i)
                                                                                                                                                                                                                                                  for i in range(metaclass.propertyOffset(), metaclass.propertyCount())
                                                                                                                                                                                                                                              ]
                                                                                                                                                                                                                                              metaclass = metaclass.get_super_class()
                                                                                                                                                                                                                                          return mapper
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  connect_signals(source_qobject: core.QObject, fn_or_qobject: Callable | core.QObject, only_notifiers: bool = False) -> list[core.QMetaObject.Connection]

                                                                                                                                                                                                                                  Connect all signals of a given qobject.

                                                                                                                                                                                                                                  Either connect all signals to a function or connect each signal to the corresponding signal of the receiver.

                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def connect_signals(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      source_qobject: core.QObject,
                                                                                                                                                                                                                                      fn_or_qobject: Callable | core.QObject,
                                                                                                                                                                                                                                      only_notifiers: bool = False,
                                                                                                                                                                                                                                  ) -> list[core.QMetaObject.Connection]:
                                                                                                                                                                                                                                      """Connect all signals of a given qobject.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Either connect all signals to a function or connect each signal
                                                                                                                                                                                                                                      to the corresponding signal of the receiver.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      handles = []
                                                                                                                                                                                                                                      for signal in self.get_signals(only_notifiers=only_notifiers):
                                                                                                                                                                                                                                          signal_name = signal.get_name()
                                                                                                                                                                                                                                          if not hasattr(source_qobject, signal_name):
                                                                                                                                                                                                                                              # PyQt6 reports applicationNameChanged for QCoreApplication,
                                                                                                                                                                                                                                              # but it doesnt exist...
                                                                                                                                                                                                                                              logger.warning("Signal %r does not exist.", signal_name)
                                                                                                                                                                                                                                              continue
                                                                                                                                                                                                                                          signal_instance = getattr(source_qobject, signal_name)
                                                                                                                                                                                                                                          slot = (
                                                                                                                                                                                                                                              getattr(fn_or_qobject, signal_name)
                                                                                                                                                                                                                                              if isinstance(fn_or_qobject, core.QObject)
                                                                                                                                                                                                                                              else fn_or_qobject
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                          handle = signal_instance.connect(slot)
                                                                                                                                                                                                                                          handles.append(handle)
                                                                                                                                                                                                                                      logger.debug("connected %s signals to %s.", len(handles), fn_or_qobject)
                                                                                                                                                                                                                                      return handles
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  copy(qobject: T, forward_signals: bool = True) -> T

                                                                                                                                                                                                                                  Create a copy of given QObject.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  qobject T

                                                                                                                                                                                                                                  QObject to create a copied instance for.

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  forward_signals bool

                                                                                                                                                                                                                                  Whether to connect all signals from qobject to the new instance.

                                                                                                                                                                                                                                  True
                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def copy(self, qobject: T, forward_signals: bool = True) -> T:
                                                                                                                                                                                                                                      """Create a copy of given QObject.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          qobject: QObject to create a copied instance for.
                                                                                                                                                                                                                                          forward_signals: Whether to connect all signals from qobject to the new
                                                                                                                                                                                                                                                           instance.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          new = type(qobject)()
                                                                                                                                                                                                                                      except TypeError:
                                                                                                                                                                                                                                          # this should should cover most cases.
                                                                                                                                                                                                                                          new = type(qobject)(qobject.orientation())  # ty: ignore[missing-attribute]
                                                                                                                                                                                                                                      for prop in self.get_properties(only_writable=True):
                                                                                                                                                                                                                                          val = prop.read(qobject)
                                                                                                                                                                                                                                          prop.write(new, val)
                                                                                                                                                                                                                                      if forward_signals:
                                                                                                                                                                                                                                          self.connect_signals(new, qobject)
                                                                                                                                                                                                                                      logger.debug("copied %r", qobject)
                                                                                                                                                                                                                                      return new
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  copy_properties_to(source: core.QObject, target: core.QObject) classmethod

                                                                                                                                                                                                                                  Sets all properties of target to value of source.

                                                                                                                                                                                                                                  Only sets properties which exist for both QObjects.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  source QObject

                                                                                                                                                                                                                                  Source QObject

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  target QObject

                                                                                                                                                                                                                                  Target QObject

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  @classmethod
                                                                                                                                                                                                                                  def copy_properties_to(cls, source: core.QObject, target: core.QObject):
                                                                                                                                                                                                                                      """Sets all properties of target to value of source.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Only sets properties which exist for both QObjects.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          source: Source QObject
                                                                                                                                                                                                                                          target: Target QObject
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      source_metaobj = cls(source.metaObject())
                                                                                                                                                                                                                                      target_metaobj = cls(target.metaObject())
                                                                                                                                                                                                                                      for prop in target_metaobj.get_properties(only_writable=True):
                                                                                                                                                                                                                                          if source_metaobj.has_property(prop_name := prop.get_name()):
                                                                                                                                                                                                                                              target.setProperty(prop_name, source.property(prop_name))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_all_super_classes() -> list[MetaObject]

                                                                                                                                                                                                                                  Get SuperClass MetaObject.

                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_all_super_classes(self) -> list[MetaObject]:
                                                                                                                                                                                                                                      """Get SuperClass MetaObject."""
                                                                                                                                                                                                                                      klasses = []
                                                                                                                                                                                                                                      while klass := self.superClass():
                                                                                                                                                                                                                                          klasses.append(MetaObject(klass))
                                                                                                                                                                                                                                      return klasses
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_class_info(include_super: bool = True) -> dict[str, str]

                                                                                                                                                                                                                                  Get MetaObject class info.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  include_super bool

                                                                                                                                                                                                                                  Whether to include class info from parent classes.

                                                                                                                                                                                                                                  True
                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_class_info(self, include_super: bool = True) -> dict[str, str]:
                                                                                                                                                                                                                                      """Get MetaObject class info.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          include_super: Whether to include class info from parent classes.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      start = 0 if include_super else self.item.classInfoOffset()
                                                                                                                                                                                                                                      count = self.item.classInfoCount()
                                                                                                                                                                                                                                      classinfos = [self.item.classInfo(i) for i in range(start, count)]
                                                                                                                                                                                                                                      return {_to_str(i.name()): _to_str(i.value()) for i in classinfos}
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_constructor(index: int | str) -> core.MetaMethod

                                                                                                                                                                                                                                  Get ctor MetaMethod based on index or name.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  index int | str

                                                                                                                                                                                                                                  index or constructor name

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_constructor(self, index: int | str) -> core.MetaMethod:
                                                                                                                                                                                                                                      """Get ctor MetaMethod based on index or name.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          index: index or constructor name
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      if isinstance(index, int):
                                                                                                                                                                                                                                          method = core.MetaMethod(self.item.constructor(index))
                                                                                                                                                                                                                                          if not method.isValid():
                                                                                                                                                                                                                                              raise KeyError(index)
                                                                                                                                                                                                                                          return method
                                                                                                                                                                                                                                      for method in self.get_constructors():
                                                                                                                                                                                                                                          if method.get_name() in [index, helpers.to_lower_camel(index)]:
                                                                                                                                                                                                                                              return method
                                                                                                                                                                                                                                      raise KeyError(index)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_constructors() -> list[core.MetaMethod]

                                                                                                                                                                                                                                  Get all ctor MetaMethods.

                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_constructors(self) -> list[core.MetaMethod]:
                                                                                                                                                                                                                                      """Get all ctor MetaMethods."""
                                                                                                                                                                                                                                      count = self.item.constructorCount()
                                                                                                                                                                                                                                      return [core.MetaMethod(self.item.constructor(i)) for i in range(count)]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_enum(index: int | str) -> core.MetaEnum

                                                                                                                                                                                                                                  Get MetaEnum based on index or name.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  index int | str

                                                                                                                                                                                                                                  index or Enum name

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_enum(self, index: int | str) -> core.MetaEnum:
                                                                                                                                                                                                                                      """Get MetaEnum based on index or name.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          index: index or Enum name
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      if isinstance(index, int):
                                                                                                                                                                                                                                          enum = core.MetaEnum(self.item.enumerator(index))
                                                                                                                                                                                                                                          if not enum.isValid():
                                                                                                                                                                                                                                              raise KeyError(index)
                                                                                                                                                                                                                                          return enum
                                                                                                                                                                                                                                      for enumerator in self.get_enums():
                                                                                                                                                                                                                                          if enumerator.get_name() in [index, helpers.to_lower_camel(index)]:
                                                                                                                                                                                                                                              return enumerator
                                                                                                                                                                                                                                      raise KeyError(index)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_enums(include_super: bool = True) -> list[core.MetaEnum]

                                                                                                                                                                                                                                  Get all MetaEnums based on given criteria.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  include_super bool

                                                                                                                                                                                                                                  Whether to include Enums from parent classes.

                                                                                                                                                                                                                                  True
                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_enums(self, include_super: bool = True) -> list[core.MetaEnum]:
                                                                                                                                                                                                                                      """Get all MetaEnums based on given criteria.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          include_super: Whether to include Enums from parent classes.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      start = 0 if include_super else self.item.enumeratorOffset()
                                                                                                                                                                                                                                      return [self.get_enum(i) for i in range(start, self.item.enumeratorCount())]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_meta_type() -> core.MetaType

                                                                                                                                                                                                                                  Get Meta type of this MetaObject.

                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_meta_type(self) -> core.MetaType:
                                                                                                                                                                                                                                      """Get Meta type of this MetaObject."""
                                                                                                                                                                                                                                      return core.MetaType(self.metaType().id())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_method(index: int | str) -> core.MetaMethod

                                                                                                                                                                                                                                  Get MetaMethod based on index or name.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  index int | str

                                                                                                                                                                                                                                  index or method name

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_method(self, index: int | str) -> core.MetaMethod:
                                                                                                                                                                                                                                      """Get MetaMethod based on index or name.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          index: index or method name
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      if isinstance(index, int):
                                                                                                                                                                                                                                          method = core.MetaMethod(self.item.method(index))
                                                                                                                                                                                                                                          if not method.isValid():
                                                                                                                                                                                                                                              raise KeyError(index)
                                                                                                                                                                                                                                          return method
                                                                                                                                                                                                                                      for method in self.get_methods():
                                                                                                                                                                                                                                          if method.get_name() in [index, helpers.to_lower_camel(index)]:
                                                                                                                                                                                                                                              return method
                                                                                                                                                                                                                                      raise KeyError(index)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_methods(include_super: bool = True, type_filter: core.metamethod.MethodTypeStr | None = None, filter_internal: bool = True) -> list[core.MetaMethod]

                                                                                                                                                                                                                                  Get all MetaMethods based on given criteria.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  include_super bool

                                                                                                                                                                                                                                  Whether to include Methods from parent classes

                                                                                                                                                                                                                                  True
                                                                                                                                                                                                                                  type_filter MethodTypeStr | None

                                                                                                                                                                                                                                  Method type to filter for.

                                                                                                                                                                                                                                  None
                                                                                                                                                                                                                                  filter_internal bool

                                                                                                                                                                                                                                  Filter Qt-internal methods

                                                                                                                                                                                                                                  True
                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_methods(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      include_super: bool = True,
                                                                                                                                                                                                                                      type_filter: core.metamethod.MethodTypeStr | None = None,
                                                                                                                                                                                                                                      filter_internal: bool = True,
                                                                                                                                                                                                                                  ) -> list[core.MetaMethod]:
                                                                                                                                                                                                                                      """Get all MetaMethods based on given criteria.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          include_super: Whether to include Methods from parent classes
                                                                                                                                                                                                                                          type_filter: Method type to filter for.
                                                                                                                                                                                                                                          filter_internal: Filter Qt-internal methods
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      start = 0 if include_super else self.item.methodOffset()
                                                                                                                                                                                                                                      methods = [
                                                                                                                                                                                                                                          method
                                                                                                                                                                                                                                          for i in range(start, self.item.methodCount())
                                                                                                                                                                                                                                          if not (method := self.get_method(i)).get_name().startswith("_q_")
                                                                                                                                                                                                                                          or not filter_internal
                                                                                                                                                                                                                                      ]
                                                                                                                                                                                                                                      if type_filter is None:
                                                                                                                                                                                                                                          return methods
                                                                                                                                                                                                                                      return [i for i in methods if i.get_method_type() == type_filter]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_name() -> str

                                                                                                                                                                                                                                  Get MetaObject class name.

                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_name(self) -> str:
                                                                                                                                                                                                                                      """Get MetaObject class name."""
                                                                                                                                                                                                                                      return self.className()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_plain_methods(include_super: bool = True) -> list[core.MetaMethod]

                                                                                                                                                                                                                                  Get all plain MetaMethods based on given criteria.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  include_super bool

                                                                                                                                                                                                                                  Whether to include plain methods from parent classes

                                                                                                                                                                                                                                  True
                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_plain_methods(self, include_super: bool = True) -> list[core.MetaMethod]:
                                                                                                                                                                                                                                      """Get all plain MetaMethods based on given criteria.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          include_super: Whether to include plain methods from parent classes
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return self.get_methods(include_super=include_super, type_filter="method")
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_properties(include_super: bool = True, only_writable: bool = False, only_stored: bool = False, only_bindable: bool = False, only_designable: bool = False, only_final: bool = False, only_required: bool = False, only_enum_type: bool = False, only_flag_type: bool = False, only_with_notifiers: bool = False, only_with_type_name: str = '') -> list[core.MetaProperty]

                                                                                                                                                                                                                                  Get all MetaProperties based on given criteria.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  include_super bool

                                                                                                                                                                                                                                  Whether to include properties from parent classes,

                                                                                                                                                                                                                                  True
                                                                                                                                                                                                                                  only_writable bool

                                                                                                                                                                                                                                  Whether to filter for writable properties.

                                                                                                                                                                                                                                  False
                                                                                                                                                                                                                                  only_stored bool

                                                                                                                                                                                                                                  Whether to filter for stored properties.

                                                                                                                                                                                                                                  False
                                                                                                                                                                                                                                  only_bindable bool

                                                                                                                                                                                                                                  Whether to filter for bindable properties.

                                                                                                                                                                                                                                  False
                                                                                                                                                                                                                                  only_designable bool

                                                                                                                                                                                                                                  Whether to filter for designable properties.

                                                                                                                                                                                                                                  False
                                                                                                                                                                                                                                  only_final bool

                                                                                                                                                                                                                                  Whether to filter for final properties.

                                                                                                                                                                                                                                  False
                                                                                                                                                                                                                                  only_required bool

                                                                                                                                                                                                                                  Whether to filter for required properties.

                                                                                                                                                                                                                                  False
                                                                                                                                                                                                                                  only_enum_type bool

                                                                                                                                                                                                                                  Whether to filter for Enum type properties.

                                                                                                                                                                                                                                  False
                                                                                                                                                                                                                                  only_flag_type bool

                                                                                                                                                                                                                                  Whether to filter for Flag_type properties.

                                                                                                                                                                                                                                  False
                                                                                                                                                                                                                                  only_with_notifiers bool

                                                                                                                                                                                                                                  Whether to filter for properties with notifier.

                                                                                                                                                                                                                                  False
                                                                                                                                                                                                                                  only_with_type_name str

                                                                                                                                                                                                                                  Only include properties with given give name as type.

                                                                                                                                                                                                                                  ''
                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_properties(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      include_super: bool = True,
                                                                                                                                                                                                                                      only_writable: bool = False,
                                                                                                                                                                                                                                      only_stored: bool = False,
                                                                                                                                                                                                                                      only_bindable: bool = False,
                                                                                                                                                                                                                                      only_designable: bool = False,
                                                                                                                                                                                                                                      only_final: bool = False,
                                                                                                                                                                                                                                      only_required: bool = False,
                                                                                                                                                                                                                                      only_enum_type: bool = False,
                                                                                                                                                                                                                                      only_flag_type: bool = False,
                                                                                                                                                                                                                                      only_with_notifiers: bool = False,
                                                                                                                                                                                                                                      only_with_type_name: str = "",
                                                                                                                                                                                                                                  ) -> list[core.MetaProperty]:
                                                                                                                                                                                                                                      """Get all MetaProperties based on given criteria.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          include_super: Whether to include properties from parent classes,
                                                                                                                                                                                                                                          only_writable: Whether to filter for writable properties.
                                                                                                                                                                                                                                          only_stored: Whether to filter for stored properties.
                                                                                                                                                                                                                                          only_bindable: Whether to filter for bindable properties.
                                                                                                                                                                                                                                          only_designable: Whether to filter for designable properties.
                                                                                                                                                                                                                                          only_final: Whether to filter for final properties.
                                                                                                                                                                                                                                          only_required: Whether to filter for required properties.
                                                                                                                                                                                                                                          only_enum_type: Whether to filter for Enum type properties.
                                                                                                                                                                                                                                          only_flag_type: Whether to filter for Flag_type properties.
                                                                                                                                                                                                                                          only_with_notifiers: Whether to filter for properties with notifier.
                                                                                                                                                                                                                                          only_with_type_name: Only include properties with given give name as type.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      start = 0 if include_super else self.item.propertyOffset()
                                                                                                                                                                                                                                      count = self.item.propertyCount()
                                                                                                                                                                                                                                      prop_list = []
                                                                                                                                                                                                                                      for i in range(start, count):
                                                                                                                                                                                                                                          prop = self.item.property(i)
                                                                                                                                                                                                                                          if (
                                                                                                                                                                                                                                              (only_writable and not prop.isWritable())
                                                                                                                                                                                                                                              or (only_stored and not prop.isStored())
                                                                                                                                                                                                                                              or (only_bindable and not prop.isBindable())
                                                                                                                                                                                                                                              or (only_designable and not prop.isDesignable())
                                                                                                                                                                                                                                              or (only_final and not prop.isFinal())
                                                                                                                                                                                                                                              or (only_required and not prop.isRequired())
                                                                                                                                                                                                                                              or (only_enum_type and not prop.isEnumType())
                                                                                                                                                                                                                                              or (only_flag_type and not prop.isFlagType())
                                                                                                                                                                                                                                              or (only_with_notifiers and not prop.hasNotifySignal())
                                                                                                                                                                                                                                              or (only_with_type_name and prop.typeName() != only_with_type_name)
                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                              continue
                                                                                                                                                                                                                                          prop_list.append(core.MetaProperty(prop))
                                                                                                                                                                                                                                      return prop_list
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_property(index: int | str) -> core.MetaProperty

                                                                                                                                                                                                                                  Get MetaProperty based on index or name.

                                                                                                                                                                                                                                  Only returns non-dynamic properties.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  index int | str

                                                                                                                                                                                                                                  index or property name

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_property(self, index: int | str) -> core.MetaProperty:
                                                                                                                                                                                                                                      """Get MetaProperty based on index or name.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Only returns non-dynamic properties.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          index: index or property name
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      if isinstance(index, int):
                                                                                                                                                                                                                                          prop = core.MetaProperty(self.item.property(index))
                                                                                                                                                                                                                                          if not prop.isValid():
                                                                                                                                                                                                                                              raise KeyError(index)
                                                                                                                                                                                                                                          return prop
                                                                                                                                                                                                                                      for prop in self.get_properties():
                                                                                                                                                                                                                                          if prop.get_name() in [index, helpers.to_lower_camel(index)]:
                                                                                                                                                                                                                                              return prop
                                                                                                                                                                                                                                      raise KeyError(index)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_property_class_affiliations() -> dict[str, list[core.MetaProperty]]

                                                                                                                                                                                                                                  Get a mapping of class -> property affiliations.

                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_property_class_affiliations(self) -> dict[str, list[core.MetaProperty]]:
                                                                                                                                                                                                                                      """Get a mapping of class -> property affiliations."""
                                                                                                                                                                                                                                      mapper = {}
                                                                                                                                                                                                                                      metaclass = self
                                                                                                                                                                                                                                      while metaclass is not None:
                                                                                                                                                                                                                                          mapper[metaclass.get_name()] = [
                                                                                                                                                                                                                                              metaclass.get_property(i)
                                                                                                                                                                                                                                              for i in range(metaclass.propertyOffset(), metaclass.propertyCount())
                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                          metaclass = metaclass.get_super_class()
                                                                                                                                                                                                                                      return mapper
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_property_values(qobject: core.QObject, cast_types: bool = False) -> dict[str, Any]

                                                                                                                                                                                                                                  Get a dictionary containing all MetaProperties values from given qobject.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  qobject QObject

                                                                                                                                                                                                                                  QObject to get properties from

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  cast_types bool

                                                                                                                                                                                                                                  Whether to cast types to PrettyQt classes.

                                                                                                                                                                                                                                  False
                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_property_values(
                                                                                                                                                                                                                                      self, qobject: core.QObject, cast_types: bool = False
                                                                                                                                                                                                                                  ) -> dict[str, Any]:
                                                                                                                                                                                                                                      """Get a dictionary containing all MetaProperties values from given qobject.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          qobject: QObject to get properties from
                                                                                                                                                                                                                                          cast_types: Whether to cast types to PrettyQt classes.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      vals = {prop.get_name(): prop.read(qobject) for prop in self.get_properties()}
                                                                                                                                                                                                                                      if cast_types:
                                                                                                                                                                                                                                          return {k: datatypes.make_serializable(v) for k, v in vals.items()}
                                                                                                                                                                                                                                      return vals
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_signals(include_super: bool = True, only_notifiers: bool = False) -> list[core.MetaMethod]

                                                                                                                                                                                                                                  Get all signal MetaMethods based on given criteria.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  include_super bool

                                                                                                                                                                                                                                  Whether to include Signals from parent classes

                                                                                                                                                                                                                                  True
                                                                                                                                                                                                                                  only_notifiers bool

                                                                                                                                                                                                                                  Whether to filter for property notifier signals

                                                                                                                                                                                                                                  False
                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_signals(
                                                                                                                                                                                                                                      self, include_super: bool = True, only_notifiers: bool = False
                                                                                                                                                                                                                                  ) -> list[core.MetaMethod]:
                                                                                                                                                                                                                                      """Get all signal MetaMethods based on given criteria.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          include_super: Whether to include Signals from parent classes
                                                                                                                                                                                                                                          only_notifiers: Whether to filter for property notifier signals
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      if only_notifiers:
                                                                                                                                                                                                                                          return [  # type: ignore
                                                                                                                                                                                                                                              prop.get_notify_signal()
                                                                                                                                                                                                                                              for prop in self.get_properties(include_super)
                                                                                                                                                                                                                                              if prop.hasNotifySignal()
                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                      return self.get_methods(include_super=include_super, type_filter="signal")
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_slots(include_super: bool = True) -> list[core.MetaMethod]

                                                                                                                                                                                                                                  Get all slot MetaMethods based on given criteria.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  include_super bool

                                                                                                                                                                                                                                  Whether to include Slots from parent classes

                                                                                                                                                                                                                                  True
                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_slots(self, include_super: bool = True) -> list[core.MetaMethod]:
                                                                                                                                                                                                                                      """Get all slot MetaMethods based on given criteria.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          include_super: Whether to include Slots from parent classes
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return self.get_methods(include_super=include_super, type_filter="slot")
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_super_class() -> MetaObject | None

                                                                                                                                                                                                                                  Get SuperClass MetaObject.

                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_super_class(self) -> MetaObject | None:
                                                                                                                                                                                                                                      """Get SuperClass MetaObject."""
                                                                                                                                                                                                                                      return MetaObject(klass) if (klass := self.superClass()) is not None else None
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_user_property() -> core.MetaProperty | None

                                                                                                                                                                                                                                  Get MetaProperty marked as userprop.

                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def get_user_property(self) -> core.MetaProperty | None:
                                                                                                                                                                                                                                      """Get MetaProperty marked as userprop."""
                                                                                                                                                                                                                                      return core.MetaProperty(p) if (p := self.userProperty()).isValid() else None
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  has_property(name: str)

                                                                                                                                                                                                                                  Check if a property with given name exists.

                                                                                                                                                                                                                                  Only checks for non-dynamic properties.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  name str

                                                                                                                                                                                                                                  property name

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/metaobject.py
                                                                                                                                                                                                                                  def has_property(self, name: str):
                                                                                                                                                                                                                                      """Check if a property with given name exists.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Only checks for non-dynamic properties.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          name: property name
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          self.get_property(name)
                                                                                                                                                                                                                                      except KeyError:
                                                                                                                                                                                                                                          return False
                                                                                                                                                                                                                                      else:
                                                                                                                                                                                                                                          return True
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  MetaProperty

                                                                                                                                                                                                                                  Meta-data about a property.

                                                                                                                                                                                                                                  Source code in prettyqt/core/metaproperty.py
                                                                                                                                                                                                                                  class MetaProperty:
                                                                                                                                                                                                                                      """Meta-data about a property."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, metaproperty: core.QMetaProperty):
                                                                                                                                                                                                                                          self.item = metaproperty
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return self.item.isValid()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.get_name())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getattr__(self, val):
                                                                                                                                                                                                                                          return getattr(self.item, val)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_name(self) -> str:
                                                                                                                                                                                                                                          return self.item.name()  # type: ignore
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_meta_type(self) -> core.MetaType:
                                                                                                                                                                                                                                          return core.MetaType(self.userType())  # same as self.metaType().id()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_python_type(self) -> type:
                                                                                                                                                                                                                                          return self.get_meta_type().get_type()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_notify_signal(self) -> core.MetaMethod | None:
                                                                                                                                                                                                                                          if (signal := self.notifySignal()).isValid():
                                                                                                                                                                                                                                              return core.MetaMethod(signal)
                                                                                                                                                                                                                                          return None
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_enumerator(self) -> core.MetaEnum | None:
                                                                                                                                                                                                                                          if (enumerator := self.enumerator()).isValid():
                                                                                                                                                                                                                                              return core.MetaEnum(enumerator)
                                                                                                                                                                                                                                          return None
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_enumerator_type(self) -> Literal["flag", "enum"] | None:
                                                                                                                                                                                                                                          if self.isFlagType():
                                                                                                                                                                                                                                              return "flag"
                                                                                                                                                                                                                                          if self.isEnumType():
                                                                                                                                                                                                                                              return "enum"
                                                                                                                                                                                                                                          return None
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  MetaType

                                                                                                                                                                                                                                  Bases: QMetaType

                                                                                                                                                                                                                                  Manages named types in the meta-object system.

                                                                                                                                                                                                                                  Source code in prettyqt/core/metatype.py
                                                                                                                                                                                                                                  class MetaType(QtCore.QMetaType):
                                                                                                                                                                                                                                      """Manages named types in the meta-object system."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return self.isValid()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.get_name())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_regular_types(cls):
                                                                                                                                                                                                                                          return [
                                                                                                                                                                                                                                              meta for i in range(TYPE_END_INDEX + 1) if (meta := MetaType(i)).isValid()
                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_enum_types(cls):
                                                                                                                                                                                                                                          return [
                                                                                                                                                                                                                                              meta
                                                                                                                                                                                                                                              for i in range(ENUM_START_INDEX, ENUM_END_INDEX + 1)
                                                                                                                                                                                                                                              if (meta := MetaType(i)).isValid()
                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_name(self) -> str | None:
                                                                                                                                                                                                                                          # PyQt6 returns bytes, PySide6 str.
                                                                                                                                                                                                                                          name = self.name()
                                                                                                                                                                                                                                          if name is None:
                                                                                                                                                                                                                                              return None
                                                                                                                                                                                                                                          return name if isinstance(name, str) else bytes(name).decode()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_type_name(self) -> str:
                                                                                                                                                                                                                                          return TYPE.inverse[QtCore.QMetaType.Type(self.id())]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def is_enumeration(self) -> bool:
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              flags = self.flags()
                                                                                                                                                                                                                                          except ValueError:
                                                                                                                                                                                                                                              # PyQt raises for flag bits it doesnt know about (happens for some
                                                                                                                                                                                                                                              # QtGui types like QFont / QPalette), those are no enumerations.
                                                                                                                                                                                                                                              return False
                                                                                                                                                                                                                                          return bool(flags & QtCore.QMetaType.TypeFlag.IsEnumeration)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      # def get_meta_object(self) -> core.MetaObject:  # apparently doesnt exist in bindings
                                                                                                                                                                                                                                      #     return core.MetaObject(self.metaObject())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      # @classmethod  # and this one gives deprecated message
                                                                                                                                                                                                                                      # def get_meta_object_for_type(cls, typ: int) -> core.MetaObject:
                                                                                                                                                                                                                                      #     return core.MetaObject(cls.metaObjectForType(typ))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_type(self) -> type:  # noqa: PLR0911
                                                                                                                                                                                                                                          meta_type = QtCore.QMetaType.Type(self.id())
                                                                                                                                                                                                                                          match meta_type:
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.Bool:
                                                                                                                                                                                                                                                  return bool
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.Int | QtCore.QMetaType.Type.UInt:
                                                                                                                                                                                                                                                  return int
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.Double | QtCore.QMetaType.Type.Float:
                                                                                                                                                                                                                                                  return float
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QChar | QtCore.QMetaType.Type.QString:
                                                                                                                                                                                                                                                  return str
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QByteArray:
                                                                                                                                                                                                                                                  return bytes
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QVariantList | QtCore.QMetaType.Type.QStringList:
                                                                                                                                                                                                                                                  return list
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QVariantMap:
                                                                                                                                                                                                                                                  return dict
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QSize:
                                                                                                                                                                                                                                                  return QtCore.QSize
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QSizeF:
                                                                                                                                                                                                                                                  return QtCore.QSizeF
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QTime:
                                                                                                                                                                                                                                                  return QtCore.QTime
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QDate:
                                                                                                                                                                                                                                                  return QtCore.QDate
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QDateTime:
                                                                                                                                                                                                                                                  return QtCore.QDateTime
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QRect:
                                                                                                                                                                                                                                                  return QtCore.QRect
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QRectF:
                                                                                                                                                                                                                                                  return QtCore.QRectF
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QLine:
                                                                                                                                                                                                                                                  return QtCore.QLine
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QLineF:
                                                                                                                                                                                                                                                  return QtCore.QLineF
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QPoint:
                                                                                                                                                                                                                                                  return QtCore.QPoint
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QPointF:
                                                                                                                                                                                                                                                  return QtCore.QPointF
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QRegularExpression:
                                                                                                                                                                                                                                                  return QtCore.QRegularExpression
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QLocale:
                                                                                                                                                                                                                                                  return QtCore.QLocale
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QUrl:
                                                                                                                                                                                                                                                  return QtCore.QUrl
                                                                                                                                                                                                                                              case _ if self.is_enumeration():
                                                                                                                                                                                                                                                  return enum.Enum
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          from prettyqt.qt import QtGui
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          match meta_type:
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QPolygon:
                                                                                                                                                                                                                                                  return QtGui.QPolygon
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QPolygonF:
                                                                                                                                                                                                                                                  return QtGui.QPolygonF
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QTextLength:
                                                                                                                                                                                                                                                  return QtGui.QTextLength
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QRegion:
                                                                                                                                                                                                                                                  return QtGui.QRegion
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QPalette:
                                                                                                                                                                                                                                                  return QtGui.QPalette
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QColor:
                                                                                                                                                                                                                                                  return QtGui.QColor
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QPen:
                                                                                                                                                                                                                                                  return QtGui.QPen
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QFont:
                                                                                                                                                                                                                                                  return QtGui.QFont
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QBrush:
                                                                                                                                                                                                                                                  return QtGui.QBrush
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QImage:
                                                                                                                                                                                                                                                  return QtGui.QImage
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QPixmap:
                                                                                                                                                                                                                                                  return QtGui.QPixmap
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QTransform:
                                                                                                                                                                                                                                                  return QtGui.QTransform
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QKeySequence:
                                                                                                                                                                                                                                                  return QtGui.QKeySequence
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QVector3D:
                                                                                                                                                                                                                                                  return QtGui.QVector3D
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QVector4D:
                                                                                                                                                                                                                                                  return QtGui.QVector4D
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QCursor:
                                                                                                                                                                                                                                                  return QtGui.QCursor
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QIcon:
                                                                                                                                                                                                                                                  return QtGui.QIcon
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QVariant:
                                                                                                                                                                                                                                                  return object
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QEasingCurve:
                                                                                                                                                                                                                                                  return QtCore.QEasingCurve
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QObjectStar:
                                                                                                                                                                                                                                                  return QtCore.QObject
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          from prettyqt.qt import QtWidgets
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          match meta_type:
                                                                                                                                                                                                                                              case QtCore.QMetaType.Type.QSizePolicy:
                                                                                                                                                                                                                                                  return QtWidgets.QSizePolicy
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  return object
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  MicrophonePermission

                                                                                                                                                                                                                                  Bases: QMicrophonePermission

                                                                                                                                                                                                                                  Access the microphone for monitoring or recording sound.

                                                                                                                                                                                                                                  Source code in prettyqt/core/microphonepermission.py
                                                                                                                                                                                                                                  class MicrophonePermission(QtCore.QMicrophonePermission):
                                                                                                                                                                                                                                      """Access the microphone for monitoring or recording sound."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  MimeData

                                                                                                                                                                                                                                  Bases: ObjectMixin, QMimeData

                                                                                                                                                                                                                                  Container for data that records information about its MIME type.

                                                                                                                                                                                                                                  Source code in prettyqt/core/mimedata.py
                                                                                                                                                                                                                                  class MimeData(core.ObjectMixin, core.QMimeData):
                                                                                                                                                                                                                                      """Container for data that records information about its MIME type."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __len__(self):
                                                                                                                                                                                                                                          return len(self.formats())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      # def __getitem__(self, index: str) -> str:
                                                                                                                                                                                                                                      #     return self.get_data(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      # def __setitem__(self, index: str, value: datatypes.ByteArrayType):
                                                                                                                                                                                                                                      #     value = datatypes.to_bytearray(value)
                                                                                                                                                                                                                                      #     self.setData(index, value)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __contains__(self, fmt: str):
                                                                                                                                                                                                                                          return self.hasFormat(fmt)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __delitem__(self, index: str):
                                                                                                                                                                                                                                          self.removeFormat(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_data(self, mime_type: str, data: str):
                                                                                                                                                                                                                                          self.setData(mime_type, core.QByteArray(data.encode()))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_json_data(self, mime_type: str, data: datatypes.JSONType):
                                                                                                                                                                                                                                          bytes_ = anyenv.dump_json(data).encode()
                                                                                                                                                                                                                                          self.setData(mime_type, core.QByteArray(bytes_))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_data(self, mime_type: str) -> str:
                                                                                                                                                                                                                                          return bytes(self.data(mime_type).data()).decode()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_json_data(self, mime_type: str) -> datatypes.JSONType:
                                                                                                                                                                                                                                          data = self.data(mime_type)
                                                                                                                                                                                                                                          return anyenv.load_json(bytes(data.data()))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def keys(self) -> list[str]:
                                                                                                                                                                                                                                          return self.formats()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def values(self) -> Iterator[Any]:
                                                                                                                                                                                                                                          return (self.get_data(key) for key in self.formats())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_data_for_extension(self, extension: str, string: str):
                                                                                                                                                                                                                                          if mimetype := DB.get_mime_types_for_filename(f".{extension}"):
                                                                                                                                                                                                                                              self.setData(mimetype[0].name(), string.encode())
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              raise ValueError(extension)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_path_data(self, paths: Iterable[datatypes.PathType]):
                                                                                                                                                                                                                                          urls = [core.Url.from_local_file(p) for p in paths]
                                                                                                                                                                                                                                          self.setUrls(urls)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_urls(self, paths: Iterable[datatypes.PathType]):
                                                                                                                                                                                                                                          urls = [core.Url(p) for p in paths]
                                                                                                                                                                                                                                          self.setUrls(urls)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_urls(self) -> list[core.Url]:
                                                                                                                                                                                                                                          return [core.Url(url) for url in self.urls()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def for_file(
                                                                                                                                                                                                                                          cls,
                                                                                                                                                                                                                                          path: datatypes.PathType | core.QFileInfo,
                                                                                                                                                                                                                                          match_mode: core.mimedatabase.MatchModeStr = "default",
                                                                                                                                                                                                                                      ) -> MimeData:
                                                                                                                                                                                                                                          db = core.MimeDatabase()
                                                                                                                                                                                                                                          mime_type = db.get_mime_type_for_file(path, match_mode)
                                                                                                                                                                                                                                          return cls(mime_type)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def to_dict(self) -> dict[str, bytes]:
                                                                                                                                                                                                                                          return {i: bytes(self.data(i).data()) for i in self.formats()}
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def clone(cls, other: core.QMimeData) -> Self:
                                                                                                                                                                                                                                          mime = cls()
                                                                                                                                                                                                                                          for fmt in other.formats():
                                                                                                                                                                                                                                              mime.setData(fmt, other.data(fmt))
                                                                                                                                                                                                                                          return mime
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  MimeDatabase

                                                                                                                                                                                                                                  Bases: QMimeDatabase

                                                                                                                                                                                                                                  Maintains a database of MIME types.

                                                                                                                                                                                                                                  Source code in prettyqt/core/mimedatabase.py
                                                                                                                                                                                                                                  class MimeDatabase(core.QMimeDatabase):
                                                                                                                                                                                                                                      """Maintains a database of MIME types."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_mime_type_for_file(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          path: datatypes.PathType | core.QFileInfo,
                                                                                                                                                                                                                                          match_mode: MatchModeStr | core.QMimeDatabase.MatchMode = "default",
                                                                                                                                                                                                                                      ) -> core.MimeType:
                                                                                                                                                                                                                                          if isinstance(path, os.PathLike):
                                                                                                                                                                                                                                              path = os.fspath(path)
                                                                                                                                                                                                                                          mime_type = self.mimeTypeForFile(path, MATCH_MODE.get_enum_value(match_mode))
                                                                                                                                                                                                                                          return core.MimeType(mime_type)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_mime_type_for_data(
                                                                                                                                                                                                                                          self, data: datatypes.ByteArrayType | core.QIODevice
                                                                                                                                                                                                                                      ) -> core.MimeType:
                                                                                                                                                                                                                                          if not isinstance(data, core.QIODevice):
                                                                                                                                                                                                                                              data = datatypes.to_bytearray(data)
                                                                                                                                                                                                                                          return core.MimeType(self.mimeTypeForData(data))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_mime_type_for_filename_and_data(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          filename: str | os.PathLike[str],
                                                                                                                                                                                                                                          data: datatypes.ByteArrayType | core.QIODevice,
                                                                                                                                                                                                                                      ) -> core.MimeType:
                                                                                                                                                                                                                                          path = os.fspath(filename)
                                                                                                                                                                                                                                          if not isinstance(data, core.QIODevice):
                                                                                                                                                                                                                                              data = datatypes.to_bytearray(data)
                                                                                                                                                                                                                                          return core.MimeType(self.mimeTypeForFileNameAndData(path, data))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_mime_type_for_name(self, name: str) -> core.MimeType:
                                                                                                                                                                                                                                          return core.MimeType(self.mimeTypeForName(name))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_mime_type_for_url(self, url: core.QUrl | str) -> core.MimeType:
                                                                                                                                                                                                                                          url = core.QUrl(url) if isinstance(url, str) else url
                                                                                                                                                                                                                                          return core.MimeType(self.mimeTypeForUrl(url))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_mime_types_for_filename(
                                                                                                                                                                                                                                          self, filename: datatypes.PathType
                                                                                                                                                                                                                                      ) -> list[core.MimeType]:
                                                                                                                                                                                                                                          path = os.fspath(filename)
                                                                                                                                                                                                                                          return [core.MimeType(i) for i in self.mimeTypesForFileName(path)]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  MimeType

                                                                                                                                                                                                                                  Bases: QMimeType

                                                                                                                                                                                                                                  Describes types of file or data, represented by a MIME type string.

                                                                                                                                                                                                                                  Source code in prettyqt/core/mimetype.py
                                                                                                                                                                                                                                  class MimeType(QtCore.QMimeType):
                                                                                                                                                                                                                                      """Describes types of file or data, represented by a MIME type string."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return self.isValid()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.name())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return self.name()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  ModelRoleData

                                                                                                                                                                                                                                  Bases: QModelRoleData

                                                                                                                                                                                                                                  Holds a role and the data associated to that role.

                                                                                                                                                                                                                                  Source code in prettyqt/core/modelroledata.py
                                                                                                                                                                                                                                  class ModelRoleData(QtCore.QModelRoleData):
                                                                                                                                                                                                                                      """Holds a role and the data associated to that role."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Mutex

                                                                                                                                                                                                                                  Bases: QMutex

                                                                                                                                                                                                                                  Access serialization between threads.

                                                                                                                                                                                                                                  Source code in prettyqt/core/mutex.py
                                                                                                                                                                                                                                  class Mutex(QtCore.QMutex):
                                                                                                                                                                                                                                      """Access serialization between threads."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def lock_mutex(self, timeout: int | None = None):
                                                                                                                                                                                                                                          if timeout is None:
                                                                                                                                                                                                                                              timeout = -1
                                                                                                                                                                                                                                          acquired = self.tryLock(timeout)
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield acquired
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              if acquired:
                                                                                                                                                                                                                                                  self.unlock()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  NativeIpcKey

                                                                                                                                                                                                                                  Bases: QNativeIpcKey

                                                                                                                                                                                                                                  Holds a native key used by QSystemSemaphore and QSharedMemory.

                                                                                                                                                                                                                                  Source code in prettyqt/core/nativeipckey.py
                                                                                                                                                                                                                                  class NativeIpcKey(QtCore.QNativeIpcKey):
                                                                                                                                                                                                                                      """Holds a native key used by QSystemSemaphore and QSharedMemory."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          key: str | QtCore.QNativeIpcKey = "",
                                                                                                                                                                                                                                          typ: TypeStr | QtCore.QNativeIpcKey.Type | None = None,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          if isinstance(key, QtCore.QNativeIpcKey) or typ is None:
                                                                                                                                                                                                                                              super().__init__(key)
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              super().__init__(key, TYPE.get_enum_value(typ))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.nativeKey(), self.get_type())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return self.toString()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return self.isValid()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_type(self, typ: TypeStr | QtCore.QNativeIpcKey.Type):
                                                                                                                                                                                                                                          """Set the IPC key type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              typ: IPC key type to use
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setType(TYPE.get_enum_value(typ))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_type(self) -> TypeStr:
                                                                                                                                                                                                                                          """Return the IPC key type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              IPC key type
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return TYPE.inverse[self.type()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def from_string(cls, string: str) -> Self:
                                                                                                                                                                                                                                          return cls(cls.fromString(string))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_type() -> TypeStr

                                                                                                                                                                                                                                  Return the IPC key type.

                                                                                                                                                                                                                                  Source code in prettyqt/core/nativeipckey.py
                                                                                                                                                                                                                                  def get_type(self) -> TypeStr:
                                                                                                                                                                                                                                      """Return the IPC key type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          IPC key type
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return TYPE.inverse[self.type()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_type(typ: TypeStr | QtCore.QNativeIpcKey.Type)

                                                                                                                                                                                                                                  Set the IPC key type.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  typ TypeStr | Type

                                                                                                                                                                                                                                  IPC key type to use

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/nativeipckey.py
                                                                                                                                                                                                                                  def set_type(self, typ: TypeStr | QtCore.QNativeIpcKey.Type):
                                                                                                                                                                                                                                      """Set the IPC key type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          typ: IPC key type to use
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setType(TYPE.get_enum_value(typ))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Object

                                                                                                                                                                                                                                  Bases: ObjectMixin, QObject

                                                                                                                                                                                                                                  The base class of all Qt objects.

                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  class Object(ObjectMixin, core.QObject):
                                                                                                                                                                                                                                      """The base class of all Qt objects."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  ObjectMixin

                                                                                                                                                                                                                                  Bases: _ObjectBase

                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  class ObjectMixin(_ObjectBase):
                                                                                                                                                                                                                                      def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                          self._eventfilters = set()
                                                                                                                                                                                                                                          # klass = type(self)
                                                                                                                                                                                                                                          # if issubclass(klass, core.QObject) and klass not in _properties:
                                                                                                                                                                                                                                          #     metaobj = core.MetaObject(klass.staticMetaObject)
                                                                                                                                                                                                                                          #     _properties[klass] = [i.get_name() for i in metaobj.get_properties()]
                                                                                                                                                                                                                                          #     _signals[klass] = [i.get_name() for i in metaobj.get_signals()]
                                                                                                                                                                                                                                          new: dict[str, Any] = {}
                                                                                                                                                                                                                                          if kwargs:
                                                                                                                                                                                                                                              mapper = self._get_map()
                                                                                                                                                                                                                                              props = get_properties(type(self))
                                                                                                                                                                                                                                              signals = get_signals(type(self))
                                                                                                                                                                                                                                              for k, v in kwargs.items():
                                                                                                                                                                                                                                                  # this allows snake_case naming.
                                                                                                                                                                                                                                                  camel_k = helpers.to_lower_camel(k)
                                                                                                                                                                                                                                                  if camel_k != k and camel_k in kwargs:
                                                                                                                                                                                                                                                      logger.warning("%s defined twice: %s / %s", k, v, kwargs[camel_k])
                                                                                                                                                                                                                                                  # allow str values instead of enum
                                                                                                                                                                                                                                                  if camel_k in mapper and isinstance(v, str):
                                                                                                                                                                                                                                                      new[camel_k] = mapper[camel_k][v]
                                                                                                                                                                                                                                                  # allow str values for common icon kwargs
                                                                                                                                                                                                                                                  elif camel_k in {"windowIcon", "icon"} and isinstance(v, str):
                                                                                                                                                                                                                                                      from prettyqt import iconprovider
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                      new[camel_k] = iconprovider.get_icon(v)
                                                                                                                                                                                                                                                  # kwargs which need camel-casing
                                                                                                                                                                                                                                                  elif camel_k in props or camel_k in signals:
                                                                                                                                                                                                                                                      new[camel_k] = v
                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                      new[k] = v
                                                                                                                                                                                                                                          super().__init__(*args, **new)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def _get_map(self):
                                                                                                                                                                                                                                          """Can be implemented by subclasses to support str -> Enum conversion.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          To get data from all subclasses, we always fetch _get_map from super(),
                                                                                                                                                                                                                                          append our own shit and return it.
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return {}
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __pretty__(self, fmt: Callable[[Any], Any], **kwargs: Any) -> Generator[Any]:
                                                                                                                                                                                                                                          yield f"{type(self).__name__}("
                                                                                                                                                                                                                                          yield 1
                                                                                                                                                                                                                                          for k, v in self.get_properties(only_writable=True).items():
                                                                                                                                                                                                                                              yield f"{k}={v!r}"
                                                                                                                                                                                                                                              yield 0
                                                                                                                                                                                                                                              for ef in self._eventfilters:
                                                                                                                                                                                                                                                  yield f"Eventfilter={ef.__class__.__name__}"
                                                                                                                                                                                                                                                  yield 0
                                                                                                                                                                                                                                          yield -1
                                                                                                                                                                                                                                          yield ")"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      # def __repr__(self):  # we already monkeypatch QObject
                                                                                                                                                                                                                                      #     return get_repr(self, self.objectName())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __setstate__(self, state):
                                                                                                                                                                                                                                          self.set_properties(state)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getstate__(self):
                                                                                                                                                                                                                                          return self.get_properties()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (), self.__getstate__()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def installEventFilter(self, filter_: core.QObject | str, **kwargs):
                                                                                                                                                                                                                                          """Override to also allow setting eventfilters by name."""
                                                                                                                                                                                                                                          if filter_ in self._eventfilters:
                                                                                                                                                                                                                                              logger.warning("Installing same EventFilter multiple times to %s.", self)
                                                                                                                                                                                                                                              return
                                                                                                                                                                                                                                          match filter_:
                                                                                                                                                                                                                                              case core.QObject():
                                                                                                                                                                                                                                                  pass
                                                                                                                                                                                                                                              case str():
                                                                                                                                                                                                                                                  from prettyqt import eventfilters
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                  kls = classhelpers.get_class_for_id(eventfilters.BaseEventFilter, filter_)
                                                                                                                                                                                                                                                  filter_ = kls(parent=self, **kwargs)
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  raise ValueError(filter_)
                                                                                                                                                                                                                                          self._eventfilters.add(filter_)
                                                                                                                                                                                                                                          super().installEventFilter(filter_)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def removeEventFilter(self, eventfilter: core.QObject):
                                                                                                                                                                                                                                          if eventfilter not in self._eventfilters:
                                                                                                                                                                                                                                              logger.warning("Trying to remove non-installed EventFilter.")
                                                                                                                                                                                                                                              return
                                                                                                                                                                                                                                          self._eventfilters.remove(eventfilter)
                                                                                                                                                                                                                                          super().removeEventFilter(eventfilter)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def add_callback_for_event(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          callback: Callable[[core.QEvent], bool],
                                                                                                                                                                                                                                          include: core.QEvent.Type
                                                                                                                                                                                                                                          | core.event.TypeStr
                                                                                                                                                                                                                                          | Sequence[core.QEvent.Type | core.event.TypeStr]
                                                                                                                                                                                                                                          | None = None,
                                                                                                                                                                                                                                          exclude: core.QEvent.Type
                                                                                                                                                                                                                                          | core.event.TypeStr
                                                                                                                                                                                                                                          | Sequence[core.QEvent.Type | core.event.TypeStr]
                                                                                                                                                                                                                                          | None = None,
                                                                                                                                                                                                                                      ) -> eventfilters.EventCatcher:
                                                                                                                                                                                                                                          """Connect widget events to a callback.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          if include is set, it behaves like a whitelist.
                                                                                                                                                                                                                                          if exclude is set, it behaves like a blacklist.
                                                                                                                                                                                                                                          The QEvent is passed to the callback as an argument, and the callback
                                                                                                                                                                                                                                          needs to return True or False to indicate whether the Event should be filtered.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              callback: Callback to execute when event is triggered
                                                                                                                                                                                                                                              include: Events to include
                                                                                                                                                                                                                                              exclude: Events to exclude
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          from prettyqt import eventfilters
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          eventfilter = eventfilters.EventCatcher(include, exclude, callback, parent=self)
                                                                                                                                                                                                                                          self.installEventFilter(eventfilter)
                                                                                                                                                                                                                                          return eventfilter
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def serialize(self) -> dict[str, Any]:
                                                                                                                                                                                                                                          return self.get_properties()
                                                                                                                                                                                                                                          # dct = {}
                                                                                                                                                                                                                                          # for klass in reversed(inspect.getmro(type(self))):
                                                                                                                                                                                                                                          #     if "serialize_fields" in klass.__dict__:
                                                                                                                                                                                                                                          #         data = klass.serialize_fields(self)
                                                                                                                                                                                                                                          #         dct |= data
                                                                                                                                                                                                                                          # return dct
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def signals_blocked(self):
                                                                                                                                                                                                                                          """Context manager to temporarily block emitting signals."""
                                                                                                                                                                                                                                          blocked = self.blockSignals(True)
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield self
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              self.blockSignals(blocked)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def signal_blocked(
                                                                                                                                                                                                                                          self, signal: core.SignalInstance, receiver: Callable | core.SignalInstance
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Context manager to temporarily disconnect specific signal."""
                                                                                                                                                                                                                                          signal.disconnect(receiver)
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield self
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              signal.connect(receiver)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def properties_set_to(self, **kwargs):
                                                                                                                                                                                                                                          """Context manager to temporarily set properties to different values."""
                                                                                                                                                                                                                                          props = {k: self.property(k) for k in kwargs}
                                                                                                                                                                                                                                          for k, v in kwargs.items():
                                                                                                                                                                                                                                              self.setProperty(k, v)
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield self
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              for k, v in props.items():
                                                                                                                                                                                                                                                  self.setProperty(k, v)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def to_json(self):
                                                                                                                                                                                                                                          dct = self.__getstate__()
                                                                                                                                                                                                                                          for k, v in dct.items():
                                                                                                                                                                                                                                              if isinstance(v, ObjectMixin):
                                                                                                                                                                                                                                                  dct[k] = v.to_json()
                                                                                                                                                                                                                                          return dct
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_unique_id(self):
                                                                                                                                                                                                                                          """Set unique objectName."""
                                                                                                                                                                                                                                          class_name = type(self).__name__
                                                                                                                                                                                                                                          count = next(counter_dict[class_name])
                                                                                                                                                                                                                                          self.setObjectName(f"{class_name}_{count}")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_object_name(self, name: str):
                                                                                                                                                                                                                                          """Set unique objectName."""
                                                                                                                                                                                                                                          self.setObjectName(name)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_qt_base_class(cls) -> type | None:
                                                                                                                                                                                                                                          return classhelpers.get_qt_parent_class(cls)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_static_metaobject(cls) -> core.MetaObject:
                                                                                                                                                                                                                                          return _get_metaobject(cls)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_metaobject(self) -> core.MetaObject:
                                                                                                                                                                                                                                          return core.MetaObject(self.metaObject())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_sender(self, typ: type[T]) -> T | None:
                                                                                                                                                                                                                                          sender = self.sender()
                                                                                                                                                                                                                                          return sender if isinstance(sender, typ) else None
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def find_children(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          typ: type[T] = core.QObject,  # ty: ignore[invalid-parameter-default]
                                                                                                                                                                                                                                          name: str | datatypes.PatternType | None = None,
                                                                                                                                                                                                                                          recursive: bool = True,
                                                                                                                                                                                                                                          property_selector: dict[str, Any] | None = None,
                                                                                                                                                                                                                                          only_prettyqt_classes: bool = False,
                                                                                                                                                                                                                                      ) -> listdelegators.ListDelegator[T]:
                                                                                                                                                                                                                                          """Find children with given type and name.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Children can be filtered by passing a property selector dictionary.
                                                                                                                                                                                                                                          It must contain the property name for keys and either a value which must be set
                                                                                                                                                                                                                                          or a predicate function which gets the property value as an argument
                                                                                                                                                                                                                                          and must return True if the child should be included.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Arguments:
                                                                                                                                                                                                                                              typ: Subclass of QObject (can also be a UnionType)
                                                                                                                                                                                                                                              name: ObjectName filter. None includes all.
                                                                                                                                                                                                                                              recursive: whether to search for children recursively.
                                                                                                                                                                                                                                              property_selector: dict containing PropertyName -> Value/Predicate pairs.
                                                                                                                                                                                                                                              only_prettyqt_classes: only include objects with prettyqt superpowers.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              list of QObjects
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          if isinstance(name, re.Pattern):
                                                                                                                                                                                                                                              name = core.RegularExpression(name)
                                                                                                                                                                                                                                          if recursive:
                                                                                                                                                                                                                                              flag = constants.FindChildOption.FindChildrenRecursively
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              flag = constants.FindChildOption.FindDirectChildrenOnly
                                                                                                                                                                                                                                          match typ:
                                                                                                                                                                                                                                              case types.UnionType():
                                                                                                                                                                                                                                                  objects = [
                                                                                                                                                                                                                                                      i for t in get_args(typ) for i in self._find_children(t, name, flag)
                                                                                                                                                                                                                                                  ]
                                                                                                                                                                                                                                              case type():
                                                                                                                                                                                                                                                  objects = self._find_children(typ, name, flag)
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  raise TypeError(typ)
                                                                                                                                                                                                                                          if property_selector:
                                                                                                                                                                                                                                              objects = [
                                                                                                                                                                                                                                                  o
                                                                                                                                                                                                                                                  for o in objects
                                                                                                                                                                                                                                                  if all(
                                                                                                                                                                                                                                                      v(o.property(k)) if callable(v) else o.property(k) == v
                                                                                                                                                                                                                                                      for k, v in property_selector.items()
                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                              ]
                                                                                                                                                                                                                                          if only_prettyqt_classes:
                                                                                                                                                                                                                                              objects = [i for i in objects if i.__module__.startswith("prettyqt")]
                                                                                                                                                                                                                                          return listdelegators.ListDelegator(objects)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def _find_children(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          typ: type[T],
                                                                                                                                                                                                                                          name: str | core.QRegularExpression | None,
                                                                                                                                                                                                                                          flag: constants.FindChildOption,
                                                                                                                                                                                                                                      ) -> list[T]:
                                                                                                                                                                                                                                          if name is None:
                                                                                                                                                                                                                                              return self.findChildren(typ, options=flag)
                                                                                                                                                                                                                                          return self.findChildren(typ, name, options=flag)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def find_child(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          typ: type[T] = core.QObject,  # ty: ignore[invalid-parameter-default]
                                                                                                                                                                                                                                          name: str | core.QRegularExpression | None = None,
                                                                                                                                                                                                                                          recursive: bool = True,
                                                                                                                                                                                                                                      ) -> T | None:
                                                                                                                                                                                                                                          """Find a child with given type and name."""
                                                                                                                                                                                                                                          if recursive:
                                                                                                                                                                                                                                              flag = constants.FindChildOption.FindChildrenRecursively
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              flag = constants.FindChildOption.FindDirectChildrenOnly
                                                                                                                                                                                                                                          match typ:
                                                                                                                                                                                                                                              case types.UnionType():
                                                                                                                                                                                                                                                  return next(
                                                                                                                                                                                                                                                      (item for item in self.find_children(typ, name, recursive=recursive)),
                                                                                                                                                                                                                                                      None,
                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  return self.findChild(typ, name, flag)  # type: ignore
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def find_parent(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          typ: type[T] = core.QObject,  # ty: ignore[invalid-parameter-default]
                                                                                                                                                                                                                                          name: str | None = None,
                                                                                                                                                                                                                                      ) -> T | None:
                                                                                                                                                                                                                                          """Find parent with given type or name."""
                                                                                                                                                                                                                                          node = self
                                                                                                                                                                                                                                          while node:
                                                                                                                                                                                                                                              node = node.parent()
                                                                                                                                                                                                                                              if isinstance(node, typ) and (name is None or node.objectName() == name):
                                                                                                                                                                                                                                                  return node
                                                                                                                                                                                                                                          return None
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def start_timer(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          interval: int | str,
                                                                                                                                                                                                                                          timer_type: constants.TimerTypeStr = "coarse",
                                                                                                                                                                                                                                      ) -> int | None:
                                                                                                                                                                                                                                          """Start a timer and return the timer id, to be used in timerEvent."""
                                                                                                                                                                                                                                          if isinstance(interval, str):
                                                                                                                                                                                                                                              interval = helpers.parse_time(interval)
                                                                                                                                                                                                                                          result = self.startTimer(interval, constants.TIMER_TYPE[timer_type])
                                                                                                                                                                                                                                          return None if result == 0 else result
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def start_callback_timer(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          callback: Callable,
                                                                                                                                                                                                                                          interval: int | str,
                                                                                                                                                                                                                                          single_shot: bool = False,
                                                                                                                                                                                                                                          timer_type: constants.TimerTypeStr = "coarse",
                                                                                                                                                                                                                                      ) -> core.Timer:
                                                                                                                                                                                                                                          """Start timer and execute callback when timeout reached."""
                                                                                                                                                                                                                                          interval = helpers.parse_time(interval) if isinstance(interval, str) else interval
                                                                                                                                                                                                                                          timer = core.Timer(
                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                              single_shot=single_shot,
                                                                                                                                                                                                                                              interval=interval,
                                                                                                                                                                                                                                              timer_type=timer_type,
                                                                                                                                                                                                                                              timeout=callback,
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                          timer.start()
                                                                                                                                                                                                                                          return timer
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_properties(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          include_super: bool = True,
                                                                                                                                                                                                                                          cast: bool = True,
                                                                                                                                                                                                                                          only_writable: bool = False,
                                                                                                                                                                                                                                          only_nonempty: bool = False,
                                                                                                                                                                                                                                      ) -> dict[str, Any]:
                                                                                                                                                                                                                                          """Get a dictionary containing all properties and their values."""
                                                                                                                                                                                                                                          metaobj = self.get_metaobject()
                                                                                                                                                                                                                                          props = metaobj.get_properties(
                                                                                                                                                                                                                                              include_super=include_super, only_writable=only_writable
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                          dct = {}
                                                                                                                                                                                                                                          for i in props:
                                                                                                                                                                                                                                              if i.get_name() in ["children", "frameShadow", "state"]:
                                                                                                                                                                                                                                                  continue
                                                                                                                                                                                                                                              val = i.read(self)
                                                                                                                                                                                                                                              if only_nonempty:
                                                                                                                                                                                                                                                  match val:
                                                                                                                                                                                                                                                      case _ if hasattr(val, "isNull"):
                                                                                                                                                                                                                                                          include = not val.isNull()
                                                                                                                                                                                                                                                      case _ if hasattr(val, "isEmpty"):
                                                                                                                                                                                                                                                          include = not val.isEmpty()
                                                                                                                                                                                                                                                      case _ if hasattr(val, "isValid"):
                                                                                                                                                                                                                                                          include = val.isValid()
                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                          include = bool(val)
                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                  include = True
                                                                                                                                                                                                                                              if not include:
                                                                                                                                                                                                                                                  continue
                                                                                                                                                                                                                                              dct[i.name()] = datatypes.make_serializable(val) if cast else val
                                                                                                                                                                                                                                          return dct
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_properties(self, props: dict[str, Any], include_super: bool = True):
                                                                                                                                                                                                                                          """Set properties from a dictionary."""
                                                                                                                                                                                                                                          metaobj = self.get_metaobject()
                                                                                                                                                                                                                                          metaprops = metaobj.get_properties(include_super=include_super)
                                                                                                                                                                                                                                          for metaprop in metaprops:
                                                                                                                                                                                                                                              if (name := metaprop.name()) in props:
                                                                                                                                                                                                                                                  value = props[name]
                                                                                                                                                                                                                                                  metaprop.write(self, value)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_dynamic_properties(self) -> dict[str, Any]:
                                                                                                                                                                                                                                          """Get a dictionary with all dynamic properties."""
                                                                                                                                                                                                                                          return {
                                                                                                                                                                                                                                              (k := bytes(i.data()).decode()): self.property(k)
                                                                                                                                                                                                                                              for i in self.dynamicPropertyNames()
                                                                                                                                                                                                                                          }
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def bind_property(self, object_name: str, prop_name: str) -> property:
                                                                                                                                                                                                                                          def getter(self):
                                                                                                                                                                                                                                              return self.findChild(core.QObject, object_name).property(prop_name)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          def setter(self, value):
                                                                                                                                                                                                                                              self.findChild(core.QObject, object_name).setProperty(prop_name, value)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          return property(getter, setter)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  add_callback_for_event(callback: Callable[[core.QEvent], bool], include: core.QEvent.Type | core.event.TypeStr | Sequence[core.QEvent.Type | core.event.TypeStr] | None = None, exclude: core.QEvent.Type | core.event.TypeStr | Sequence[core.QEvent.Type | core.event.TypeStr] | None = None) -> eventfilters.EventCatcher

                                                                                                                                                                                                                                  Connect widget events to a callback.

                                                                                                                                                                                                                                  if include is set, it behaves like a whitelist. if exclude is set, it behaves like a blacklist. The QEvent is passed to the callback as an argument, and the callback needs to return True or False to indicate whether the Event should be filtered.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  callback Callable[[QEvent], bool]

                                                                                                                                                                                                                                  Callback to execute when event is triggered

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  include Type | TypeStr | Sequence[Type | TypeStr] | None

                                                                                                                                                                                                                                  Events to include

                                                                                                                                                                                                                                  None
                                                                                                                                                                                                                                  exclude Type | TypeStr | Sequence[Type | TypeStr] | None

                                                                                                                                                                                                                                  Events to exclude

                                                                                                                                                                                                                                  None
                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  def add_callback_for_event(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      callback: Callable[[core.QEvent], bool],
                                                                                                                                                                                                                                      include: core.QEvent.Type
                                                                                                                                                                                                                                      | core.event.TypeStr
                                                                                                                                                                                                                                      | Sequence[core.QEvent.Type | core.event.TypeStr]
                                                                                                                                                                                                                                      | None = None,
                                                                                                                                                                                                                                      exclude: core.QEvent.Type
                                                                                                                                                                                                                                      | core.event.TypeStr
                                                                                                                                                                                                                                      | Sequence[core.QEvent.Type | core.event.TypeStr]
                                                                                                                                                                                                                                      | None = None,
                                                                                                                                                                                                                                  ) -> eventfilters.EventCatcher:
                                                                                                                                                                                                                                      """Connect widget events to a callback.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      if include is set, it behaves like a whitelist.
                                                                                                                                                                                                                                      if exclude is set, it behaves like a blacklist.
                                                                                                                                                                                                                                      The QEvent is passed to the callback as an argument, and the callback
                                                                                                                                                                                                                                      needs to return True or False to indicate whether the Event should be filtered.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          callback: Callback to execute when event is triggered
                                                                                                                                                                                                                                          include: Events to include
                                                                                                                                                                                                                                          exclude: Events to exclude
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      from prettyqt import eventfilters
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      eventfilter = eventfilters.EventCatcher(include, exclude, callback, parent=self)
                                                                                                                                                                                                                                      self.installEventFilter(eventfilter)
                                                                                                                                                                                                                                      return eventfilter
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  find_child(typ: type[T] = core.QObject, name: str | core.QRegularExpression | None = None, recursive: bool = True) -> T | None

                                                                                                                                                                                                                                  Find a child with given type and name.

                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  def find_child(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      typ: type[T] = core.QObject,  # ty: ignore[invalid-parameter-default]
                                                                                                                                                                                                                                      name: str | core.QRegularExpression | None = None,
                                                                                                                                                                                                                                      recursive: bool = True,
                                                                                                                                                                                                                                  ) -> T | None:
                                                                                                                                                                                                                                      """Find a child with given type and name."""
                                                                                                                                                                                                                                      if recursive:
                                                                                                                                                                                                                                          flag = constants.FindChildOption.FindChildrenRecursively
                                                                                                                                                                                                                                      else:
                                                                                                                                                                                                                                          flag = constants.FindChildOption.FindDirectChildrenOnly
                                                                                                                                                                                                                                      match typ:
                                                                                                                                                                                                                                          case types.UnionType():
                                                                                                                                                                                                                                              return next(
                                                                                                                                                                                                                                                  (item for item in self.find_children(typ, name, recursive=recursive)),
                                                                                                                                                                                                                                                  None,
                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          case _:
                                                                                                                                                                                                                                              return self.findChild(typ, name, flag)  # type: ignore
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  find_children(typ: type[T] = core.QObject, name: str | datatypes.PatternType | None = None, recursive: bool = True, property_selector: dict[str, Any] | None = None, only_prettyqt_classes: bool = False) -> listdelegators.ListDelegator[T]

                                                                                                                                                                                                                                  Find children with given type and name.

                                                                                                                                                                                                                                  Children can be filtered by passing a property selector dictionary. It must contain the property name for keys and either a value which must be set or a predicate function which gets the property value as an argument and must return True if the child should be included.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  typ type[T]

                                                                                                                                                                                                                                  Subclass of QObject (can also be a UnionType)

                                                                                                                                                                                                                                  QObject
                                                                                                                                                                                                                                  name str | PatternType | None

                                                                                                                                                                                                                                  ObjectName filter. None includes all.

                                                                                                                                                                                                                                  None
                                                                                                                                                                                                                                  recursive bool

                                                                                                                                                                                                                                  whether to search for children recursively.

                                                                                                                                                                                                                                  True
                                                                                                                                                                                                                                  property_selector dict[str, Any] | None

                                                                                                                                                                                                                                  dict containing PropertyName -> Value/Predicate pairs.

                                                                                                                                                                                                                                  None
                                                                                                                                                                                                                                  only_prettyqt_classes bool

                                                                                                                                                                                                                                  only include objects with prettyqt superpowers.

                                                                                                                                                                                                                                  False
                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  def find_children(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      typ: type[T] = core.QObject,  # ty: ignore[invalid-parameter-default]
                                                                                                                                                                                                                                      name: str | datatypes.PatternType | None = None,
                                                                                                                                                                                                                                      recursive: bool = True,
                                                                                                                                                                                                                                      property_selector: dict[str, Any] | None = None,
                                                                                                                                                                                                                                      only_prettyqt_classes: bool = False,
                                                                                                                                                                                                                                  ) -> listdelegators.ListDelegator[T]:
                                                                                                                                                                                                                                      """Find children with given type and name.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Children can be filtered by passing a property selector dictionary.
                                                                                                                                                                                                                                      It must contain the property name for keys and either a value which must be set
                                                                                                                                                                                                                                      or a predicate function which gets the property value as an argument
                                                                                                                                                                                                                                      and must return True if the child should be included.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Arguments:
                                                                                                                                                                                                                                          typ: Subclass of QObject (can also be a UnionType)
                                                                                                                                                                                                                                          name: ObjectName filter. None includes all.
                                                                                                                                                                                                                                          recursive: whether to search for children recursively.
                                                                                                                                                                                                                                          property_selector: dict containing PropertyName -> Value/Predicate pairs.
                                                                                                                                                                                                                                          only_prettyqt_classes: only include objects with prettyqt superpowers.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          list of QObjects
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      if isinstance(name, re.Pattern):
                                                                                                                                                                                                                                          name = core.RegularExpression(name)
                                                                                                                                                                                                                                      if recursive:
                                                                                                                                                                                                                                          flag = constants.FindChildOption.FindChildrenRecursively
                                                                                                                                                                                                                                      else:
                                                                                                                                                                                                                                          flag = constants.FindChildOption.FindDirectChildrenOnly
                                                                                                                                                                                                                                      match typ:
                                                                                                                                                                                                                                          case types.UnionType():
                                                                                                                                                                                                                                              objects = [
                                                                                                                                                                                                                                                  i for t in get_args(typ) for i in self._find_children(t, name, flag)
                                                                                                                                                                                                                                              ]
                                                                                                                                                                                                                                          case type():
                                                                                                                                                                                                                                              objects = self._find_children(typ, name, flag)
                                                                                                                                                                                                                                          case _:
                                                                                                                                                                                                                                              raise TypeError(typ)
                                                                                                                                                                                                                                      if property_selector:
                                                                                                                                                                                                                                          objects = [
                                                                                                                                                                                                                                              o
                                                                                                                                                                                                                                              for o in objects
                                                                                                                                                                                                                                              if all(
                                                                                                                                                                                                                                                  v(o.property(k)) if callable(v) else o.property(k) == v
                                                                                                                                                                                                                                                  for k, v in property_selector.items()
                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                      if only_prettyqt_classes:
                                                                                                                                                                                                                                          objects = [i for i in objects if i.__module__.startswith("prettyqt")]
                                                                                                                                                                                                                                      return listdelegators.ListDelegator(objects)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  find_parent(typ: type[T] = core.QObject, name: str | None = None) -> T | None

                                                                                                                                                                                                                                  Find parent with given type or name.

                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  def find_parent(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      typ: type[T] = core.QObject,  # ty: ignore[invalid-parameter-default]
                                                                                                                                                                                                                                      name: str | None = None,
                                                                                                                                                                                                                                  ) -> T | None:
                                                                                                                                                                                                                                      """Find parent with given type or name."""
                                                                                                                                                                                                                                      node = self
                                                                                                                                                                                                                                      while node:
                                                                                                                                                                                                                                          node = node.parent()
                                                                                                                                                                                                                                          if isinstance(node, typ) and (name is None or node.objectName() == name):
                                                                                                                                                                                                                                              return node
                                                                                                                                                                                                                                      return None
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_dynamic_properties() -> dict[str, Any]

                                                                                                                                                                                                                                  Get a dictionary with all dynamic properties.

                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  def get_dynamic_properties(self) -> dict[str, Any]:
                                                                                                                                                                                                                                      """Get a dictionary with all dynamic properties."""
                                                                                                                                                                                                                                      return {
                                                                                                                                                                                                                                          (k := bytes(i.data()).decode()): self.property(k)
                                                                                                                                                                                                                                          for i in self.dynamicPropertyNames()
                                                                                                                                                                                                                                      }
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_properties(include_super: bool = True, cast: bool = True, only_writable: bool = False, only_nonempty: bool = False) -> dict[str, Any]

                                                                                                                                                                                                                                  Get a dictionary containing all properties and their values.

                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  def get_properties(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      include_super: bool = True,
                                                                                                                                                                                                                                      cast: bool = True,
                                                                                                                                                                                                                                      only_writable: bool = False,
                                                                                                                                                                                                                                      only_nonempty: bool = False,
                                                                                                                                                                                                                                  ) -> dict[str, Any]:
                                                                                                                                                                                                                                      """Get a dictionary containing all properties and their values."""
                                                                                                                                                                                                                                      metaobj = self.get_metaobject()
                                                                                                                                                                                                                                      props = metaobj.get_properties(
                                                                                                                                                                                                                                          include_super=include_super, only_writable=only_writable
                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                      dct = {}
                                                                                                                                                                                                                                      for i in props:
                                                                                                                                                                                                                                          if i.get_name() in ["children", "frameShadow", "state"]:
                                                                                                                                                                                                                                              continue
                                                                                                                                                                                                                                          val = i.read(self)
                                                                                                                                                                                                                                          if only_nonempty:
                                                                                                                                                                                                                                              match val:
                                                                                                                                                                                                                                                  case _ if hasattr(val, "isNull"):
                                                                                                                                                                                                                                                      include = not val.isNull()
                                                                                                                                                                                                                                                  case _ if hasattr(val, "isEmpty"):
                                                                                                                                                                                                                                                      include = not val.isEmpty()
                                                                                                                                                                                                                                                  case _ if hasattr(val, "isValid"):
                                                                                                                                                                                                                                                      include = val.isValid()
                                                                                                                                                                                                                                                  case _:
                                                                                                                                                                                                                                                      include = bool(val)
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              include = True
                                                                                                                                                                                                                                          if not include:
                                                                                                                                                                                                                                              continue
                                                                                                                                                                                                                                          dct[i.name()] = datatypes.make_serializable(val) if cast else val
                                                                                                                                                                                                                                      return dct
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  installEventFilter(filter_: core.QObject | str, **kwargs)

                                                                                                                                                                                                                                  Override to also allow setting eventfilters by name.

                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  def installEventFilter(self, filter_: core.QObject | str, **kwargs):
                                                                                                                                                                                                                                      """Override to also allow setting eventfilters by name."""
                                                                                                                                                                                                                                      if filter_ in self._eventfilters:
                                                                                                                                                                                                                                          logger.warning("Installing same EventFilter multiple times to %s.", self)
                                                                                                                                                                                                                                          return
                                                                                                                                                                                                                                      match filter_:
                                                                                                                                                                                                                                          case core.QObject():
                                                                                                                                                                                                                                              pass
                                                                                                                                                                                                                                          case str():
                                                                                                                                                                                                                                              from prettyqt import eventfilters
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                              kls = classhelpers.get_class_for_id(eventfilters.BaseEventFilter, filter_)
                                                                                                                                                                                                                                              filter_ = kls(parent=self, **kwargs)
                                                                                                                                                                                                                                          case _:
                                                                                                                                                                                                                                              raise ValueError(filter_)
                                                                                                                                                                                                                                      self._eventfilters.add(filter_)
                                                                                                                                                                                                                                      super().installEventFilter(filter_)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  properties_set_to(**kwargs)

                                                                                                                                                                                                                                  Context manager to temporarily set properties to different values.

                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  @contextlib.contextmanager
                                                                                                                                                                                                                                  def properties_set_to(self, **kwargs):
                                                                                                                                                                                                                                      """Context manager to temporarily set properties to different values."""
                                                                                                                                                                                                                                      props = {k: self.property(k) for k in kwargs}
                                                                                                                                                                                                                                      for k, v in kwargs.items():
                                                                                                                                                                                                                                          self.setProperty(k, v)
                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          yield self
                                                                                                                                                                                                                                      finally:
                                                                                                                                                                                                                                          for k, v in props.items():
                                                                                                                                                                                                                                              self.setProperty(k, v)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_object_name(name: str)

                                                                                                                                                                                                                                  Set unique objectName.

                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  def set_object_name(self, name: str):
                                                                                                                                                                                                                                      """Set unique objectName."""
                                                                                                                                                                                                                                      self.setObjectName(name)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_properties(props: dict[str, Any], include_super: bool = True)

                                                                                                                                                                                                                                  Set properties from a dictionary.

                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  def set_properties(self, props: dict[str, Any], include_super: bool = True):
                                                                                                                                                                                                                                      """Set properties from a dictionary."""
                                                                                                                                                                                                                                      metaobj = self.get_metaobject()
                                                                                                                                                                                                                                      metaprops = metaobj.get_properties(include_super=include_super)
                                                                                                                                                                                                                                      for metaprop in metaprops:
                                                                                                                                                                                                                                          if (name := metaprop.name()) in props:
                                                                                                                                                                                                                                              value = props[name]
                                                                                                                                                                                                                                              metaprop.write(self, value)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_unique_id()

                                                                                                                                                                                                                                  Set unique objectName.

                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  def set_unique_id(self):
                                                                                                                                                                                                                                      """Set unique objectName."""
                                                                                                                                                                                                                                      class_name = type(self).__name__
                                                                                                                                                                                                                                      count = next(counter_dict[class_name])
                                                                                                                                                                                                                                      self.setObjectName(f"{class_name}_{count}")
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  signal_blocked(signal: core.SignalInstance, receiver: Callable | core.SignalInstance)

                                                                                                                                                                                                                                  Context manager to temporarily disconnect specific signal.

                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  @contextlib.contextmanager
                                                                                                                                                                                                                                  def signal_blocked(
                                                                                                                                                                                                                                      self, signal: core.SignalInstance, receiver: Callable | core.SignalInstance
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Context manager to temporarily disconnect specific signal."""
                                                                                                                                                                                                                                      signal.disconnect(receiver)
                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          yield self
                                                                                                                                                                                                                                      finally:
                                                                                                                                                                                                                                          signal.connect(receiver)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  signals_blocked()

                                                                                                                                                                                                                                  Context manager to temporarily block emitting signals.

                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  @contextlib.contextmanager
                                                                                                                                                                                                                                  def signals_blocked(self):
                                                                                                                                                                                                                                      """Context manager to temporarily block emitting signals."""
                                                                                                                                                                                                                                      blocked = self.blockSignals(True)
                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          yield self
                                                                                                                                                                                                                                      finally:
                                                                                                                                                                                                                                          self.blockSignals(blocked)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  start_callback_timer(callback: Callable, interval: int | str, single_shot: bool = False, timer_type: constants.TimerTypeStr = 'coarse') -> core.Timer

                                                                                                                                                                                                                                  Start timer and execute callback when timeout reached.

                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  def start_callback_timer(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      callback: Callable,
                                                                                                                                                                                                                                      interval: int | str,
                                                                                                                                                                                                                                      single_shot: bool = False,
                                                                                                                                                                                                                                      timer_type: constants.TimerTypeStr = "coarse",
                                                                                                                                                                                                                                  ) -> core.Timer:
                                                                                                                                                                                                                                      """Start timer and execute callback when timeout reached."""
                                                                                                                                                                                                                                      interval = helpers.parse_time(interval) if isinstance(interval, str) else interval
                                                                                                                                                                                                                                      timer = core.Timer(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          single_shot=single_shot,
                                                                                                                                                                                                                                          interval=interval,
                                                                                                                                                                                                                                          timer_type=timer_type,
                                                                                                                                                                                                                                          timeout=callback,
                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                      timer.start()
                                                                                                                                                                                                                                      return timer
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  start_timer(interval: int | str, timer_type: constants.TimerTypeStr = 'coarse') -> int | None

                                                                                                                                                                                                                                  Start a timer and return the timer id, to be used in timerEvent.

                                                                                                                                                                                                                                  Source code in prettyqt/core/object.py
                                                                                                                                                                                                                                  def start_timer(
                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                      interval: int | str,
                                                                                                                                                                                                                                      timer_type: constants.TimerTypeStr = "coarse",
                                                                                                                                                                                                                                  ) -> int | None:
                                                                                                                                                                                                                                      """Start a timer and return the timer id, to be used in timerEvent."""
                                                                                                                                                                                                                                      if isinstance(interval, str):
                                                                                                                                                                                                                                          interval = helpers.parse_time(interval)
                                                                                                                                                                                                                                      result = self.startTimer(interval, constants.TIMER_TYPE[timer_type])
                                                                                                                                                                                                                                      return None if result == 0 else result
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  OperatingSystemVersion

                                                                                                                                                                                                                                  Bases: QOperatingSystemVersion

                                                                                                                                                                                                                                  Information about the operating system version.

                                                                                                                                                                                                                                  Source code in prettyqt/core/operatingsystemversion.py
                                                                                                                                                                                                                                  class OperatingSystemVersion(core.QOperatingSystemVersion):
                                                                                                                                                                                                                                      """Information about the operating system version."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          typ: core.QOperatingSystemVersion.OSType | str,
                                                                                                                                                                                                                                          major: int,
                                                                                                                                                                                                                                          minor: int | None = None,
                                                                                                                                                                                                                                          micro: int | None = None,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          os_type = OS_TYPE[typ] if isinstance(typ, str) else typ
                                                                                                                                                                                                                                          if minor is None:
                                                                                                                                                                                                                                              minor = -1
                                                                                                                                                                                                                                          if micro is None:
                                                                                                                                                                                                                                              micro = -1
                                                                                                                                                                                                                                          super().__init__(os_type, major, minor, micro)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(
                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                              self.get_type(),
                                                                                                                                                                                                                                              self.majorVersion(),
                                                                                                                                                                                                                                              self.minorVersion(),
                                                                                                                                                                                                                                              self.microVersion(),
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _type(self) -> OsTypeStr:
                                                                                                                                                                                                                                          return self.get_type()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _majorVersion(self) -> int:
                                                                                                                                                                                                                                          return self.majorVersion()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _minorVersion(self) -> int:
                                                                                                                                                                                                                                          return self.minorVersion()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _microVersion(self) -> int:
                                                                                                                                                                                                                                          return self.microVersion()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      __match_args__ = ("_type", "_majorVersion", "_minorVersion", "_microVersion")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return (
                                                                                                                                                                                                                                              type(self),
                                                                                                                                                                                                                                              (
                                                                                                                                                                                                                                                  self.get_type(),
                                                                                                                                                                                                                                                  self.majorVersion(),
                                                                                                                                                                                                                                                  self.minorVersion(),
                                                                                                                                                                                                                                                  self.microVersion(),
                                                                                                                                                                                                                                              ),
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __eq__(self, other):
                                                                                                                                                                                                                                          return (
                                                                                                                                                                                                                                              (
                                                                                                                                                                                                                                                  self.type() == other.type()
                                                                                                                                                                                                                                                  and self.majorVersion() == other.majorVersion()
                                                                                                                                                                                                                                                  and self.minorVersion() == other.minorVersion()
                                                                                                                                                                                                                                                  and self.microVersion() == other.microVersion()
                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                              if isinstance(other, core.QOperatingSystemVersion)
                                                                                                                                                                                                                                              else False
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __hash__(self):
                                                                                                                                                                                                                                          return hash((
                                                                                                                                                                                                                                              self.get_type(),
                                                                                                                                                                                                                                              self.majorVersion(),
                                                                                                                                                                                                                                              self.minorVersion(),
                                                                                                                                                                                                                                              self.microVersion(),
                                                                                                                                                                                                                                          ))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_type(self) -> OsTypeStr:
                                                                                                                                                                                                                                          """Get current os type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              current os type
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return OS_TYPE.inverse[self.type()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_versionnumber(self) -> core.VersionNumber:
                                                                                                                                                                                                                                          return core.VersionNumber(
                                                                                                                                                                                                                                              self.majorVersion(), self.minorVersion(), self.microVersion()
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_type() -> OsTypeStr

                                                                                                                                                                                                                                  Get current os type.

                                                                                                                                                                                                                                  Source code in prettyqt/core/operatingsystemversion.py
                                                                                                                                                                                                                                  def get_type(self) -> OsTypeStr:
                                                                                                                                                                                                                                      """Get current os type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          current os type
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return OS_TYPE.inverse[self.type()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  ParallelAnimationGroup

                                                                                                                                                                                                                                  Bases: AnimationGroupMixin, QParallelAnimationGroup

                                                                                                                                                                                                                                  Parallel group of animations.

                                                                                                                                                                                                                                  Source code in prettyqt/core/parallelanimationgroup.py
                                                                                                                                                                                                                                  class ParallelAnimationGroup(core.AnimationGroupMixin, core.QParallelAnimationGroup):
                                                                                                                                                                                                                                      """Parallel group of animations."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_duration(self, duration: int):
                                                                                                                                                                                                                                          for anim in self:
                                                                                                                                                                                                                                              match anim:
                                                                                                                                                                                                                                                  # I dont think we need to support nested Animations here..
                                                                                                                                                                                                                                                  case core.QVariantAnimation():
                                                                                                                                                                                                                                                      anim.setDuration(duration)
                                                                                                                                                                                                                                                  case _:
                                                                                                                                                                                                                                                      msg = "set_duration only works with QVariantAnimations."
                                                                                                                                                                                                                                                      raise TypeError(msg)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  PauseAnimation

                                                                                                                                                                                                                                  Bases: AbstractAnimationMixin, QPauseAnimation

                                                                                                                                                                                                                                  Pause for QSequentialAnimationGroup.

                                                                                                                                                                                                                                  Source code in prettyqt/core/pauseanimation.py
                                                                                                                                                                                                                                  5
                                                                                                                                                                                                                                  6
                                                                                                                                                                                                                                  7
                                                                                                                                                                                                                                  8
                                                                                                                                                                                                                                  9
                                                                                                                                                                                                                                  class PauseAnimation(core.AbstractAnimationMixin, core.QPauseAnimation):
                                                                                                                                                                                                                                      """Pause for QSequentialAnimationGroup."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.duration())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Permission

                                                                                                                                                                                                                                  Bases: QPermission

                                                                                                                                                                                                                                  Opaque wrapper of a typed permission.

                                                                                                                                                                                                                                  Source code in prettyqt/core/permission.py
                                                                                                                                                                                                                                  class Permission(core.QPermission):
                                                                                                                                                                                                                                      """Opaque wrapper of a typed permission."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.get_status())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_status(self) -> constants.PermissionStatusStr:
                                                                                                                                                                                                                                          """Return current permission status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              permission status
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return constants.PERMISSION_STATUS.inverse[self.status()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_type(self) -> core.MetaType:
                                                                                                                                                                                                                                          """Return the meta-type of the wrapped permission.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              permission meta-type
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return core.MetaType(self.type().id())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_status() -> constants.PermissionStatusStr

                                                                                                                                                                                                                                  Return current permission status.

                                                                                                                                                                                                                                  Source code in prettyqt/core/permission.py
                                                                                                                                                                                                                                  def get_status(self) -> constants.PermissionStatusStr:
                                                                                                                                                                                                                                      """Return current permission status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          permission status
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return constants.PERMISSION_STATUS.inverse[self.status()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_type() -> core.MetaType

                                                                                                                                                                                                                                  Return the meta-type of the wrapped permission.

                                                                                                                                                                                                                                  Source code in prettyqt/core/permission.py
                                                                                                                                                                                                                                  def get_type(self) -> core.MetaType:
                                                                                                                                                                                                                                      """Return the meta-type of the wrapped permission.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          permission meta-type
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return core.MetaType(self.type().id())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  PersistentModelIndex

                                                                                                                                                                                                                                  Bases: QPersistentModelIndex

                                                                                                                                                                                                                                  Used to locate data in a data model.

                                                                                                                                                                                                                                  Source code in prettyqt/core/persistentmodelindex.py
                                                                                                                                                                                                                                  class PersistentModelIndex(QtCore.QPersistentModelIndex):
                                                                                                                                                                                                                                      """Used to locate data in a data model."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return self.isValid()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getitem__(self, flag: int):
                                                                                                                                                                                                                                          return self.data(flag)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  PluginLoader

                                                                                                                                                                                                                                  Bases: ObjectMixin, QPluginLoader

                                                                                                                                                                                                                                  Load a plugin at runtime.

                                                                                                                                                                                                                                  Source code in prettyqt/core/pluginloader.py
                                                                                                                                                                                                                                  class PluginLoader(core.ObjectMixin, core.QPluginLoader):
                                                                                                                                                                                                                                      """Load a plugin at runtime."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_load_hints(self) -> list[core.library.LoadHintStr]:
                                                                                                                                                                                                                                          return core.library.LOAD_HINTS.get_list(self.loadHints())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_load_hints(self, **kwargs):
                                                                                                                                                                                                                                          flag = core.QLibrary.LoadHint(0)
                                                                                                                                                                                                                                          for k, v in kwargs.items():
                                                                                                                                                                                                                                              if v is True:
                                                                                                                                                                                                                                                  flag |= core.library.LOAD_HINTS[k]
                                                                                                                                                                                                                                          self.setLoadHints(flag)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Process

                                                                                                                                                                                                                                  Bases: IODeviceMixin, QProcess

                                                                                                                                                                                                                                  Used to start external programs and to communicate with them.

                                                                                                                                                                                                                                  Source code in prettyqt/core/process.py
                                                                                                                                                                                                                                  class Process(core.IODeviceMixin, core.QProcess):
                                                                                                                                                                                                                                      """Used to start external programs and to communicate with them."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_read_channel(self, channel: ProcessChannelStr | core.QProcess.ProcessChannel):
                                                                                                                                                                                                                                          """Set the input channel channel.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              channel: channel to set
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setReadChannel(PROCESS_CHANNELS.get_enum_value(channel))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_read_channel(self) -> ProcessChannelStr:
                                                                                                                                                                                                                                          return PROCESS_CHANNELS.inverse[self.readChannel()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def close_read_channel(self, channel: ProcessChannelStr):
                                                                                                                                                                                                                                          self.closeReadChannel(PROCESS_CHANNELS[channel])
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_input_channel_mode(
                                                                                                                                                                                                                                          self, mode: InputChannelModeStr | core.QProcess.InputChannelMode
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Set the input channel mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              mode: mode to set
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setInputChannelMode(INPUT_CHANNEL_MODES.get_enum_value(mode))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_input_channel_mode(self) -> InputChannelModeStr:
                                                                                                                                                                                                                                          return INPUT_CHANNEL_MODES.inverse[self.inputChannelMode()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_process_channel_mode(
                                                                                                                                                                                                                                          self, mode: ProcessChannelModeStr | core.QProcess.ProcessChannelMode
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Set the process channel mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              mode: mode to set
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setProcessChannelMode(PROCESS_CHANNEL_MODES.get_enum_value(mode))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_process_channel_mode(self) -> ProcessChannelModeStr:
                                                                                                                                                                                                                                          return PROCESS_CHANNEL_MODES.inverse[self.processChannelMode()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_state(self, state: ProcessStateStr | core.QProcess.ProcessState):
                                                                                                                                                                                                                                          """Set the process state.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              state: state to set
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setProcessState(PROCESS_STATES.get_enum_value(state))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_state(self) -> ProcessStateStr:
                                                                                                                                                                                                                                          return PROCESS_STATES.inverse[self.state()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_error(self) -> ProcessErrorStr:
                                                                                                                                                                                                                                          return PROCESS_ERRORS.inverse[self.error()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_exit_status(self) -> ExitStatusStr:
                                                                                                                                                                                                                                          return EXIT_STATUS.inverse[self.exitStatus()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_process_environment(self) -> core.ProcessEnvironment:
                                                                                                                                                                                                                                          return core.ProcessEnvironment(self.processEnvironment())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def edit_process_environment(self):
                                                                                                                                                                                                                                          env = self.get_process_environment()
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield env
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              self.setProcessEnvironment(env)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_input_channel_mode(mode: InputChannelModeStr | core.QProcess.InputChannelMode)

                                                                                                                                                                                                                                  Set the input channel mode.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  mode InputChannelModeStr | InputChannelMode

                                                                                                                                                                                                                                  mode to set

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/process.py
                                                                                                                                                                                                                                  def set_input_channel_mode(
                                                                                                                                                                                                                                      self, mode: InputChannelModeStr | core.QProcess.InputChannelMode
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Set the input channel mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          mode: mode to set
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setInputChannelMode(INPUT_CHANNEL_MODES.get_enum_value(mode))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_process_channel_mode(mode: ProcessChannelModeStr | core.QProcess.ProcessChannelMode)

                                                                                                                                                                                                                                  Set the process channel mode.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  mode ProcessChannelModeStr | ProcessChannelMode

                                                                                                                                                                                                                                  mode to set

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/process.py
                                                                                                                                                                                                                                  def set_process_channel_mode(
                                                                                                                                                                                                                                      self, mode: ProcessChannelModeStr | core.QProcess.ProcessChannelMode
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Set the process channel mode.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          mode: mode to set
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setProcessChannelMode(PROCESS_CHANNEL_MODES.get_enum_value(mode))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_read_channel(channel: ProcessChannelStr | core.QProcess.ProcessChannel)

                                                                                                                                                                                                                                  Set the input channel channel.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  channel ProcessChannelStr | ProcessChannel

                                                                                                                                                                                                                                  channel to set

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/process.py
                                                                                                                                                                                                                                  def set_read_channel(self, channel: ProcessChannelStr | core.QProcess.ProcessChannel):
                                                                                                                                                                                                                                      """Set the input channel channel.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          channel: channel to set
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setReadChannel(PROCESS_CHANNELS.get_enum_value(channel))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_state(state: ProcessStateStr | core.QProcess.ProcessState)

                                                                                                                                                                                                                                  Set the process state.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  state ProcessStateStr | ProcessState

                                                                                                                                                                                                                                  state to set

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/process.py
                                                                                                                                                                                                                                  def set_state(self, state: ProcessStateStr | core.QProcess.ProcessState):
                                                                                                                                                                                                                                      """Set the process state.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          state: state to set
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setProcessState(PROCESS_STATES.get_enum_value(state))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  ProcessEnvironment

                                                                                                                                                                                                                                  Bases: QProcessEnvironment, MutableMapping

                                                                                                                                                                                                                                  Holds the environment variables that can be passed to a program.

                                                                                                                                                                                                                                  Source code in prettyqt/core/processenvironment.py
                                                                                                                                                                                                                                  class ProcessEnvironment(
                                                                                                                                                                                                                                      QtCore.QProcessEnvironment, MutableMapping, metaclass=datatypes.QABCMeta
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Holds the environment variables that can be passed to a program."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return not self.isEmpty()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __contains__(self, other: str):
                                                                                                                                                                                                                                          return self.contains(other)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getitem__(self, index: str) -> str:
                                                                                                                                                                                                                                          if index not in self:
                                                                                                                                                                                                                                              msg = "Environment variable not set."
                                                                                                                                                                                                                                              raise KeyError(msg)
                                                                                                                                                                                                                                          return self.value(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __delitem__(self, index: str):
                                                                                                                                                                                                                                          self.remove(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __setitem__(self, index: str, value: str):
                                                                                                                                                                                                                                          return self.insert(index, value)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __iter__(self) -> Iterator[str]:
                                                                                                                                                                                                                                          return iter(self.keys())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __len__(self):
                                                                                                                                                                                                                                          return len(self.keys())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_system_environment(cls) -> Self:
                                                                                                                                                                                                                                          return cls(cls.systemEnvironment())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Property

                                                                                                                                                                                                                                  Bases: Property

                                                                                                                                                                                                                                  Template class that enables automatic property bindings.

                                                                                                                                                                                                                                  Source code in prettyqt/core/property.py
                                                                                                                                                                                                                                  class Property(QtCore.Property):
                                                                                                                                                                                                                                      """Template class that enables automatic property bindings."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                          self.doc = kwargs.get("doc")
                                                                                                                                                                                                                                          super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_doc_dict(cls, klass: type):
                                                                                                                                                                                                                                          import inspect
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          return {
                                                                                                                                                                                                                                              name: member.doc
                                                                                                                                                                                                                                              for name, member in inspect.getmembers(klass)
                                                                                                                                                                                                                                              if isinstance(member, cls) and hasattr(member, "doc")
                                                                                                                                                                                                                                          }
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  PropertyAnimation

                                                                                                                                                                                                                                  Bases: VariantAnimationMixin, QPropertyAnimation

                                                                                                                                                                                                                                  Animates Qt properties.

                                                                                                                                                                                                                                  Source code in prettyqt/core/propertyanimation.py
                                                                                                                                                                                                                                  class PropertyAnimation(core.VariantAnimationMixin, core.QPropertyAnimation):
                                                                                                                                                                                                                                      """Animates Qt properties."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      ID = "property"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                          match args:
                                                                                                                                                                                                                                              case (core.QObject(), str(), *rest):
                                                                                                                                                                                                                                                  super().__init__(
                                                                                                                                                                                                                                                      args[0], datatypes.to_bytearray(args[1]), *rest, **kwargs
                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def _get_map(self):
                                                                                                                                                                                                                                          maps = super()._get_map()
                                                                                                                                                                                                                                          maps |= {"easingCurve": core.easingcurve.TYPE}
                                                                                                                                                                                                                                          return maps
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def apply_to(self, method: types.MethodType):
                                                                                                                                                                                                                                          if not isinstance(target := method.__self__, core.QObject):
                                                                                                                                                                                                                                              raise TypeError(method)
                                                                                                                                                                                                                                          self.setTargetObject(target)
                                                                                                                                                                                                                                          self.set_property_name(method.__name__)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_property_name(self, name: datatypes.ByteArrayType):
                                                                                                                                                                                                                                          name = datatypes.to_bytearray(name)
                                                                                                                                                                                                                                          self.setPropertyName(name)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_property_name(self) -> str:
                                                                                                                                                                                                                                          return bytes(self.propertyName().data()).decode()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_property_value(self) -> Any:
                                                                                                                                                                                                                                          """Return the value of the property which should get animated."""
                                                                                                                                                                                                                                          prop_name = self.get_property_name()
                                                                                                                                                                                                                                          obj = self.targetObject()
                                                                                                                                                                                                                                          return obj.property(prop_name)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_property_value() -> Any

                                                                                                                                                                                                                                  Return the value of the property which should get animated.

                                                                                                                                                                                                                                  Source code in prettyqt/core/propertyanimation.py
                                                                                                                                                                                                                                  def get_property_value(self) -> Any:
                                                                                                                                                                                                                                      """Return the value of the property which should get animated."""
                                                                                                                                                                                                                                      prop_name = self.get_property_name()
                                                                                                                                                                                                                                      obj = self.targetObject()
                                                                                                                                                                                                                                      return obj.property(prop_name)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  RandomGenerator

                                                                                                                                                                                                                                  Bases: QRandomGenerator

                                                                                                                                                                                                                                  Allows one to obtain random values from a high-quality Random Number Generator.

                                                                                                                                                                                                                                  Source code in prettyqt/core/randomgenerator.py
                                                                                                                                                                                                                                  class RandomGenerator(QtCore.QRandomGenerator):
                                                                                                                                                                                                                                      """Allows one to obtain random values from a high-quality Random Number Generator."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  RangeModel

                                                                                                                                                                                                                                  Bases: AbstractItemModelMixin, QRangeModel

                                                                                                                                                                                                                                  Item model wrapping a Python sequence or table range.

                                                                                                                                                                                                                                  Source code in prettyqt/core/rangemodel.py
                                                                                                                                                                                                                                  class RangeModel(core.AbstractItemModelMixin, core.QRangeModel):
                                                                                                                                                                                                                                      """Item model wrapping a Python sequence or table range."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, data: Any, *args, **kwargs):
                                                                                                                                                                                                                                          if prettyqt.qt.PYQT6:
                                                                                                                                                                                                                                              abstract_range = getattr(core, "QPyAbstractRange", ())
                                                                                                                                                                                                                                              if not isinstance(data, abstract_range):
                                                                                                                                                                                                                                                  if (
                                                                                                                                                                                                                                                      isinstance(data, (list, tuple))
                                                                                                                                                                                                                                                      and data
                                                                                                                                                                                                                                                      and isinstance(data[0], (list, tuple))
                                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                                      data = core.QPyTableRange(data)  # ty: ignore[missing-attribute]
                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                      data = core.QPySequenceRange(data)  # ty: ignore[missing-attribute]
                                                                                                                                                                                                                                          super().__init__(data, *args, **kwargs)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def _get_map(self):
                                                                                                                                                                                                                                          maps = super()._get_map()
                                                                                                                                                                                                                                          maps |= {"autoConnectPolicy": AUTO_CONNECT_POLICY}
                                                                                                                                                                                                                                          return maps
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_auto_connect_policy(
                                                                                                                                                                                                                                          self, policy: AutoConnectPolicyStr | core.QRangeModel.AutoConnectPolicy
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Set the auto-connect policy.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              policy: auto-connect policy to use
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setAutoConnectPolicy(AUTO_CONNECT_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_auto_connect_policy(self) -> AutoConnectPolicyStr:
                                                                                                                                                                                                                                          """Return current auto-connect policy.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              auto-connect policy
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return AUTO_CONNECT_POLICY.inverse[self.autoConnectPolicy()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_auto_connect_policy() -> AutoConnectPolicyStr

                                                                                                                                                                                                                                  Return current auto-connect policy.

                                                                                                                                                                                                                                  Source code in prettyqt/core/rangemodel.py
                                                                                                                                                                                                                                  def get_auto_connect_policy(self) -> AutoConnectPolicyStr:
                                                                                                                                                                                                                                      """Return current auto-connect policy.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          auto-connect policy
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return AUTO_CONNECT_POLICY.inverse[self.autoConnectPolicy()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_auto_connect_policy(policy: AutoConnectPolicyStr | core.QRangeModel.AutoConnectPolicy)

                                                                                                                                                                                                                                  Set the auto-connect policy.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  policy AutoConnectPolicyStr | AutoConnectPolicy

                                                                                                                                                                                                                                  auto-connect policy to use

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/rangemodel.py
                                                                                                                                                                                                                                  def set_auto_connect_policy(
                                                                                                                                                                                                                                      self, policy: AutoConnectPolicyStr | core.QRangeModel.AutoConnectPolicy
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Set the auto-connect policy.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          policy: auto-connect policy to use
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setAutoConnectPolicy(AUTO_CONNECT_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  ReadWriteLock

                                                                                                                                                                                                                                  Bases: QReadWriteLock

                                                                                                                                                                                                                                  Read-write locking between threads.

                                                                                                                                                                                                                                  Source code in prettyqt/core/readwritelock.py
                                                                                                                                                                                                                                  class ReadWriteLock(QtCore.QReadWriteLock):
                                                                                                                                                                                                                                      """Read-write locking between threads."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          recursion_mode: RecursionModeStr
                                                                                                                                                                                                                                          | QtCore.QReadWriteLock.RecursionMode = "non_recursive",
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          super().__init__(RECURSION_MODE.get_enum_value(recursion_mode))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def lock_for_read(self, timeout: int | None = None) -> Generator[bool]:
                                                                                                                                                                                                                                          acquired = (
                                                                                                                                                                                                                                              self.tryLockForRead() if timeout is None else self.tryLockForRead(timeout)
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield acquired
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              if acquired:
                                                                                                                                                                                                                                                  self.unlock()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def lock_for_write(self, timeout: int | None = None) -> Generator[bool]:
                                                                                                                                                                                                                                          acquired = (
                                                                                                                                                                                                                                              self.tryLockForWrite() if timeout is None else self.tryLockForWrite(timeout)
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield acquired
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              if acquired:
                                                                                                                                                                                                                                                  self.unlock()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  RegularExpression

                                                                                                                                                                                                                                  Bases: QRegularExpression

                                                                                                                                                                                                                                  Pattern matching using regular expressions.

                                                                                                                                                                                                                                  Source code in prettyqt/core/regularexpression.py
                                                                                                                                                                                                                                  class RegularExpression(core.QRegularExpression):
                                                                                                                                                                                                                                      """Pattern matching using regular expressions."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          pattern: str | core.QRegularExpression | re.Pattern = "",
                                                                                                                                                                                                                                          flags: core.QRegularExpression.PatternOption = PATTERN_OPTIONS["none"],
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          match pattern:
                                                                                                                                                                                                                                              case core.QRegularExpression():
                                                                                                                                                                                                                                                  super().__init__(pattern)
                                                                                                                                                                                                                                              case re.Pattern():
                                                                                                                                                                                                                                                  qflag = self.PatternOption(0)
                                                                                                                                                                                                                                                  for flag in re.RegexFlag(pattern.flags):
                                                                                                                                                                                                                                                      if flag in RE_MAP:
                                                                                                                                                                                                                                                          qflag |= RE_MAP[flag]
                                                                                                                                                                                                                                                  super().__init__(pattern.pattern, qflag)
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  if isinstance(flags, int):
                                                                                                                                                                                                                                                      flags = core.RegularExpression.PatternOption(flags)
                                                                                                                                                                                                                                                  super().__init__(pattern, flags)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.pattern())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _pattern(self):
                                                                                                                                                                                                                                          return self.pattern()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      __match_args__ = ("_pattern",)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.pattern(), self.flags)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def globalMatch(self, *args, **kwargs) -> core.RegularExpressionMatchIterator:
                                                                                                                                                                                                                                          it = super().globalMatch(*args, **kwargs)
                                                                                                                                                                                                                                          return core.RegularExpressionMatchIterator(it)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def global_match(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          text: str,
                                                                                                                                                                                                                                          offset: int = 0,
                                                                                                                                                                                                                                          match_type: MatchTypeStr = "normal",
                                                                                                                                                                                                                                          anchored: bool = False,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          options = MATCH_OPTIONS["anchored"] if anchored else MATCH_OPTIONS["none"]
                                                                                                                                                                                                                                          return self.globalMatch(text, offset, MATCH_TYPE[match_type], options)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def match(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          text: str,
                                                                                                                                                                                                                                          offset: int = 0,
                                                                                                                                                                                                                                          match_type: MatchTypeStr | core.QRegularExpression.MatchType = "normal",
                                                                                                                                                                                                                                          anchored: bool = False,
                                                                                                                                                                                                                                      ) -> core.RegularExpressionMatch:
                                                                                                                                                                                                                                          typ = MATCH_TYPE[match_type] if isinstance(match_type, str) else match_type
                                                                                                                                                                                                                                          if isinstance(anchored, bool):
                                                                                                                                                                                                                                              options = MATCH_OPTIONS["anchored"] if anchored else MATCH_OPTIONS["none"]
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              options = anchored
                                                                                                                                                                                                                                          match = super().match(text, offset, typ, options)
                                                                                                                                                                                                                                          return core.RegularExpressionMatch(match)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def fullmatch(
                                                                                                                                                                                                                                          self, string: str, pos: int = 0, endpos: int | None = None
                                                                                                                                                                                                                                      ) -> core.RegularExpressionMatch | None:
                                                                                                                                                                                                                                          if endpos is not None:
                                                                                                                                                                                                                                              string = string[:endpos]
                                                                                                                                                                                                                                          match = super().match(string, pos)
                                                                                                                                                                                                                                          if (
                                                                                                                                                                                                                                              match.hasMatch()
                                                                                                                                                                                                                                              and match.capturedStart() == pos
                                                                                                                                                                                                                                              and match.capturedEnd() == len(string)
                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                              return core.RegularExpressionMatch(match)
                                                                                                                                                                                                                                          return None
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def finditer(
                                                                                                                                                                                                                                          self, string: str, pos: int = 0, endpos: int | None = None
                                                                                                                                                                                                                                      ) -> Iterator[core.RegularExpressionMatch]:
                                                                                                                                                                                                                                          for match in self.globalMatch(string[:endpos], offset=pos):
                                                                                                                                                                                                                                              match.pos = pos
                                                                                                                                                                                                                                              match.endpos = endpos
                                                                                                                                                                                                                                              match.string = string
                                                                                                                                                                                                                                              yield match
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def findall(self, string: str, pos: int = 0, endpos: int | None = None) -> list:
                                                                                                                                                                                                                                          matches = list(self.globalMatch(string[:endpos], offset=pos))
                                                                                                                                                                                                                                          return [m.groups() if len(m.groups()) > 1 else m.group(0) for m in matches]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def subn(self, repl: str | Callable, string: str, count: int = 0) -> tuple[str, int]:
                                                                                                                                                                                                                                          result = string
                                                                                                                                                                                                                                          matches = list(self.global_match(string))
                                                                                                                                                                                                                                          if count > 0:
                                                                                                                                                                                                                                              matches = matches[:count]
                                                                                                                                                                                                                                          num_subs = len(matches)
                                                                                                                                                                                                                                          for m in reversed(matches):
                                                                                                                                                                                                                                              to_replace = repl if isinstance(repl, str) else repl(m)
                                                                                                                                                                                                                                              for j in range(self.groups + 1):
                                                                                                                                                                                                                                                  to_replace = to_replace.replace(rf"\g<{j}>", m.group(j))
                                                                                                                                                                                                                                              for k in self.groupindex:
                                                                                                                                                                                                                                                  to_replace = to_replace.replace(rf"\g<{k}>", m.group(k))
                                                                                                                                                                                                                                              result = result[: m.start()] + to_replace + result[m.end() :]
                                                                                                                                                                                                                                          return (result, num_subs)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def sub(self, repl: str | Callable, string: str, count: int = 0) -> str:
                                                                                                                                                                                                                                          res = self.subn(repl, string, count)
                                                                                                                                                                                                                                          return res[0]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def search(
                                                                                                                                                                                                                                          self, string: str, pos: int = 0, endpos: int | None = None
                                                                                                                                                                                                                                      ) -> core.RegularExpressionMatch | None:
                                                                                                                                                                                                                                          match = super().match(string[:endpos], pos)
                                                                                                                                                                                                                                          return core.RegularExpressionMatch(match) if match.hasMatch() else None
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def split(self, string: str, maxsplit: int = 0):
                                                                                                                                                                                                                                          raise NotImplementedError
                                                                                                                                                                                                                                          # result = []
                                                                                                                                                                                                                                          # matches = self.global_match(string)
                                                                                                                                                                                                                                          # matches = list(matches)
                                                                                                                                                                                                                                          # if 0 < maxsplit <= len(matches):
                                                                                                                                                                                                                                          #     remainder = string[matches[maxsplit - 1].end() :]
                                                                                                                                                                                                                                          # else:
                                                                                                                                                                                                                                          #     remainder = None
                                                                                                                                                                                                                                          # if maxsplit > 0:
                                                                                                                                                                                                                                          #     matches = matches[:maxsplit]
                                                                                                                                                                                                                                          # prev_match = None
                                                                                                                                                                                                                                          # m = matches[0]
                                                                                                                                                                                                                                          # if m.start() == 0:
                                                                                                                                                                                                                                          #     result.append("")
                                                                                                                                                                                                                                          # else:
                                                                                                                                                                                                                                          #     result.append(string[0 : m.start()])
                                                                                                                                                                                                                                          # for g in m.groups():
                                                                                                                                                                                                                                          #     result.append(g)
                                                                                                                                                                                                                                          # prev_match = m
                                                                                                                                                                                                                                          # for m in matches[1:]:
                                                                                                                                                                                                                                          #     result.append(string[prev_match.end() : m.start()])
                                                                                                                                                                                                                                          #     for g in m.groups():
                                                                                                                                                                                                                                          #         result.append(g)
                                                                                                                                                                                                                                          #     if m.end() == len(string):
                                                                                                                                                                                                                                          #         result.append("")
                                                                                                                                                                                                                                          #     prev_match = m
                                                                                                                                                                                                                                          # if remainder:
                                                                                                                                                                                                                                          #     result.append(remainder)
                                                                                                                                                                                                                                          # return result
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def groups(self) -> int:
                                                                                                                                                                                                                                          return self.captureCount()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def groupindex(self) -> dict[str, int]:
                                                                                                                                                                                                                                          return {k: i for i, k in enumerate(self.namedCaptureGroups()[1:], start=1) if k}
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def flags(self) -> core.QRegularExpression.PatternOption:
                                                                                                                                                                                                                                          return self.patternOptions()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def to_py_pattern(self) -> re.Pattern:
                                                                                                                                                                                                                                          flag = re.RegexFlag(0)
                                                                                                                                                                                                                                          for qflag in self.patternOptions():
                                                                                                                                                                                                                                              if qflag in RE_MAP.inverse:
                                                                                                                                                                                                                                                  flag |= RE_MAP.inverse[qflag]
                                                                                                                                                                                                                                          return re.compile(self.pattern(), flag)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  RegularExpressionMatch

                                                                                                                                                                                                                                  Bases: QRegularExpressionMatch

                                                                                                                                                                                                                                  The results of a matching a QRegularExpression against a string.

                                                                                                                                                                                                                                  Source code in prettyqt/core/regularexpressionmatch.py
                                                                                                                                                                                                                                  class RegularExpressionMatch(core.QRegularExpressionMatch):
                                                                                                                                                                                                                                      """The results of a matching a QRegularExpression against a string."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                          super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                          self.string = None
                                                                                                                                                                                                                                          self.pos = None
                                                                                                                                                                                                                                          self.endpos = None
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getitem__(self, item: int | str) -> str:
                                                                                                                                                                                                                                          if captured := self.captured(item):
                                                                                                                                                                                                                                              return captured
                                                                                                                                                                                                                                          raise KeyError(item)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return self.isValid()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_match_type(self) -> core.regularexpression.MatchTypeStr:
                                                                                                                                                                                                                                          return core.regularexpression.MATCH_TYPE.inverse[self.matchType()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def group(self, *groups: int | str) -> tuple[str, ...] | str:
                                                                                                                                                                                                                                          match len(groups):
                                                                                                                                                                                                                                              case 0:
                                                                                                                                                                                                                                                  return self.captured(0)
                                                                                                                                                                                                                                              case 1:
                                                                                                                                                                                                                                                  return self.captured(groups[0])
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  return tuple(self.captured(i) for i in groups)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def groups(self, default=None) -> tuple:
                                                                                                                                                                                                                                          if self.lastindex is None:
                                                                                                                                                                                                                                              return ()
                                                                                                                                                                                                                                          return tuple(
                                                                                                                                                                                                                                              self.group(i) if i <= self.lastindex else default
                                                                                                                                                                                                                                              for i in range(self.re.captureCount())
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def groupdict(self, default=None) -> dict[str, Any]:
                                                                                                                                                                                                                                          if self.lastindex is None:
                                                                                                                                                                                                                                              return {}
                                                                                                                                                                                                                                          groups = [
                                                                                                                                                                                                                                              self.group(i) if i <= self.lastindex else default
                                                                                                                                                                                                                                              for i in range(self.re.captureCount())
                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                          names = self.re.namedCaptureGroups()
                                                                                                                                                                                                                                          return {names[i]: groups[i] for i in range(self.re.captureCount())}
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def start(self, group: int = 0) -> int:
                                                                                                                                                                                                                                          return self.capturedStart(group)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def end(self, group: int = 0) -> int:
                                                                                                                                                                                                                                          return self.capturedEnd(group)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def span(self, group: int = 0) -> tuple[int, int]:
                                                                                                                                                                                                                                          return (self.capturedStart(group), self.capturedEnd(group))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def lastindex(self) -> int | None:
                                                                                                                                                                                                                                          idx = self.lastCapturedIndex()
                                                                                                                                                                                                                                          return None if idx == -1 else idx
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def lastgroup(self) -> str | None:
                                                                                                                                                                                                                                          if self.lastCapturedIndex() == -1:
                                                                                                                                                                                                                                              return None
                                                                                                                                                                                                                                          return self.re.namedCaptureGroups()[self.lastCapturedIndex()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def re(self) -> core.QRegularExpression:
                                                                                                                                                                                                                                          return self.regularExpression()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def partial(self) -> bool:
                                                                                                                                                                                                                                          return self.hasPartialMatch()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  RegularExpressionMatchIterator

                                                                                                                                                                                                                                  Bases: QRegularExpressionMatchIterator

                                                                                                                                                                                                                                  Iterator on the results of a global match of a QRegularExpression.

                                                                                                                                                                                                                                  Source code in prettyqt/core/regularexpressionmatchiterator.py
                                                                                                                                                                                                                                  class RegularExpressionMatchIterator(core.QRegularExpressionMatchIterator):
                                                                                                                                                                                                                                      """Iterator on the results of a global match of a QRegularExpression."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __iter__(self):
                                                                                                                                                                                                                                          return self
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __next__(self):
                                                                                                                                                                                                                                          if self.hasNext():
                                                                                                                                                                                                                                              return core.RegularExpressionMatch(self.next())
                                                                                                                                                                                                                                          raise StopIteration
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def peek_next(self) -> core.RegularExpressionMatch:
                                                                                                                                                                                                                                          return core.RegularExpressionMatch(self.peekNext())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Resource

                                                                                                                                                                                                                                  Bases: QResource

                                                                                                                                                                                                                                  Interface for reading directly from resources.

                                                                                                                                                                                                                                  Source code in prettyqt/core/_resource.py
                                                                                                                                                                                                                                  class Resource(core.QResource):
                                                                                                                                                                                                                                      """Interface for reading directly from resources."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.absoluteFilePath(), self.get_locale())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.absoluteFilePath(), self.get_locale())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bytes__(self):
                                                                                                                                                                                                                                          return bytes(self.uncompressedData().data())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return self.isValid()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __iter__(self) -> Iterator[str]:
                                                                                                                                                                                                                                          return iter(self.children())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_compression_algorithm(self) -> CompressionStr:
                                                                                                                                                                                                                                          return COMPRESSION.inverse[self.compressionAlgorithm()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_absolute_file_path(self) -> pathlib.Path:
                                                                                                                                                                                                                                          return pathlib.Path(self.absoluteFilePath())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_locale(self) -> core.Locale:
                                                                                                                                                                                                                                          return core.Locale(self.locale())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_last_modified(self) -> core.DateTime:
                                                                                                                                                                                                                                          return core.DateTime(self.lastModified())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_file_name(self, path: datatypes.PathType):
                                                                                                                                                                                                                                          self.setFileName(os.fspath(path))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_file_name(self) -> pathlib.Path:
                                                                                                                                                                                                                                          return pathlib.Path(self.fileName())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def register_resource(cls, path: datatypes.PathType, root: str = ""):
                                                                                                                                                                                                                                          cls.registerResource(os.fspath(path), root)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Runnable

                                                                                                                                                                                                                                  Bases: QRunnable

                                                                                                                                                                                                                                  The base class for all runnable objects.

                                                                                                                                                                                                                                  Source code in prettyqt/core/runnable.py
                                                                                                                                                                                                                                  class Runnable(QtCore.QRunnable):
                                                                                                                                                                                                                                      """The base class for all runnable objects."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  SaveFile

                                                                                                                                                                                                                                  Bases: FileDeviceMixin, QSaveFile

                                                                                                                                                                                                                                  Interface for safely writing to files.

                                                                                                                                                                                                                                  Source code in prettyqt/core/savefile.py
                                                                                                                                                                                                                                  class SaveFile(core.FileDeviceMixin, core.QSaveFile):
                                                                                                                                                                                                                                      """Interface for safely writing to files."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Semaphore

                                                                                                                                                                                                                                  Bases: QSemaphore

                                                                                                                                                                                                                                  General counting semaphore.

                                                                                                                                                                                                                                  Source code in prettyqt/core/semaphore.py
                                                                                                                                                                                                                                  class Semaphore(QtCore.QSemaphore):
                                                                                                                                                                                                                                      """General counting semaphore."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def acquire_resources(self, n: int = 1) -> Generator[bool]:
                                                                                                                                                                                                                                          acquired = self.tryAcquire(n)
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield acquired
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              if acquired:
                                                                                                                                                                                                                                                  self.release(n)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  SequentialAnimationGroup

                                                                                                                                                                                                                                  Bases: AnimationGroupMixin, QSequentialAnimationGroup

                                                                                                                                                                                                                                  Sequential group of animations.

                                                                                                                                                                                                                                  Source code in prettyqt/core/sequentialanimationgroup.py
                                                                                                                                                                                                                                  class SequentialAnimationGroup(core.AnimationGroupMixin, core.QSequentialAnimationGroup):
                                                                                                                                                                                                                                      """Sequential group of animations."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def reverse(self):
                                                                                                                                                                                                                                          """Reverse animation in-place by switching start and end values."""
                                                                                                                                                                                                                                          for anim in reversed(list(self)):
                                                                                                                                                                                                                                              if not isinstance(anim, core.QVariantAnimation):
                                                                                                                                                                                                                                                  continue
                                                                                                                                                                                                                                              old_start = anim.startValue()
                                                                                                                                                                                                                                              old_end = anim.endValue()
                                                                                                                                                                                                                                              anim.setStartValue(old_end)
                                                                                                                                                                                                                                              anim.setEndValue(old_start)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def reversed(self) -> SequentialAnimationGroup:
                                                                                                                                                                                                                                          """Return a reversed copy of the animation."""
                                                                                                                                                                                                                                          new = core.MetaObject(self.metaObject()).copy(self)
                                                                                                                                                                                                                                          for anim in reversed(list(self)):
                                                                                                                                                                                                                                              if not isinstance(
                                                                                                                                                                                                                                                  anim, core.VariantAnimationMixin | SequentialAnimationGroup
                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                  raise TypeError(anim)
                                                                                                                                                                                                                                              new.addAnimation(anim.reversed())
                                                                                                                                                                                                                                          return new
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def append_reversed(self) -> core.SequentialAnimationGroup:
                                                                                                                                                                                                                                          """Return copy of animation with appended reverse animation."""
                                                                                                                                                                                                                                          revers = self.reversed()
                                                                                                                                                                                                                                          animation = core.SequentialAnimationGroup()
                                                                                                                                                                                                                                          animation.addAnimation(self)
                                                                                                                                                                                                                                          animation.addAnimation(revers)
                                                                                                                                                                                                                                          return animation
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  append_reversed() -> core.SequentialAnimationGroup

                                                                                                                                                                                                                                  Return copy of animation with appended reverse animation.

                                                                                                                                                                                                                                  Source code in prettyqt/core/sequentialanimationgroup.py
                                                                                                                                                                                                                                  def append_reversed(self) -> core.SequentialAnimationGroup:
                                                                                                                                                                                                                                      """Return copy of animation with appended reverse animation."""
                                                                                                                                                                                                                                      revers = self.reversed()
                                                                                                                                                                                                                                      animation = core.SequentialAnimationGroup()
                                                                                                                                                                                                                                      animation.addAnimation(self)
                                                                                                                                                                                                                                      animation.addAnimation(revers)
                                                                                                                                                                                                                                      return animation
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  reverse()

                                                                                                                                                                                                                                  Reverse animation in-place by switching start and end values.

                                                                                                                                                                                                                                  Source code in prettyqt/core/sequentialanimationgroup.py
                                                                                                                                                                                                                                  def reverse(self):
                                                                                                                                                                                                                                      """Reverse animation in-place by switching start and end values."""
                                                                                                                                                                                                                                      for anim in reversed(list(self)):
                                                                                                                                                                                                                                          if not isinstance(anim, core.QVariantAnimation):
                                                                                                                                                                                                                                              continue
                                                                                                                                                                                                                                          old_start = anim.startValue()
                                                                                                                                                                                                                                          old_end = anim.endValue()
                                                                                                                                                                                                                                          anim.setStartValue(old_end)
                                                                                                                                                                                                                                          anim.setEndValue(old_start)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  reversed() -> SequentialAnimationGroup

                                                                                                                                                                                                                                  Return a reversed copy of the animation.

                                                                                                                                                                                                                                  Source code in prettyqt/core/sequentialanimationgroup.py
                                                                                                                                                                                                                                  def reversed(self) -> SequentialAnimationGroup:
                                                                                                                                                                                                                                      """Return a reversed copy of the animation."""
                                                                                                                                                                                                                                      new = core.MetaObject(self.metaObject()).copy(self)
                                                                                                                                                                                                                                      for anim in reversed(list(self)):
                                                                                                                                                                                                                                          if not isinstance(
                                                                                                                                                                                                                                              anim, core.VariantAnimationMixin | SequentialAnimationGroup
                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                              raise TypeError(anim)
                                                                                                                                                                                                                                          new.addAnimation(anim.reversed())
                                                                                                                                                                                                                                      return new
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Settings

                                                                                                                                                                                                                                  Bases: Settings_

                                                                                                                                                                                                                                  Settings class which wraps everything into a dict to preserve data types.

                                                                                                                                                                                                                                  Source code in prettyqt/core/settings.py
                                                                                                                                                                                                                                  class Settings(Settings_):
                                                                                                                                                                                                                                      """Settings class which wraps everything into a dict to preserve data types."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_value(self, key: str, value):
                                                                                                                                                                                                                                          match value:
                                                                                                                                                                                                                                              case Settings_():
                                                                                                                                                                                                                                                  setting = dict(value=dict(value), typ="subsetting")
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  setting = dict(value=value, typ="regular")
                                                                                                                                                                                                                                          super().set_value(key, setting)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_value(self, key: str, default=None):
                                                                                                                                                                                                                                          if not self.contains(key):
                                                                                                                                                                                                                                              return default
                                                                                                                                                                                                                                          val = self.value(key)
                                                                                                                                                                                                                                          # TODO: convert settings dicts back?
                                                                                                                                                                                                                                          match val:
                                                                                                                                                                                                                                              case {"value": setting}:
                                                                                                                                                                                                                                                  return setting
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  # this is for migration
                                                                                                                                                                                                                                                  self.set_value(key, val)
                                                                                                                                                                                                                                                  return val
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  SharedMemory

                                                                                                                                                                                                                                  Bases: ObjectMixin, QSharedMemory

                                                                                                                                                                                                                                  Access to a shared memory segment.

                                                                                                                                                                                                                                  Source code in prettyqt/core/sharedmemory.py
                                                                                                                                                                                                                                  class SharedMemory(core.ObjectMixin, core.QSharedMemory):
                                                                                                                                                                                                                                      """Access to a shared memory segment."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.key())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.key(),)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_error(self) -> SharedMemoryErrorStr:
                                                                                                                                                                                                                                          return SHARED_MEMORY_ERROR.inverse[self.error()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  SignalBlocker

                                                                                                                                                                                                                                  Bases: QSignalBlocker

                                                                                                                                                                                                                                  Exception-safe wrapper around QObject.blockSignals().

                                                                                                                                                                                                                                  Source code in prettyqt/core/signalblocker.py
                                                                                                                                                                                                                                  class SignalBlocker(QtCore.QSignalBlocker):
                                                                                                                                                                                                                                      """Exception-safe wrapper around QObject.blockSignals()."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  SignalMapper

                                                                                                                                                                                                                                  Bases: ObjectMixin, QSignalMapper

                                                                                                                                                                                                                                  Bundles signals from identifiable senders.

                                                                                                                                                                                                                                  Source code in prettyqt/core/signalmapper.py
                                                                                                                                                                                                                                  class SignalMapper(core.ObjectMixin, core.QSignalMapper):
                                                                                                                                                                                                                                      """Bundles signals from identifiable senders."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getitem__(self, index: int | str | core.QObject) -> core.QObject:
                                                                                                                                                                                                                                          return self.mapping(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __delitem__(self, index: core.QObject):
                                                                                                                                                                                                                                          return self.removeMappings(index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __setitem__(self, index: core.QObject, value: int | str | core.QObject):
                                                                                                                                                                                                                                          self.setMapping(index, value)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Size

                                                                                                                                                                                                                                  Bases: QSize

                                                                                                                                                                                                                                  Defines the size of a two-dimensional object using integer point precision.

                                                                                                                                                                                                                                  Source code in prettyqt/core/size.py
                                                                                                                                                                                                                                  class Size(QtCore.QSize):
                                                                                                                                                                                                                                      """Defines the size of a two-dimensional object using integer point precision."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.width(), self.height())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _width(self) -> int:
                                                                                                                                                                                                                                          return self.width()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _height(self) -> int:
                                                                                                                                                                                                                                          return self.height()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      __match_args__ = ("_width", "_height")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getitem__(self, index) -> int:
                                                                                                                                                                                                                                          return (self.width(), self.height())[index]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.width(), self.height())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def expanded_to(self, size: datatypes.SizeType) -> Self:
                                                                                                                                                                                                                                          size = datatypes.to_size(size)
                                                                                                                                                                                                                                          return type(self)(self.expandedTo(size))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def shrunk_by(self, margins: datatypes.MarginsType) -> Self:
                                                                                                                                                                                                                                          margins = datatypes.to_margins(margins)
                                                                                                                                                                                                                                          return type(self)(self.shrunkBy(margins))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def grown_by(self, margins: datatypes.MarginsType) -> Self:
                                                                                                                                                                                                                                          margins = datatypes.to_margins(margins)
                                                                                                                                                                                                                                          return type(self)(self.grownBy(margins))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  SizeF

                                                                                                                                                                                                                                  Bases: QSizeF

                                                                                                                                                                                                                                  Defines the size of a two-dimensional object using floating point precision.

                                                                                                                                                                                                                                  Source code in prettyqt/core/sizef.py
                                                                                                                                                                                                                                  class SizeF(QtCore.QSizeF):
                                                                                                                                                                                                                                      """Defines the size of a two-dimensional object using floating point precision."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.width(), self.height())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _width(self) -> float:
                                                                                                                                                                                                                                          return self.width()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _height(self) -> float:
                                                                                                                                                                                                                                          return self.height()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      __match_args__ = ("_width", "_height")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getitem__(self, index) -> float:
                                                                                                                                                                                                                                          return (self.width(), self.height())[index]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.width(), self.height())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def expanded_to(self, size: datatypes.SizeFType) -> Self:
                                                                                                                                                                                                                                          size = datatypes.to_sizef(size)
                                                                                                                                                                                                                                          return type(self)(self.expandedTo(size))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def shrunk_by(self, margins: datatypes.MarginsFType) -> Self:
                                                                                                                                                                                                                                          margins = datatypes.to_marginsf(margins)
                                                                                                                                                                                                                                          return type(self)(self.shrunkBy(margins))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def grown_by(self, margins: datatypes.MarginsFType) -> Self:
                                                                                                                                                                                                                                          margins = datatypes.to_marginsf(margins)
                                                                                                                                                                                                                                          return type(self)(self.grownBy(margins))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  SocketNotifier

                                                                                                                                                                                                                                  Bases: ObjectMixin, QSocketNotifier

                                                                                                                                                                                                                                  Support for monitoring activity on a file descriptor.

                                                                                                                                                                                                                                  Source code in prettyqt/core/socketnotifier.py
                                                                                                                                                                                                                                  class SocketNotifier(core.ObjectMixin, core.QSocketNotifier):
                                                                                                                                                                                                                                      """Support for monitoring activity on a file descriptor."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      # def __repr__(self):
                                                                                                                                                                                                                                      #     return f"{type(self).__name__}({self.socket()}, {self.type()})"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_type(self) -> TypeStr:
                                                                                                                                                                                                                                          """Return socket event type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              socket event type
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return TYPE.inverse[self.type()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_type() -> TypeStr

                                                                                                                                                                                                                                  Return socket event type.

                                                                                                                                                                                                                                  Source code in prettyqt/core/socketnotifier.py
                                                                                                                                                                                                                                  def get_type(self) -> TypeStr:
                                                                                                                                                                                                                                      """Return socket event type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          socket event type
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return TYPE.inverse[self.type()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  SortFilterProxyModel

                                                                                                                                                                                                                                  Bases: AbstractProxyModelMixin, QSortFilterProxyModel

                                                                                                                                                                                                                                  Support for sorting and filtering data passed between another model and a view.

                                                                                                                                                                                                                                  Source code in prettyqt/core/sortfilterproxymodel.py
                                                                                                                                                                                                                                  class SortFilterProxyModel(core.AbstractProxyModelMixin, core.QSortFilterProxyModel):
                                                                                                                                                                                                                                      """Support for sorting and filtering data passed between another model and a view."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      FilterMode = core.Enum(FilterMode)
                                                                                                                                                                                                                                      invalidated = core.Signal()
                                                                                                                                                                                                                                      filter_mode_changed = core.Signal(str)
                                                                                                                                                                                                                                      ID = "sort_filter"
                                                                                                                                                                                                                                      ICON = "mdi.table-filter"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                          self._filter_mode: FilterModeStr = "wildcard"
                                                                                                                                                                                                                                          super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      #     self._filter_column = 0
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      # def setFilterKeyColumn(self, column: int | list[int] | None):
                                                                                                                                                                                                                                      #     if column is None:
                                                                                                                                                                                                                                      #         column = -1
                                                                                                                                                                                                                                      #     self._filter_column = column
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      # def filterKeyColumn(self) -> int | list[int] | None:
                                                                                                                                                                                                                                      #     return self._filter_column
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      # def filterAcceptsRow(self, source_row: int, source_index: core.ModelIndex):
                                                                                                                                                                                                                                      #     column = self.filterKeyColumn()
                                                                                                                                                                                                                                      #     col_count = self.sourceModel().columnCount()
                                                                                                                                                                                                                                      #     indexes = [
                                                                                                                                                                                                                                      #         self.sourceModel().index(source_row, i, source_index) for i in col_count
                                                                                                                                                                                                                                      #     ]
                                                                                                                                                                                                                                      #     labels = [self.sourceModel().data(idx) for idx in indexes]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      #     if isinstance(column, int) and source_index.column() == column:
                                                                                                                                                                                                                                      #         return super().filterAcceptsRow(source_row, source_index)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def filterAcceptsRow(self, source_row: int, source_index: core.ModelIndex) -> bool:
                                                                                                                                                                                                                                          if self._filter_mode != "fuzzy":
                                                                                                                                                                                                                                              return super().filterAcceptsRow(source_row, source_index)
                                                                                                                                                                                                                                          source_model = self.sourceModel()
                                                                                                                                                                                                                                          if source_model is None:
                                                                                                                                                                                                                                              return False
                                                                                                                                                                                                                                          column = self.filterKeyColumn()
                                                                                                                                                                                                                                          columns = (
                                                                                                                                                                                                                                              range(source_model.columnCount(source_index)) if column == -1 else [column]
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                          pattern = self.filterRegularExpression().pattern()
                                                                                                                                                                                                                                          case_sensitive = self.is_filter_case_sensitive()
                                                                                                                                                                                                                                          role = self.filterRole()
                                                                                                                                                                                                                                          for col in columns:
                                                                                                                                                                                                                                              idx = source_model.index(source_row, col, source_index)
                                                                                                                                                                                                                                              data = source_model.data(idx, role)
                                                                                                                                                                                                                                              if data is None:
                                                                                                                                                                                                                                                  continue
                                                                                                                                                                                                                                              text = data if isinstance(data, str) else str(data)
                                                                                                                                                                                                                                              if sublime_search.fuzzy_match_simple(
                                                                                                                                                                                                                                                  pattern, text, case_sensitive=case_sensitive
                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                  return True
                                                                                                                                                                                                                                          return False
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def invalidate(self):
                                                                                                                                                                                                                                          super().invalidate()
                                                                                                                                                                                                                                          self.invalidated.emit()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def change_filter(
                                                                                                                                                                                                                                          self, direction: DirectionStr | core.QSortFilterProxyModel.Direction = "both"
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Context manager wrapping beginFilterChange() / endFilterChange()."""
                                                                                                                                                                                                                                          self.beginFilterChange()
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              self.endFilterChange(DIRECTION.get_enum_value(direction))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def invalidate_rows_filter(self):
                                                                                                                                                                                                                                          """Invalidate row filtering using Qt 6.9+ begin/endFilterChange."""
                                                                                                                                                                                                                                          self.beginFilterChange()
                                                                                                                                                                                                                                          self.endFilterChange(self.Direction.Rows)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def lessThan(self, left, right) -> bool:
                                                                                                                                                                                                                                          role = super().sortRole()
                                                                                                                                                                                                                                          left_data = left.data(role)
                                                                                                                                                                                                                                          right_data = right.data(role)
                                                                                                                                                                                                                                          if left_data is None and right_data is None:
                                                                                                                                                                                                                                              return False
                                                                                                                                                                                                                                          if left_data is None:
                                                                                                                                                                                                                                              return True
                                                                                                                                                                                                                                          if right_data is None:
                                                                                                                                                                                                                                              return False
                                                                                                                                                                                                                                          return left_data < right_data
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def sort(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          column: int | None,
                                                                                                                                                                                                                                          ascending: bool | constants.SortOrder = constants.ASCENDING,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          if isinstance(ascending, bool):
                                                                                                                                                                                                                                              ascending = constants.ASCENDING if ascending else constants.DESCENDING
                                                                                                                                                                                                                                          if column is None:
                                                                                                                                                                                                                                              column = -1
                                                                                                                                                                                                                                          super().sort(column, ascending)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def setFilterRegularExpression(self, pattern: datatypes.PatternType | str):
                                                                                                                                                                                                                                          if isinstance(pattern, re.Pattern):
                                                                                                                                                                                                                                              pattern = core.RegularExpression(pattern)
                                                                                                                                                                                                                                          super().setFilterRegularExpression(pattern)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def setFilterString(self, search_str: str):
                                                                                                                                                                                                                                          pat = ".*?".join(map(re.escape, search_str))
                                                                                                                                                                                                                                          pat = f"(?=({pat}))"
                                                                                                                                                                                                                                          super().setFilterRegularExpression(pat)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def setFixedFilterList(self, filter_list: Iterable[str]):
                                                                                                                                                                                                                                          pat = "|".join(filter_list)
                                                                                                                                                                                                                                          super().setFilterRegularExpression(pat)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_filter_case_sensitivity(
                                                                                                                                                                                                                                          self, sensitivity: constants.CaseSensitivityStr | constants.CaseSensitivity
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Set the filter case sensitivity.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              sensitivity: filter case sensitivity
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          value = constants.CASE_SENSITIVITY.get_enum_value(sensitivity)
                                                                                                                                                                                                                                          super().setFilterCaseSensitivity(value)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_filter_case_sensitivity(self) -> constants.CaseSensitivityStr:
                                                                                                                                                                                                                                          """Return current filter case sensitivity.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              filter case sensitivity
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return constants.CASE_SENSITIVITY.inverse[super().filterCaseSensitivity()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_filter_case_sensitive(self, state: bool):
                                                                                                                                                                                                                                          if state:
                                                                                                                                                                                                                                              sensitivity = constants.CaseSensitivity.CaseSensitive
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              sensitivity = constants.CaseSensitivity.CaseInsensitive
                                                                                                                                                                                                                                          super().setFilterCaseSensitivity(sensitivity)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def is_filter_case_sensitive(self) -> bool:
                                                                                                                                                                                                                                          return super().filterCaseSensitivity() == constants.CaseSensitivity.CaseSensitive
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_sort_case_sensitive(self, state: bool):
                                                                                                                                                                                                                                          if state:
                                                                                                                                                                                                                                              sensitivity = constants.CaseSensitivity.CaseSensitive
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              sensitivity = constants.CaseSensitivity.CaseInsensitive
                                                                                                                                                                                                                                          super().setSortCaseSensitivity(sensitivity)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def is_sort_case_sensitive(self) -> bool:
                                                                                                                                                                                                                                          return super().sortCaseSensitivity() == constants.CaseSensitivity.CaseSensitive
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_filter_regular_expression(self) -> core.RegularExpression:
                                                                                                                                                                                                                                          return core.RegularExpression(self.filterRegularExpression())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_sort_role(self, role: constants.ItemDataRoleStr | int):
                                                                                                                                                                                                                                          role = constants.ITEM_DATA_ROLE[role] if isinstance(role, str) else role
                                                                                                                                                                                                                                          super().setSortRole(role)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_filter_role(self, role: constants.ItemDataRoleStr | int):
                                                                                                                                                                                                                                          role = constants.ITEM_DATA_ROLE[role] if isinstance(role, str) else role
                                                                                                                                                                                                                                          super().setFilterRole(role)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_sort_order(self) -> Literal["ascending", "descending"]:
                                                                                                                                                                                                                                          return "ascending" if super().sortOrder() == constants.ASCENDING else "descending"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_filter_key_column(self, column: int | None):
                                                                                                                                                                                                                                          if column is None:
                                                                                                                                                                                                                                              column = -1
                                                                                                                                                                                                                                          super().setFilterKeyColumn(column)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_search_term(self, search_term: str | Iterable[str]):
                                                                                                                                                                                                                                          if not isinstance(search_term, str):
                                                                                                                                                                                                                                              if self._filter_mode != "fixed_string":
                                                                                                                                                                                                                                                  raise TypeError(search_term)
                                                                                                                                                                                                                                              self.setFixedFilterList(list(search_term))
                                                                                                                                                                                                                                              return
                                                                                                                                                                                                                                          match self._filter_mode:
                                                                                                                                                                                                                                              case "fixed_string":
                                                                                                                                                                                                                                                  self.setFilterFixedString(search_term)
                                                                                                                                                                                                                                              case "substring":
                                                                                                                                                                                                                                                  self.setFilterString(search_term)
                                                                                                                                                                                                                                              case "fuzzy":
                                                                                                                                                                                                                                                  self.setFilterFixedString(search_term)
                                                                                                                                                                                                                                              case "wildcard":
                                                                                                                                                                                                                                                  self.setFilterWildcard(search_term)
                                                                                                                                                                                                                                              case "regex":
                                                                                                                                                                                                                                                  self.setFilterRegularExpression(search_term)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_filter_mode(self) -> FilterModeStr:
                                                                                                                                                                                                                                          return self._filter_mode
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_filter_mode(self, mode: FilterModeStr):
                                                                                                                                                                                                                                          self._filter_mode = mode
                                                                                                                                                                                                                                          self.filter_mode_changed.emit(mode)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      filterMode = core.Property(  # noqa: N815
                                                                                                                                                                                                                                          str,
                                                                                                                                                                                                                                          get_filter_mode,
                                                                                                                                                                                                                                          set_filter_mode,
                                                                                                                                                                                                                                          notify=filter_mode_changed,
                                                                                                                                                                                                                                          doc="Mode to use for filtering",
                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  change_filter(direction: DirectionStr | core.QSortFilterProxyModel.Direction = 'both')

                                                                                                                                                                                                                                  Context manager wrapping beginFilterChange() / endFilterChange().

                                                                                                                                                                                                                                  Source code in prettyqt/core/sortfilterproxymodel.py
                                                                                                                                                                                                                                  @contextlib.contextmanager
                                                                                                                                                                                                                                  def change_filter(
                                                                                                                                                                                                                                      self, direction: DirectionStr | core.QSortFilterProxyModel.Direction = "both"
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Context manager wrapping beginFilterChange() / endFilterChange()."""
                                                                                                                                                                                                                                      self.beginFilterChange()
                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          yield
                                                                                                                                                                                                                                      finally:
                                                                                                                                                                                                                                          self.endFilterChange(DIRECTION.get_enum_value(direction))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_filter_case_sensitivity() -> constants.CaseSensitivityStr

                                                                                                                                                                                                                                  Return current filter case sensitivity.

                                                                                                                                                                                                                                  Source code in prettyqt/core/sortfilterproxymodel.py
                                                                                                                                                                                                                                  def get_filter_case_sensitivity(self) -> constants.CaseSensitivityStr:
                                                                                                                                                                                                                                      """Return current filter case sensitivity.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          filter case sensitivity
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return constants.CASE_SENSITIVITY.inverse[super().filterCaseSensitivity()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  invalidate_rows_filter()

                                                                                                                                                                                                                                  Invalidate row filtering using Qt 6.9+ begin/endFilterChange.

                                                                                                                                                                                                                                  Source code in prettyqt/core/sortfilterproxymodel.py
                                                                                                                                                                                                                                  def invalidate_rows_filter(self):
                                                                                                                                                                                                                                      """Invalidate row filtering using Qt 6.9+ begin/endFilterChange."""
                                                                                                                                                                                                                                      self.beginFilterChange()
                                                                                                                                                                                                                                      self.endFilterChange(self.Direction.Rows)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_filter_case_sensitivity(sensitivity: constants.CaseSensitivityStr | constants.CaseSensitivity)

                                                                                                                                                                                                                                  Set the filter case sensitivity.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  sensitivity CaseSensitivityStr | CaseSensitivity

                                                                                                                                                                                                                                  filter case sensitivity

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/sortfilterproxymodel.py
                                                                                                                                                                                                                                  def set_filter_case_sensitivity(
                                                                                                                                                                                                                                      self, sensitivity: constants.CaseSensitivityStr | constants.CaseSensitivity
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Set the filter case sensitivity.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          sensitivity: filter case sensitivity
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      value = constants.CASE_SENSITIVITY.get_enum_value(sensitivity)
                                                                                                                                                                                                                                      super().setFilterCaseSensitivity(value)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  StandardPaths

                                                                                                                                                                                                                                  Bases: QStandardPaths

                                                                                                                                                                                                                                  Methods for accessing standard paths.

                                                                                                                                                                                                                                  Source code in prettyqt/core/standardpaths.py
                                                                                                                                                                                                                                  class StandardPaths(QtCore.QStandardPaths):
                                                                                                                                                                                                                                      """Methods for accessing standard paths."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_display_name(cls, location: StandardLocationStr) -> str:
                                                                                                                                                                                                                                          return cls.displayName(STANDARD_LOCATION[location])
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_writable_location(cls, location: StandardLocationStr) -> pathlib.Path | None:
                                                                                                                                                                                                                                          path = cls.writableLocation(STANDARD_LOCATION[location])
                                                                                                                                                                                                                                          return pathlib.Path(path) if path else None
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_standard_locations(cls, location: StandardLocationStr) -> list[pathlib.Path]:
                                                                                                                                                                                                                                          paths = cls.standardLocations(STANDARD_LOCATION[location])
                                                                                                                                                                                                                                          return [pathlib.Path(p) for p in paths]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  StorageInfo

                                                                                                                                                                                                                                  Bases: QStorageInfo

                                                                                                                                                                                                                                  Provides information about currently mounted storage and drives.

                                                                                                                                                                                                                                  Source code in prettyqt/core/storageinfo.py
                                                                                                                                                                                                                                  class StorageInfo(QtCore.QStorageInfo):
                                                                                                                                                                                                                                      """Provides information about currently mounted storage and drives."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          path: QtCore.QStorageInfo | QtCore.QDir | datatypes.PathType | None = None,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          if path is None:
                                                                                                                                                                                                                                              super().__init__()
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              if isinstance(path, os.PathLike):
                                                                                                                                                                                                                                                  path = os.fspath(path)
                                                                                                                                                                                                                                              super().__init__(path)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return self.isValid()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.rootPath())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_device(self) -> str:
                                                                                                                                                                                                                                          return bytes(self.device().data()).decode()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_file_system_type(self) -> str:
                                                                                                                                                                                                                                          return bytes(self.fileSystemType().data()).decode()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_subvolume(self) -> str:
                                                                                                                                                                                                                                          return bytes(self.subvolume().data()).decode()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_root_path(self) -> pathlib.Path:
                                                                                                                                                                                                                                          return pathlib.Path(self.rootPath())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_root(cls) -> Self:
                                                                                                                                                                                                                                          return cls(cls.root())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_mounted_volumes(cls) -> list[Self]:
                                                                                                                                                                                                                                          return [cls(i) for i in cls.mountedVolumes()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  StringConverter

                                                                                                                                                                                                                                  Bases: StringConverterMixin, QStringConverter

                                                                                                                                                                                                                                  Base class for encoding and decoding text.

                                                                                                                                                                                                                                  Source code in prettyqt/core/stringconverter.py
                                                                                                                                                                                                                                  class StringConverter(StringConverterMixin, QtCore.QStringConverter):
                                                                                                                                                                                                                                      """Base class for encoding and decoding text."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  StringDecoder

                                                                                                                                                                                                                                  Bases: StringConverterMixin, QStringDecoder

                                                                                                                                                                                                                                  State-based decoder for text.

                                                                                                                                                                                                                                  Source code in prettyqt/core/stringdecoder.py
                                                                                                                                                                                                                                  class StringDecoder(core.StringConverterMixin, QtCore.QStringDecoder):
                                                                                                                                                                                                                                      """State-based decoder for text."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          encoding: core.stringconverter.EncodingStr
                                                                                                                                                                                                                                          | QtCore.QStringConverter.Encoding
                                                                                                                                                                                                                                          | str
                                                                                                                                                                                                                                          | None = None,
                                                                                                                                                                                                                                          flags: core.stringconverter.FlagStr | QtCore.QStringConverter.Flag | None = None,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          if encoding is None:
                                                                                                                                                                                                                                              super().__init__()
                                                                                                                                                                                                                                              return
                                                                                                                                                                                                                                          enc: QtCore.QStringConverter.Encoding | str
                                                                                                                                                                                                                                          if isinstance(encoding, str) and encoding in core.stringconverter.ENCODING:
                                                                                                                                                                                                                                              enc = core.stringconverter.ENCODING[encoding]  # type: ignore[index]
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              enc = encoding
                                                                                                                                                                                                                                          if flags is None:
                                                                                                                                                                                                                                              super().__init__(enc)
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              flag_val = core.stringconverter.FLAG.get_enum_value(flags)
                                                                                                                                                                                                                                              super().__init__(enc, flag_val)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def for_html(cls, data: datatypes.ByteArrayType) -> Self:
                                                                                                                                                                                                                                          decoder = cls.decoderForHtml(datatypes.to_bytearray(data))
                                                                                                                                                                                                                                          name = decoder.name()
                                                                                                                                                                                                                                          if not name:
                                                                                                                                                                                                                                              return cls()
                                                                                                                                                                                                                                          return cls(name if isinstance(name, str) else bytes(name).decode())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  StringEncoder

                                                                                                                                                                                                                                  Bases: StringConverterMixin, QStringEncoder

                                                                                                                                                                                                                                  State-based encoder for text.

                                                                                                                                                                                                                                  Source code in prettyqt/core/stringencoder.py
                                                                                                                                                                                                                                  class StringEncoder(core.StringConverterMixin, QtCore.QStringEncoder):
                                                                                                                                                                                                                                      """State-based encoder for text."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          encoding: core.stringconverter.EncodingStr
                                                                                                                                                                                                                                          | QtCore.QStringConverter.Encoding
                                                                                                                                                                                                                                          | str
                                                                                                                                                                                                                                          | None = None,
                                                                                                                                                                                                                                          flags: core.stringconverter.FlagStr | QtCore.QStringConverter.Flag | None = None,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          if encoding is None:
                                                                                                                                                                                                                                              super().__init__()
                                                                                                                                                                                                                                              return
                                                                                                                                                                                                                                          enc: QtCore.QStringConverter.Encoding | str
                                                                                                                                                                                                                                          if isinstance(encoding, str) and encoding in core.stringconverter.ENCODING:
                                                                                                                                                                                                                                              enc = core.stringconverter.ENCODING[encoding]  # type: ignore[index]
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              enc = encoding
                                                                                                                                                                                                                                          if flags is None:
                                                                                                                                                                                                                                              super().__init__(enc)
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              flag_val = core.stringconverter.FLAG.get_enum_value(flags)
                                                                                                                                                                                                                                              super().__init__(enc, flag_val)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  StringListModel

                                                                                                                                                                                                                                  Bases: StringListModelMixin, QStringListModel

                                                                                                                                                                                                                                  Model that supplies strings to views.

                                                                                                                                                                                                                                  Source code in prettyqt/core/stringlistmodel.py
                                                                                                                                                                                                                                  class StringListModel(StringListModelMixin, core.QStringListModel):
                                                                                                                                                                                                                                      """Model that supplies strings to views."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return f"{type(self).__name__}: ({self.rowCount()})"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def columnCount(self, parent: core.ModelIndex | None = None) -> int:
                                                                                                                                                                                                                                          # columnCount is private for StringListModel, but we need it
                                                                                                                                                                                                                                          # to avoid workarounds (for example in our Slice proxies).
                                                                                                                                                                                                                                          # So lets just return 1.
                                                                                                                                                                                                                                          return 1
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def supports(cls, instance) -> bool:
                                                                                                                                                                                                                                          match instance:
                                                                                                                                                                                                                                              case (str(), *_):
                                                                                                                                                                                                                                                  return True
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  return False
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  TemporaryDir

                                                                                                                                                                                                                                  Bases: QTemporaryDir

                                                                                                                                                                                                                                  Creates a unique directory for temporary use.

                                                                                                                                                                                                                                  Source code in prettyqt/core/temporarydir.py
                                                                                                                                                                                                                                  class TemporaryDir(QtCore.QTemporaryDir):
                                                                                                                                                                                                                                      """Creates a unique directory for temporary use."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getattr__(self, attr: str):
                                                                                                                                                                                                                                          return getattr(self.to_path(), attr)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.path())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return self.path()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return self.isValid()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __fspath__(self) -> str:
                                                                                                                                                                                                                                          return self.path()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __truediv__(self, other: datatypes.PathType) -> pathlib.Path:
                                                                                                                                                                                                                                          current = pathlib.Path(self.path())
                                                                                                                                                                                                                                          return current / os.fspath(other)
                                                                                                                                                                                                                                          # new = current / other
                                                                                                                                                                                                                                          # if new.suffix == "":
                                                                                                                                                                                                                                          #     return core.Dir(new)
                                                                                                                                                                                                                                          # else:
                                                                                                                                                                                                                                          #     return core.File(new)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def to_path(self) -> pathlib.Path:
                                                                                                                                                                                                                                          return pathlib.Path(self.path())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  TemporaryFile

                                                                                                                                                                                                                                  Bases: FileMixin, QTemporaryFile

                                                                                                                                                                                                                                  I/O device that operates on temporary files.

                                                                                                                                                                                                                                  Source code in prettyqt/core/temporaryfile.py
                                                                                                                                                                                                                                  class TemporaryFile(core.FileMixin, core.QTemporaryFile):
                                                                                                                                                                                                                                      """I/O device that operates on temporary files."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  TextBoundaryFinder

                                                                                                                                                                                                                                  Bases: QTextBoundaryFinder

                                                                                                                                                                                                                                  Way of finding Unicode text boundaries in a string.

                                                                                                                                                                                                                                  Source code in prettyqt/core/textboundaryfinder.py
                                                                                                                                                                                                                                  class TextBoundaryFinder(QtCore.QTextBoundaryFinder):
                                                                                                                                                                                                                                      """Way of finding Unicode text boundaries in a string."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          string_or_other: str | QtCore.QTextBoundaryFinder = "",
                                                                                                                                                                                                                                          boundary_type: (
                                                                                                                                                                                                                                              QtCore.QTextBoundaryFinder.BoundaryType | BoundaryTypeStr
                                                                                                                                                                                                                                          ) = "grapheme",
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          if isinstance(string_or_other, QtCore.QTextBoundaryFinder):
                                                                                                                                                                                                                                              super().__init__(string_or_other)
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              if isinstance(boundary_type, str):
                                                                                                                                                                                                                                                  typ = BOUNDARY_TYPES[boundary_type]
                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                  typ = boundary_type
                                                                                                                                                                                                                                              super().__init__(typ, string_or_other)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.string())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.string(), self.type())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __iter__(self):
                                                                                                                                                                                                                                          pos = self.position()
                                                                                                                                                                                                                                          self.setPosition(0)
                                                                                                                                                                                                                                          p = 0
                                                                                                                                                                                                                                          # if self.isAtBoundary():
                                                                                                                                                                                                                                          #     yield 0
                                                                                                                                                                                                                                          while p != -1:
                                                                                                                                                                                                                                              p = self.toNextBoundary()
                                                                                                                                                                                                                                              if p != -1:
                                                                                                                                                                                                                                                  yield p
                                                                                                                                                                                                                                          self.setPosition(pos)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_boundary_type(self) -> BoundaryTypeStr:
                                                                                                                                                                                                                                          return BOUNDARY_TYPES.inverse[self.type()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_boundary_reasons(self) -> list[BoundaryReasonStr]:
                                                                                                                                                                                                                                          return BOUNDARY_REASONS.get_list(self.boundaryReasons())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  TextStream

                                                                                                                                                                                                                                  Bases: QTextStream

                                                                                                                                                                                                                                  Convenient interface for reading and writing text.

                                                                                                                                                                                                                                  Source code in prettyqt/core/textstream.py
                                                                                                                                                                                                                                  class TextStream(QtCore.QTextStream):
                                                                                                                                                                                                                                      """Convenient interface for reading and writing text."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_field_alignment(
                                                                                                                                                                                                                                          self, alignment: FieldAlignmentStr | QtCore.QTextStream.FieldAlignment
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Set the field alignment.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              alignment: field alignment
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setFieldAlignment(FIELD_ALIGNMENT.get_enum_value(alignment))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_field_alignment(self) -> FieldAlignmentStr:
                                                                                                                                                                                                                                          """Get current field alignment.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              current field alignment
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return FIELD_ALIGNMENT.inverse[self.fieldAlignment()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_status(self, status: StatusStr | QtCore.QTextStream.Status):
                                                                                                                                                                                                                                          """Set the status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              status: status
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setStatus(STATUS.get_enum_value(status))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_status(self) -> StatusStr:
                                                                                                                                                                                                                                          """Get current status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              current status
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return STATUS.inverse[self.status()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_real_number_notation(
                                                                                                                                                                                                                                          self, notation: RealNumberNotationStr | QtCore.QTextStream.RealNumberNotation
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          """Set the real number notation.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              notation: real number notation
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setRealNumberNotation(REAL_NUMBER_NOTATION.get_enum_value(notation))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_real_number_notation(self) -> RealNumberNotationStr:
                                                                                                                                                                                                                                          """Get current real number notation.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              current real number notation
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return REAL_NUMBER_NOTATION.inverse[self.realNumberNotation()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def read_lines(self) -> Iterator[str]:
                                                                                                                                                                                                                                          while True:
                                                                                                                                                                                                                                              if msg := self.readLine():
                                                                                                                                                                                                                                                  yield msg
                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                  return
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_number_flags(self) -> list[NumberFlagStr]:
                                                                                                                                                                                                                                          return NUMBER_FLAGS.get_list(self.numberFlags())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_number_flags(self, *flags: NumberFlagStr):
                                                                                                                                                                                                                                          flag = NUMBER_FLAGS.merge_flags(flags)
                                                                                                                                                                                                                                          self.setNumberFlags(flag)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_field_alignment() -> FieldAlignmentStr

                                                                                                                                                                                                                                  Get current field alignment.

                                                                                                                                                                                                                                  Source code in prettyqt/core/textstream.py
                                                                                                                                                                                                                                  def get_field_alignment(self) -> FieldAlignmentStr:
                                                                                                                                                                                                                                      """Get current field alignment.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          current field alignment
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return FIELD_ALIGNMENT.inverse[self.fieldAlignment()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_real_number_notation() -> RealNumberNotationStr

                                                                                                                                                                                                                                  Get current real number notation.

                                                                                                                                                                                                                                  Source code in prettyqt/core/textstream.py
                                                                                                                                                                                                                                  def get_real_number_notation(self) -> RealNumberNotationStr:
                                                                                                                                                                                                                                      """Get current real number notation.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          current real number notation
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return REAL_NUMBER_NOTATION.inverse[self.realNumberNotation()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_status() -> StatusStr

                                                                                                                                                                                                                                  Get current status.

                                                                                                                                                                                                                                  Source code in prettyqt/core/textstream.py
                                                                                                                                                                                                                                  def get_status(self) -> StatusStr:
                                                                                                                                                                                                                                      """Get current status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          current status
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return STATUS.inverse[self.status()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_field_alignment(alignment: FieldAlignmentStr | QtCore.QTextStream.FieldAlignment)

                                                                                                                                                                                                                                  Set the field alignment.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  alignment FieldAlignmentStr | FieldAlignment

                                                                                                                                                                                                                                  field alignment

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/textstream.py
                                                                                                                                                                                                                                  def set_field_alignment(
                                                                                                                                                                                                                                      self, alignment: FieldAlignmentStr | QtCore.QTextStream.FieldAlignment
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Set the field alignment.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          alignment: field alignment
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setFieldAlignment(FIELD_ALIGNMENT.get_enum_value(alignment))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_real_number_notation(notation: RealNumberNotationStr | QtCore.QTextStream.RealNumberNotation)

                                                                                                                                                                                                                                  Set the real number notation.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  notation RealNumberNotationStr | RealNumberNotation

                                                                                                                                                                                                                                  real number notation

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/textstream.py
                                                                                                                                                                                                                                  def set_real_number_notation(
                                                                                                                                                                                                                                      self, notation: RealNumberNotationStr | QtCore.QTextStream.RealNumberNotation
                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                      """Set the real number notation.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          notation: real number notation
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setRealNumberNotation(REAL_NUMBER_NOTATION.get_enum_value(notation))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_status(status: StatusStr | QtCore.QTextStream.Status)

                                                                                                                                                                                                                                  Set the status.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  status StatusStr | Status

                                                                                                                                                                                                                                  status

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/textstream.py
                                                                                                                                                                                                                                  def set_status(self, status: StatusStr | QtCore.QTextStream.Status):
                                                                                                                                                                                                                                      """Set the status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          status: status
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setStatus(STATUS.get_enum_value(status))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Thread

                                                                                                                                                                                                                                  Bases: ObjectMixin, QThread

                                                                                                                                                                                                                                  Platform-independent way to manage threads.

                                                                                                                                                                                                                                  Source code in prettyqt/core/thread.py
                                                                                                                                                                                                                                  class Thread(core.ObjectMixin, QtCore.QThread):
                                                                                                                                                                                                                                      """Platform-independent way to manage threads."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_priority(self) -> PriorityStr:
                                                                                                                                                                                                                                          return PRIORITY.inverse[self.priority()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  ThreadPool

                                                                                                                                                                                                                                  Bases: ObjectMixin, QThreadPool

                                                                                                                                                                                                                                  Manages a collection of QThreads.

                                                                                                                                                                                                                                  Note: signals only work correctly when exclusively using start_worker method.

                                                                                                                                                                                                                                  Source code in prettyqt/core/threadpool.py
                                                                                                                                                                                                                                  class ThreadPool(core.ObjectMixin, core.QThreadPool):
                                                                                                                                                                                                                                      """Manages a collection of QThreads.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Note: signals only work correctly when exclusively using start_worker method.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      __instance: Self | None = None  # a global instance
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      job_num_updated = core.Signal(int)
                                                                                                                                                                                                                                      error_occured = core.Signal(Exception)
                                                                                                                                                                                                                                      busy_state_changed = core.Signal(bool)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __contains__(self, other: core.QThread):
                                                                                                                                                                                                                                          return self.contains(other)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_thread_priority(self) -> core.thread.PriorityStr:
                                                                                                                                                                                                                                          return core.thread.PRIORITY.inverse[self.threadPriority()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_thread_priority(self, priority: core.thread.PriorityStr):
                                                                                                                                                                                                                                          prio = core.thread.PRIORITY[priority]
                                                                                                                                                                                                                                          self.setThreadPriority(prio)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def instance(cls) -> Self:
                                                                                                                                                                                                                                          """Return global ThreadPool singleton. (globalInstance always returns Qt type)."""
                                                                                                                                                                                                                                          if cls.__instance is None:
                                                                                                                                                                                                                                              cls.__instance = cls()
                                                                                                                                                                                                                                          return cls.__instance
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                          super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                          self._active_workers: set[Worker] = set()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def start_worker(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          fn_or_worker: Callable | Worker,
                                                                                                                                                                                                                                          args: tuple | None = None,
                                                                                                                                                                                                                                          kwargs: dict | None = None,
                                                                                                                                                                                                                                          priority: int = 0,
                                                                                                                                                                                                                                          result_fn: Callable | None = None,
                                                                                                                                                                                                                                          finished_fn: Callable | None = None,
                                                                                                                                                                                                                                          progress_fn: Callable | None = None,
                                                                                                                                                                                                                                          error_fn: Callable | None = None,
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          if isinstance(fn_or_worker, Callable):
                                                                                                                                                                                                                                              if args is None:
                                                                                                                                                                                                                                                  args = ()
                                                                                                                                                                                                                                              if kwargs is None:
                                                                                                                                                                                                                                                  kwargs = {}
                                                                                                                                                                                                                                              runnable = Worker(fn_or_worker, *args, **kwargs)
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              runnable = fn_or_worker
                                                                                                                                                                                                                                          runnable.setAutoDelete(False)
                                                                                                                                                                                                                                          self._active_workers.add(runnable)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          def _release_worker(*_args):
                                                                                                                                                                                                                                              self._active_workers.discard(runnable)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          _release_worker._prettyqt_skip_trace = True  # ty: ignore[missing-attribute]
                                                                                                                                                                                                                                          runnable.signals.finished.connect(_release_worker)
                                                                                                                                                                                                                                          runnable.signals.error.connect(_release_worker)
                                                                                                                                                                                                                                          runnable.signals.finished.connect(self._on_job_ended)
                                                                                                                                                                                                                                          runnable.signals.error.connect(self._on_job_ended)
                                                                                                                                                                                                                                          runnable.signals.error.connect(self._on_exception)
                                                                                                                                                                                                                                          if result_fn:
                                                                                                                                                                                                                                              runnable.signals.result.connect(result_fn)
                                                                                                                                                                                                                                          if finished_fn:
                                                                                                                                                                                                                                              runnable.signals.finished.connect(finished_fn)
                                                                                                                                                                                                                                          if progress_fn:
                                                                                                                                                                                                                                              runnable.signals.progress.connect(progress_fn)
                                                                                                                                                                                                                                          if error_fn:
                                                                                                                                                                                                                                              runnable.signals.error.connect(error_fn)
                                                                                                                                                                                                                                          thread_count = self.activeThreadCount()
                                                                                                                                                                                                                                          if thread_count == 0:
                                                                                                                                                                                                                                              self.busy_state_changed.emit(True)
                                                                                                                                                                                                                                          self.job_num_updated.emit(thread_count + 1)  # + 1 because we didnt start yet.
                                                                                                                                                                                                                                          super().start(runnable, priority)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def _on_job_ended(self):
                                                                                                                                                                                                                                          thread_count = self.activeThreadCount()
                                                                                                                                                                                                                                          if thread_count == 1:  # this is the last job
                                                                                                                                                                                                                                              self.busy_state_changed.emit(False)
                                                                                                                                                                                                                                          self.job_num_updated.emit(thread_count - 1)  # -1 because we didnt really end yet.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      _on_job_ended._prettyqt_skip_trace = True  # ty: ignore[missing-attribute]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def _on_exception(self, exception):
                                                                                                                                                                                                                                          self.error_occured.emit(exception)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      _on_exception._prettyqt_skip_trace = True  # ty: ignore[missing-attribute]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  instance() -> Self classmethod

                                                                                                                                                                                                                                  Return global ThreadPool singleton. (globalInstance always returns Qt type).

                                                                                                                                                                                                                                  Source code in prettyqt/core/threadpool.py
                                                                                                                                                                                                                                  @classmethod
                                                                                                                                                                                                                                  def instance(cls) -> Self:
                                                                                                                                                                                                                                      """Return global ThreadPool singleton. (globalInstance always returns Qt type)."""
                                                                                                                                                                                                                                      if cls.__instance is None:
                                                                                                                                                                                                                                          cls.__instance = cls()
                                                                                                                                                                                                                                      return cls.__instance
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Time

                                                                                                                                                                                                                                  Bases: QTime

                                                                                                                                                                                                                                  Clock time functions.

                                                                                                                                                                                                                                  Source code in prettyqt/core/_time.py
                                                                                                                                                                                                                                  class Time(core.QTime):
                                                                                                                                                                                                                                      """Clock time functions."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          super_repr = super().__repr__()
                                                                                                                                                                                                                                          template = str(super_repr).split("(")[1]
                                                                                                                                                                                                                                          return f"{type(self).__name__}({template}"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return self.toString()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.hour(), self.minute(), self.second(), self.msec())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __format__(self, format_spec: str):
                                                                                                                                                                                                                                          return self.toString(format_spec)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _hour(self) -> int:
                                                                                                                                                                                                                                          return self.hour()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _minute(self) -> int:
                                                                                                                                                                                                                                          return self.minute()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _second(self) -> int:
                                                                                                                                                                                                                                          return self.second()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _msec(self) -> int:
                                                                                                                                                                                                                                          return self.msec()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      __match_args__ = ("_hour", "_minute", "_second", "_msec")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def add_msecs(self, msecs: int) -> Self:
                                                                                                                                                                                                                                          return type(self)(self.addMSecs(msecs))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def add_secs(self, secs: int) -> Self:
                                                                                                                                                                                                                                          return type(self)(self.addSecs(secs))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_current_time(cls) -> Self:
                                                                                                                                                                                                                                          return cls(cls.currentTime())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def from_string(cls, *args, **kwargs) -> Self:
                                                                                                                                                                                                                                          return cls(cls.fromString(*args, **kwargs))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  TimeLine

                                                                                                                                                                                                                                  Bases: ObjectMixin, QTimeLine

                                                                                                                                                                                                                                  Timeline for controlling animations.

                                                                                                                                                                                                                                  Source code in prettyqt/core/timeline.py
                                                                                                                                                                                                                                  class TimeLine(core.ObjectMixin, core.QTimeLine):
                                                                                                                                                                                                                                      """Timeline for controlling animations."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def _get_map(self):
                                                                                                                                                                                                                                          maps = super()._get_map()
                                                                                                                                                                                                                                          maps |= {"direction": DIRECTION}
                                                                                                                                                                                                                                          return maps
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_direction(self, direction: DirectionStr | core.QTimeLine.Direction):
                                                                                                                                                                                                                                          """Set the direction.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              direction: direction
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setDirection(DIRECTION.get_enum_value(direction))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_direction(self) -> DirectionStr:
                                                                                                                                                                                                                                          """Return current direction.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              direction
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return DIRECTION.inverse[self.direction()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_state(self) -> StateStr:
                                                                                                                                                                                                                                          """Return current state.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              state
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return STATE.inverse[self.state()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_easing(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          easing_type: core.easingcurve.TypeStr
                                                                                                                                                                                                                                          | core.QEasingCurve.Type
                                                                                                                                                                                                                                          | Callable[[float], float],
                                                                                                                                                                                                                                      ) -> core.EasingCurve:
                                                                                                                                                                                                                                          curve = core.EasingCurve()
                                                                                                                                                                                                                                          if callable(easing_type):
                                                                                                                                                                                                                                              curve.set_custom_type(easing_type)
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              curve.set_type(easing_type)
                                                                                                                                                                                                                                          self.setEasingCurve(curve)
                                                                                                                                                                                                                                          return curve
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_easing(self) -> core.easingcurve.TypeStr | Callable[[float], float]:
                                                                                                                                                                                                                                          curve = core.EasingCurve(self.easingCurve())
                                                                                                                                                                                                                                          typ = curve.get_type()
                                                                                                                                                                                                                                          return curve.get_custom_type() if typ == "custom" else typ
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_direction() -> DirectionStr

                                                                                                                                                                                                                                  Return current direction.

                                                                                                                                                                                                                                  Source code in prettyqt/core/timeline.py
                                                                                                                                                                                                                                  def get_direction(self) -> DirectionStr:
                                                                                                                                                                                                                                      """Return current direction.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          direction
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return DIRECTION.inverse[self.direction()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_state() -> StateStr

                                                                                                                                                                                                                                  Return current state.

                                                                                                                                                                                                                                  Source code in prettyqt/core/timeline.py
                                                                                                                                                                                                                                  def get_state(self) -> StateStr:
                                                                                                                                                                                                                                      """Return current state.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          state
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return STATE.inverse[self.state()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_direction(direction: DirectionStr | core.QTimeLine.Direction)

                                                                                                                                                                                                                                  Set the direction.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  direction DirectionStr | Direction

                                                                                                                                                                                                                                  direction

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/timeline.py
                                                                                                                                                                                                                                  def set_direction(self, direction: DirectionStr | core.QTimeLine.Direction):
                                                                                                                                                                                                                                      """Set the direction.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          direction: direction
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setDirection(DIRECTION.get_enum_value(direction))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  TimeZone

                                                                                                                                                                                                                                  Bases: QTimeZone

                                                                                                                                                                                                                                  Identifies how a time representation relates to UTC.

                                                                                                                                                                                                                                  Source code in prettyqt/core/timezone.py
                                                                                                                                                                                                                                  class TimeZone(core.QTimeZone):
                                                                                                                                                                                                                                      """Identifies how a time representation relates to UTC."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, *args):
                                                                                                                                                                                                                                          match args:
                                                                                                                                                                                                                                              case (str() as string, *rest):
                                                                                                                                                                                                                                                  super().__init__(core.QByteArray(string.encode()), *rest)
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  super().__init__(*args)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.get_id())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return self.get_id()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.get_id(),)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_id(self) -> str:
                                                                                                                                                                                                                                          return bytes(self.id().data()).decode()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_display_name(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          date_time: datatypes.DateTimeType | TimeTypeStr,
                                                                                                                                                                                                                                          name_type: NameTypeStr | core.QTimeZone.NameType = "default",
                                                                                                                                                                                                                                          locale: core.QLocale | None = None,
                                                                                                                                                                                                                                      ) -> str:
                                                                                                                                                                                                                                          if isinstance(date_time, core.QTimeZone.TimeType):
                                                                                                                                                                                                                                              dt = date_time
                                                                                                                                                                                                                                          elif isinstance(date_time, str) and date_time in TIME_TYPE:
                                                                                                                                                                                                                                              dt = TIME_TYPE[date_time]
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              dt = datatypes.to_datetime(date_time)
                                                                                                                                                                                                                                          return self.displayName(
                                                                                                                                                                                                                                              dt,
                                                                                                                                                                                                                                              NAME_TYPE.get_enum_value(name_type),
                                                                                                                                                                                                                                              locale or core.QLocale(),
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_time_spec(self) -> constants.TimeSpecStr:
                                                                                                                                                                                                                                          return constants.TIME_SPEC.inverse[self.timeSpec()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Timer

                                                                                                                                                                                                                                  Bases: ObjectMixin, QTimer

                                                                                                                                                                                                                                  Repetitive and single-shot timers.

                                                                                                                                                                                                                                  Source code in prettyqt/core/timer.py
                                                                                                                                                                                                                                  class Timer(core.ObjectMixin, core.QTimer):
                                                                                                                                                                                                                                      """Repetitive and single-shot timers."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def _get_map(self):
                                                                                                                                                                                                                                          maps = super()._get_map()
                                                                                                                                                                                                                                          maps |= {"timerType": constants.TIMER_TYPE}
                                                                                                                                                                                                                                          return maps
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_type(self, typ: constants.TimerTypeStr | constants.TimerType):
                                                                                                                                                                                                                                          """Set the timer type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              typ: timer type
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          self.setTimerType(constants.TIMER_TYPE.get_enum_value(typ))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_type(self) -> constants.TimerTypeStr:
                                                                                                                                                                                                                                          """Return current timer type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              timer type
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return constants.TIMER_TYPE.inverse[self.timerType()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_interval(self, interval: int | str):
                                                                                                                                                                                                                                          if isinstance(interval, str):
                                                                                                                                                                                                                                              interval = helpers.parse_time(interval)
                                                                                                                                                                                                                                          self.setInterval(interval)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def start_timer(self, interval: int | str | None = None):
                                                                                                                                                                                                                                          if isinstance(interval, str):
                                                                                                                                                                                                                                              interval = helpers.parse_time(interval)
                                                                                                                                                                                                                                          if interval is None:
                                                                                                                                                                                                                                              self.start()
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              self.start(interval)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def restart(self):
                                                                                                                                                                                                                                          self.stop()
                                                                                                                                                                                                                                          self.start()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_type() -> constants.TimerTypeStr

                                                                                                                                                                                                                                  Return current timer type.

                                                                                                                                                                                                                                  Source code in prettyqt/core/timer.py
                                                                                                                                                                                                                                  def get_type(self) -> constants.TimerTypeStr:
                                                                                                                                                                                                                                      """Return current timer type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          timer type
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return constants.TIMER_TYPE.inverse[self.timerType()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  set_type(typ: constants.TimerTypeStr | constants.TimerType)

                                                                                                                                                                                                                                  Set the timer type.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  typ TimerTypeStr | TimerType

                                                                                                                                                                                                                                  timer type

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  Source code in prettyqt/core/timer.py
                                                                                                                                                                                                                                  def set_type(self, typ: constants.TimerTypeStr | constants.TimerType):
                                                                                                                                                                                                                                      """Set the timer type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          typ: timer type
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      self.setTimerType(constants.TIMER_TYPE.get_enum_value(typ))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Translator

                                                                                                                                                                                                                                  Bases: TranslatorMixin, QTranslator

                                                                                                                                                                                                                                  Internationalization support for text output.

                                                                                                                                                                                                                                  Source code in prettyqt/core/translator.py
                                                                                                                                                                                                                                  class Translator(TranslatorMixin, core.QTranslator):
                                                                                                                                                                                                                                      """Internationalization support for text output."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  TransposeProxyModel

                                                                                                                                                                                                                                  Bases: AbstractProxyModelMixin, QTransposeProxyModel

                                                                                                                                                                                                                                  This proxy transposes the source model.

                                                                                                                                                                                                                                  Source code in prettyqt/core/transposeproxymodel.py
                                                                                                                                                                                                                                  4
                                                                                                                                                                                                                                  5
                                                                                                                                                                                                                                  6
                                                                                                                                                                                                                                  7
                                                                                                                                                                                                                                  class TransposeProxyModel(core.AbstractProxyModelMixin, core.QTransposeProxyModel):
                                                                                                                                                                                                                                      """This proxy transposes the source model."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      ID = "transpose"
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Url

                                                                                                                                                                                                                                  Bases: SerializeMixin, QUrl

                                                                                                                                                                                                                                  Convenient interface for working with URLs.

                                                                                                                                                                                                                                  Source code in prettyqt/core/url.py
                                                                                                                                                                                                                                  class Url(serializemixin.SerializeMixin, QtCore.QUrl):
                                                                                                                                                                                                                                      """Convenient interface for working with URLs."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                          match args:
                                                                                                                                                                                                                                              case (os.PathLike(), *rest):
                                                                                                                                                                                                                                                  path = os.fspath(args[0])
                                                                                                                                                                                                                                                  if pathlib.Path(path).exists():
                                                                                                                                                                                                                                                      path = self.fromLocalFile(path)
                                                                                                                                                                                                                                                  super().__init__(path, *rest, **kwargs)
                                                                                                                                                                                                                                              case _:
                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _toString(self) -> str:
                                                                                                                                                                                                                                          return self.toString()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      __match_args__ = ("_toString",)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      # def __str__(self):
                                                                                                                                                                                                                                      #     return self.absolutePath()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.toString())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return self.toString()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __vfspath__(self) -> str:
                                                                                                                                                                                                                                          return self.toString()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def serialize_fields(self):
                                                                                                                                                                                                                                          return dict(path=self.toString())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def serialize(self) -> dict[str, Any]:
                                                                                                                                                                                                                                          return self.serialize_fields()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def to_string(self) -> str:
                                                                                                                                                                                                                                          return self.toString()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def to_path(self) -> pathlib.Path:
                                                                                                                                                                                                                                          """Get pathlib object from the URL.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              Path
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return pathlib.Path(str(self))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def is_local_file(self) -> bool:
                                                                                                                                                                                                                                          return self.isLocalFile()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def from_user_input(cls, url: str, working_dir: str | None = None) -> Self:
                                                                                                                                                                                                                                          if working_dir is None:
                                                                                                                                                                                                                                              working_dir = ""
                                                                                                                                                                                                                                          return cls(cls.fromUserInput(url, working_dir))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def from_local_file(cls, path: datatypes.PathType) -> Self:
                                                                                                                                                                                                                                          url = cls.fromLocalFile(os.fspath(path))
                                                                                                                                                                                                                                          return cls(url)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def _has_explicit_scheme(self) -> bool:
                                                                                                                                                                                                                                          """Check if a url has an explicit scheme given."""
                                                                                                                                                                                                                                          return bool(
                                                                                                                                                                                                                                              self.isValid()
                                                                                                                                                                                                                                              and self.scheme()
                                                                                                                                                                                                                                              and (self.host() or self.path())
                                                                                                                                                                                                                                              and not self.path().startswith(":")
                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def is_special_url(self) -> bool:
                                                                                                                                                                                                                                          """Return True if url is an about:... or other special URL."""
                                                                                                                                                                                                                                          return self.scheme() in ("about", "file") if self.isValid() else False
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  is_special_url() -> bool

                                                                                                                                                                                                                                  Return True if url is an about:... or other special URL.

                                                                                                                                                                                                                                  Source code in prettyqt/core/url.py
                                                                                                                                                                                                                                  def is_special_url(self) -> bool:
                                                                                                                                                                                                                                      """Return True if url is an about:... or other special URL."""
                                                                                                                                                                                                                                      return self.scheme() in ("about", "file") if self.isValid() else False
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  to_path() -> pathlib.Path

                                                                                                                                                                                                                                  Get pathlib object from the URL.

                                                                                                                                                                                                                                  Source code in prettyqt/core/url.py
                                                                                                                                                                                                                                  def to_path(self) -> pathlib.Path:
                                                                                                                                                                                                                                      """Get pathlib object from the URL.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          Path
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return pathlib.Path(str(self))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  UrlQuery

                                                                                                                                                                                                                                  Bases: QUrlQuery, MutableMapping

                                                                                                                                                                                                                                  Way to manipulate a key-value pairs in a URL's query.

                                                                                                                                                                                                                                  Source code in prettyqt/core/urlquery.py
                                                                                                                                                                                                                                  class UrlQuery(QtCore.QUrlQuery, MutableMapping, metaclass=datatypes.QABCMeta):
                                                                                                                                                                                                                                      """Way to manipulate a key-value pairs in a URL's query."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.toString())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return self.toString()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __contains__(self, key: str):
                                                                                                                                                                                                                                          return self.hasQueryItem(key)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __add__(self, other: dict) -> Self:
                                                                                                                                                                                                                                          for k, v in other.items():
                                                                                                                                                                                                                                              self.addQueryItem(k, str(v))
                                                                                                                                                                                                                                          return self
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __delitem__(self, item: str):
                                                                                                                                                                                                                                          self.removeQueryItem(item)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __setitem__(self, key, value):
                                                                                                                                                                                                                                          items = dict(self.queryItems())
                                                                                                                                                                                                                                          items[key] = value
                                                                                                                                                                                                                                          items = list(items.items())
                                                                                                                                                                                                                                          self.setQueryItems(items)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __len__(self):
                                                                                                                                                                                                                                          return len(self.queryItems())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __iter__(self):
                                                                                                                                                                                                                                          return iter(i[0] for i in self.queryItems())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __getitem__(self, key: str):
                                                                                                                                                                                                                                          if not self.hasQueryItem(key):
                                                                                                                                                                                                                                              raise KeyError(key)
                                                                                                                                                                                                                                          return self.queryItemValue(key)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def serialize(self) -> dict[str, Any]:
                                                                                                                                                                                                                                          return dict(path=self.toString())
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  Uuid

                                                                                                                                                                                                                                  Bases: UuidMixin, QUuid

                                                                                                                                                                                                                                  Stores a Universally Unique Identifier (UUID).

                                                                                                                                                                                                                                  Source code in prettyqt/core/_uuid.py
                                                                                                                                                                                                                                  class Uuid(UuidMixin, QtCore.QUuid):
                                                                                                                                                                                                                                      """Stores a Universally Unique Identifier (UUID)."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  UuidMixin

                                                                                                                                                                                                                                  Bases: _UuidBase

                                                                                                                                                                                                                                  Source code in prettyqt/core/_uuid.py
                                                                                                                                                                                                                                  class UuidMixin(_UuidBase):
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.toString())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return self.toString()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __bool__(self):
                                                                                                                                                                                                                                          return not self.isNull()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.toString(),)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __format__(self, format_spec: StringFormatStr):
                                                                                                                                                                                                                                          return self.to_string(format_spec)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_variant(self) -> VariantStr:
                                                                                                                                                                                                                                          return VARIANTS.inverse[self.variant()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_version(self) -> VersionStr:
                                                                                                                                                                                                                                          return VERSION.inverse[self.version()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def create_uuid(cls) -> Self:
                                                                                                                                                                                                                                          # workaround for PySide2, not able to clone in ctor
                                                                                                                                                                                                                                          return cls(cls.createUuid().toString())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def to_string(
                                                                                                                                                                                                                                          self, fmt: StringFormatStr | QtCore.QUuid.StringFormat = "with_braces"
                                                                                                                                                                                                                                      ) -> str:
                                                                                                                                                                                                                                          """Return string representation of the Uuid.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Allowed values are "with_braces", "without_braces", "id_128"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Args:
                                                                                                                                                                                                                                              fmt: Uuid format to use
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return self.toString(STRING_FORMATS.get_enum_value(fmt))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  to_string(fmt: StringFormatStr | QtCore.QUuid.StringFormat = 'with_braces') -> str

                                                                                                                                                                                                                                  Return string representation of the Uuid.

                                                                                                                                                                                                                                  Allowed values are "with_braces", "without_braces", "id_128"

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  fmt StringFormatStr | StringFormat

                                                                                                                                                                                                                                  Uuid format to use

                                                                                                                                                                                                                                  'with_braces'
                                                                                                                                                                                                                                  Source code in prettyqt/core/_uuid.py
                                                                                                                                                                                                                                  def to_string(
                                                                                                                                                                                                                                      self, fmt: StringFormatStr | QtCore.QUuid.StringFormat = "with_braces"
                                                                                                                                                                                                                                  ) -> str:
                                                                                                                                                                                                                                      """Return string representation of the Uuid.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Allowed values are "with_braces", "without_braces", "id_128"
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          fmt: Uuid format to use
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return self.toString(STRING_FORMATS.get_enum_value(fmt))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  VariantAnimation

                                                                                                                                                                                                                                  Bases: VariantAnimationMixin, QVariantAnimation

                                                                                                                                                                                                                                  Base class for animations.

                                                                                                                                                                                                                                  Source code in prettyqt/core/variantanimation.py
                                                                                                                                                                                                                                  class VariantAnimation(VariantAnimationMixin, core.QVariantAnimation):
                                                                                                                                                                                                                                      """Base class for animations."""
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  VariantAnimationMixin

                                                                                                                                                                                                                                  Bases: AbstractAnimationMixin, _VariantAnimationBase

                                                                                                                                                                                                                                  Source code in prettyqt/core/variantanimation.py
                                                                                                                                                                                                                                  class VariantAnimationMixin(core.AbstractAnimationMixin, _VariantAnimationBase):
                                                                                                                                                                                                                                      def __getitem__(self, value: float) -> datatypes.Variant:
                                                                                                                                                                                                                                          return self.keyValueAt(value)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __setitem__(self, key: float, value: datatypes.Variant):
                                                                                                                                                                                                                                          self.setKeyValueAt(key, value)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __iter__(self) -> Iterator[tuple[float, datatypes.Variant]]:
                                                                                                                                                                                                                                          return iter(self.keyValues())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_easing(
                                                                                                                                                                                                                                          self,
                                                                                                                                                                                                                                          easing_type: (
                                                                                                                                                                                                                                              core.easingcurve.TypeStr | core.QEasingCurve.Type | Callable[[float], float]
                                                                                                                                                                                                                                          ),
                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                          curve = core.EasingCurve()
                                                                                                                                                                                                                                          if callable(easing_type):
                                                                                                                                                                                                                                              curve.set_custom_type(easing_type)
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              curve.set_type(easing_type)
                                                                                                                                                                                                                                          self.setEasingCurve(curve)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_easing(self) -> core.easingcurve.TypeStr | Callable[[float], float]:
                                                                                                                                                                                                                                          curve = core.EasingCurve(self.easingCurve())
                                                                                                                                                                                                                                          typ = curve.get_type()
                                                                                                                                                                                                                                          return curve.get_custom_type() if typ == "custom" else typ
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_start_value(self, value: datatypes.Variant):
                                                                                                                                                                                                                                          self.setStartValue(value)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_end_value(self, value: datatypes.Variant):
                                                                                                                                                                                                                                          self.setEndValue(value)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_duration(self, duration: int):
                                                                                                                                                                                                                                          self.setDuration(duration)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def set_range(self, start, end):
                                                                                                                                                                                                                                          self.setStartValue(start)
                                                                                                                                                                                                                                          self.setEndValue(end)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def reverse(self):
                                                                                                                                                                                                                                          """True reverse instead of just setting direction."""
                                                                                                                                                                                                                                          self.setKeyValues(list(reversed(self.keyValues())))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def reversed(self) -> Self:
                                                                                                                                                                                                                                          """Return a reversed copy of the animation."""
                                                                                                                                                                                                                                          new = self.get_metaobject().copy(self)
                                                                                                                                                                                                                                          new.reverse()
                                                                                                                                                                                                                                          return new
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def append_reversed(self) -> Self:
                                                                                                                                                                                                                                          """Append the reversed animation, effectively doubling the duration."""
                                                                                                                                                                                                                                          self.setDuration(self.duration() * 2)
                                                                                                                                                                                                                                          first_part = [(k / 2, v) for k, v in self.keyValues()]
                                                                                                                                                                                                                                          second_part = [(1 - (k / 2), v) for k, v in self.keyValues()]
                                                                                                                                                                                                                                          keys = first_part + list(reversed(second_part))[1:]
                                                                                                                                                                                                                                          self.setKeyValues(keys)
                                                                                                                                                                                                                                          return self
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  append_reversed() -> Self

                                                                                                                                                                                                                                  Append the reversed animation, effectively doubling the duration.

                                                                                                                                                                                                                                  Source code in prettyqt/core/variantanimation.py
                                                                                                                                                                                                                                  def append_reversed(self) -> Self:
                                                                                                                                                                                                                                      """Append the reversed animation, effectively doubling the duration."""
                                                                                                                                                                                                                                      self.setDuration(self.duration() * 2)
                                                                                                                                                                                                                                      first_part = [(k / 2, v) for k, v in self.keyValues()]
                                                                                                                                                                                                                                      second_part = [(1 - (k / 2), v) for k, v in self.keyValues()]
                                                                                                                                                                                                                                      keys = first_part + list(reversed(second_part))[1:]
                                                                                                                                                                                                                                      self.setKeyValues(keys)
                                                                                                                                                                                                                                      return self
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  reverse()

                                                                                                                                                                                                                                  True reverse instead of just setting direction.

                                                                                                                                                                                                                                  Source code in prettyqt/core/variantanimation.py
                                                                                                                                                                                                                                  def reverse(self):
                                                                                                                                                                                                                                      """True reverse instead of just setting direction."""
                                                                                                                                                                                                                                      self.setKeyValues(list(reversed(self.keyValues())))
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  reversed() -> Self

                                                                                                                                                                                                                                  Return a reversed copy of the animation.

                                                                                                                                                                                                                                  Source code in prettyqt/core/variantanimation.py
                                                                                                                                                                                                                                  def reversed(self) -> Self:
                                                                                                                                                                                                                                      """Return a reversed copy of the animation."""
                                                                                                                                                                                                                                      new = self.get_metaobject().copy(self)
                                                                                                                                                                                                                                      new.reverse()
                                                                                                                                                                                                                                      return new
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  VersionNumber

                                                                                                                                                                                                                                  Bases: QVersionNumber

                                                                                                                                                                                                                                  Contains a version number with an arbitrary number of segments.

                                                                                                                                                                                                                                  Source code in prettyqt/core/versionnumber.py
                                                                                                                                                                                                                                  class VersionNumber(QtCore.QVersionNumber):
                                                                                                                                                                                                                                      """Contains a version number with an arbitrary number of segments."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                          match args:
                                                                                                                                                                                                                                              case (str(),):
                                                                                                                                                                                                                                                  args = [int(i) for i in args[0].split(".")][:3]
                                                                                                                                                                                                                                              case (tuple(),):
                                                                                                                                                                                                                                                  args = args[0]
                                                                                                                                                                                                                                              # PySide6 Workaround:
                                                                                                                                                                                                                                              case (QtCore.QVersionNumber(),):
                                                                                                                                                                                                                                                  args = (
                                                                                                                                                                                                                                                      args[0].majorVersion(),
                                                                                                                                                                                                                                                      args[0].minorVersion(),
                                                                                                                                                                                                                                                      args[0].microVersion(),
                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                          super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __repr__(self):
                                                                                                                                                                                                                                          return get_repr(self, self.major(), self.minor(), self.micro())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _majorVersion(self) -> int:
                                                                                                                                                                                                                                          return self.majorVersion()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _minorVersion(self) -> int:
                                                                                                                                                                                                                                          return self.minorVersion()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @property
                                                                                                                                                                                                                                      def _microVersion(self) -> int:
                                                                                                                                                                                                                                          return self.microVersion()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      __match_args__ = ("_majorVersion", "_minorVersion", "_microVersion")
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __reduce__(self):
                                                                                                                                                                                                                                          return type(self), (self.major(), self.minor(), self.micro())
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __str__(self):
                                                                                                                                                                                                                                          return self.toString()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __eq__(self, other):
                                                                                                                                                                                                                                          if isinstance(other, str | tuple):
                                                                                                                                                                                                                                              other = VersionNumber(other)
                                                                                                                                                                                                                                          return super().__eq__(other)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __hash__(self):
                                                                                                                                                                                                                                          return hash((self.major(), self.minor(), self.micro()))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __gt__(self, other: datatypes.SemanticVersionType):
                                                                                                                                                                                                                                          if isinstance(other, str | tuple):
                                                                                                                                                                                                                                              other = VersionNumber(other)
                                                                                                                                                                                                                                          return super().__gt__(other)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __ge__(self, other: datatypes.SemanticVersionType):
                                                                                                                                                                                                                                          if isinstance(other, str | tuple):
                                                                                                                                                                                                                                              other = VersionNumber(other)
                                                                                                                                                                                                                                          return super().__ge__(other)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __lt__(self, other: datatypes.SemanticVersionType):
                                                                                                                                                                                                                                          if isinstance(other, str | tuple):
                                                                                                                                                                                                                                              other = VersionNumber(other)
                                                                                                                                                                                                                                          return super().__lt__(other)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __le__(self, other: datatypes.SemanticVersionType):
                                                                                                                                                                                                                                          if isinstance(other, str | tuple):
                                                                                                                                                                                                                                              other = VersionNumber(other)
                                                                                                                                                                                                                                          return super().__le__(other)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def from_string(cls, version_string: str) -> Self:
                                                                                                                                                                                                                                          return cls(cls.fromString(version_string))
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_qt_version(cls) -> Self:
                                                                                                                                                                                                                                          return cls(*[int(i) for i in QtCore.__version__.split(".")])
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @classmethod
                                                                                                                                                                                                                                      def get_python_version(cls) -> Self:
                                                                                                                                                                                                                                          return cls(*sys.version_info[:3])
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def major(self) -> int:
                                                                                                                                                                                                                                          """An integer representing the major version."""
                                                                                                                                                                                                                                          return self.majorVersion()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def minor(self) -> int:
                                                                                                                                                                                                                                          """An integer representing the minor version."""
                                                                                                                                                                                                                                          return self.minorVersion()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def micro(self) -> int:
                                                                                                                                                                                                                                          """An integer representing the micro version."""
                                                                                                                                                                                                                                          return self.microVersion()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  major() -> int

                                                                                                                                                                                                                                  An integer representing the major version.

                                                                                                                                                                                                                                  Source code in prettyqt/core/versionnumber.py
                                                                                                                                                                                                                                  def major(self) -> int:
                                                                                                                                                                                                                                      """An integer representing the major version."""
                                                                                                                                                                                                                                      return self.majorVersion()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  micro() -> int

                                                                                                                                                                                                                                  An integer representing the micro version.

                                                                                                                                                                                                                                  Source code in prettyqt/core/versionnumber.py
                                                                                                                                                                                                                                  def micro(self) -> int:
                                                                                                                                                                                                                                      """An integer representing the micro version."""
                                                                                                                                                                                                                                      return self.microVersion()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  minor() -> int

                                                                                                                                                                                                                                  An integer representing the minor version.

                                                                                                                                                                                                                                  Source code in prettyqt/core/versionnumber.py
                                                                                                                                                                                                                                  def minor(self) -> int:
                                                                                                                                                                                                                                      """An integer representing the minor version."""
                                                                                                                                                                                                                                      return self.minorVersion()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  XmlStreamReader

                                                                                                                                                                                                                                  Bases: QXmlStreamReader

                                                                                                                                                                                                                                  Fast parser for reading well-formed XML via a simple streaming API.

                                                                                                                                                                                                                                  Source code in prettyqt/core/xmlstreamreader.py
                                                                                                                                                                                                                                  class XmlStreamReader(QtCore.QXmlStreamReader):
                                                                                                                                                                                                                                      """Fast parser for reading well-formed XML via a simple streaming API."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __iter__(self):
                                                                                                                                                                                                                                          return self
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def __next__(self):
                                                                                                                                                                                                                                          while not self.atEnd():
                                                                                                                                                                                                                                              self.readNext()
                                                                                                                                                                                                                                              if self.hasError():
                                                                                                                                                                                                                                                  raise RuntimeError(self.get_error())
                                                                                                                                                                                                                                              return self
                                                                                                                                                                                                                                          raise StopIteration
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_error(self) -> ErrorStr:
                                                                                                                                                                                                                                          """Return file error status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              file error status
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return ERROR.inverse[self.error()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_token_type(self) -> TokenTypeStr:
                                                                                                                                                                                                                                          """Get the current token type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              token type
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return TOKEN_TYPE.inverse[self.tokenType()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def read_next(self) -> TokenTypeStr:
                                                                                                                                                                                                                                          """Read the next token and returns its type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              token type
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return TOKEN_TYPE.inverse[self.readNext()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_error() -> ErrorStr

                                                                                                                                                                                                                                  Return file error status.

                                                                                                                                                                                                                                  Source code in prettyqt/core/xmlstreamreader.py
                                                                                                                                                                                                                                  def get_error(self) -> ErrorStr:
                                                                                                                                                                                                                                      """Return file error status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          file error status
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return ERROR.inverse[self.error()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_token_type() -> TokenTypeStr

                                                                                                                                                                                                                                  Get the current token type.

                                                                                                                                                                                                                                  Source code in prettyqt/core/xmlstreamreader.py
                                                                                                                                                                                                                                  def get_token_type(self) -> TokenTypeStr:
                                                                                                                                                                                                                                      """Get the current token type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          token type
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return TOKEN_TYPE.inverse[self.tokenType()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  read_next() -> TokenTypeStr

                                                                                                                                                                                                                                  Read the next token and returns its type.

                                                                                                                                                                                                                                  Source code in prettyqt/core/xmlstreamreader.py
                                                                                                                                                                                                                                  def read_next(self) -> TokenTypeStr:
                                                                                                                                                                                                                                      """Read the next token and returns its type.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          token type
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return TOKEN_TYPE.inverse[self.readNext()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  XmlStreamWriter

                                                                                                                                                                                                                                  Bases: QXmlStreamWriter

                                                                                                                                                                                                                                  XML writer with a simple streaming API.

                                                                                                                                                                                                                                  Source code in prettyqt/core/xmlstreamwriter.py
                                                                                                                                                                                                                                  class XmlStreamWriter(QtCore.QXmlStreamWriter):
                                                                                                                                                                                                                                      """XML writer with a simple streaming API."""
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def get_error(self) -> ErrorStr:
                                                                                                                                                                                                                                          """Return current writer error status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          Returns:
                                                                                                                                                                                                                                              writer error status
                                                                                                                                                                                                                                          """
                                                                                                                                                                                                                                          return ERROR.inverse[self.error()]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def document(self, version: str | None = None, standalone: bool | None = None):
                                                                                                                                                                                                                                          """Context manager wrapping writeStartDocument / writeEndDocument."""
                                                                                                                                                                                                                                          if version is None:
                                                                                                                                                                                                                                              self.writeStartDocument()
                                                                                                                                                                                                                                          elif standalone is None:
                                                                                                                                                                                                                                              self.writeStartDocument(version)
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              self.writeStartDocument(version, standalone)
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield self
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              self.writeEndDocument()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      @contextlib.contextmanager
                                                                                                                                                                                                                                      def element(self, name: str, namespace_uri: str | None = None):
                                                                                                                                                                                                                                          """Context manager wrapping writeStartElement / writeEndElement."""
                                                                                                                                                                                                                                          if namespace_uri is None:
                                                                                                                                                                                                                                              self.writeStartElement(name)
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              self.writeStartElement(namespace_uri, name)
                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              yield self
                                                                                                                                                                                                                                          finally:
                                                                                                                                                                                                                                              self.writeEndElement()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  document(version: str | None = None, standalone: bool | None = None)

                                                                                                                                                                                                                                  Context manager wrapping writeStartDocument / writeEndDocument.

                                                                                                                                                                                                                                  Source code in prettyqt/core/xmlstreamwriter.py
                                                                                                                                                                                                                                  @contextlib.contextmanager
                                                                                                                                                                                                                                  def document(self, version: str | None = None, standalone: bool | None = None):
                                                                                                                                                                                                                                      """Context manager wrapping writeStartDocument / writeEndDocument."""
                                                                                                                                                                                                                                      if version is None:
                                                                                                                                                                                                                                          self.writeStartDocument()
                                                                                                                                                                                                                                      elif standalone is None:
                                                                                                                                                                                                                                          self.writeStartDocument(version)
                                                                                                                                                                                                                                      else:
                                                                                                                                                                                                                                          self.writeStartDocument(version, standalone)
                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          yield self
                                                                                                                                                                                                                                      finally:
                                                                                                                                                                                                                                          self.writeEndDocument()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  element(name: str, namespace_uri: str | None = None)

                                                                                                                                                                                                                                  Context manager wrapping writeStartElement / writeEndElement.

                                                                                                                                                                                                                                  Source code in prettyqt/core/xmlstreamwriter.py
                                                                                                                                                                                                                                  @contextlib.contextmanager
                                                                                                                                                                                                                                  def element(self, name: str, namespace_uri: str | None = None):
                                                                                                                                                                                                                                      """Context manager wrapping writeStartElement / writeEndElement."""
                                                                                                                                                                                                                                      if namespace_uri is None:
                                                                                                                                                                                                                                          self.writeStartElement(name)
                                                                                                                                                                                                                                      else:
                                                                                                                                                                                                                                          self.writeStartElement(namespace_uri, name)
                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          yield self
                                                                                                                                                                                                                                      finally:
                                                                                                                                                                                                                                          self.writeEndElement()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_error() -> ErrorStr

                                                                                                                                                                                                                                  Return current writer error status.

                                                                                                                                                                                                                                  Source code in prettyqt/core/xmlstreamwriter.py
                                                                                                                                                                                                                                  def get_error(self) -> ErrorStr:
                                                                                                                                                                                                                                      """Return current writer error status.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns:
                                                                                                                                                                                                                                          writer error status
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      return ERROR.inverse[self.error()]
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  async_slots_enabled(*, on_error: Callable[[BaseException], Any] | None = None) -> Generator[AsyncSlotHook]

                                                                                                                                                                                                                                  Context manager enabling async def signal connections temporarily.

                                                                                                                                                                                                                                  Source code in prettyqt/core/aio.py
                                                                                                                                                                                                                                  @contextlib.contextmanager
                                                                                                                                                                                                                                  def async_slots_enabled(
                                                                                                                                                                                                                                      *, on_error: Callable[[BaseException], Any] | None = None
                                                                                                                                                                                                                                  ) -> Generator[AsyncSlotHook]:
                                                                                                                                                                                                                                      """Context manager enabling `async def` signal connections temporarily."""
                                                                                                                                                                                                                                      hook = enable_async_slots(on_error=on_error)
                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          yield hook
                                                                                                                                                                                                                                      finally:
                                                                                                                                                                                                                                          disable_async_slots()
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  disable_async_slots() -> None

                                                                                                                                                                                                                                  Disable automatic scheduling of async def slots connected to Qt signals.

                                                                                                                                                                                                                                  Source code in prettyqt/core/aio.py
                                                                                                                                                                                                                                  def disable_async_slots() -> None:
                                                                                                                                                                                                                                      """Disable automatic scheduling of `async def` slots connected to Qt signals."""
                                                                                                                                                                                                                                      global _active_async_hook
                                                                                                                                                                                                                                      if _active_async_hook is not None:
                                                                                                                                                                                                                                          signalhooks.get_hook_manager().unregister(_active_async_hook)
                                                                                                                                                                                                                                          _active_async_hook = None
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  enable_async_slots(*, on_error: Callable[[BaseException], Any] | None = None) -> AsyncSlotHook

                                                                                                                                                                                                                                  Enable connecting async def functions directly to Qt signals.

                                                                                                                                                                                                                                  Source code in prettyqt/core/aio.py
                                                                                                                                                                                                                                  def enable_async_slots(
                                                                                                                                                                                                                                      *, on_error: Callable[[BaseException], Any] | None = None
                                                                                                                                                                                                                                  ) -> AsyncSlotHook:
                                                                                                                                                                                                                                      """Enable connecting `async def` functions directly to Qt signals."""
                                                                                                                                                                                                                                      global _active_async_hook
                                                                                                                                                                                                                                      manager = signalhooks.get_hook_manager()
                                                                                                                                                                                                                                      if _active_async_hook is not None:
                                                                                                                                                                                                                                          manager.unregister(_active_async_hook)
                                                                                                                                                                                                                                      hook = AsyncSlotHook(on_error=on_error)
                                                                                                                                                                                                                                      manager.register(hook)
                                                                                                                                                                                                                                      _active_async_hook = hook
                                                                                                                                                                                                                                      return hook
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  get_repr(_obj: Any, *args: Any, **kwargs: Any) -> str

                                                                                                                                                                                                                                  Get a suitable repr string for an object.

                                                                                                                                                                                                                                  Parameters:

                                                                                                                                                                                                                                  Name Type Description Default
                                                                                                                                                                                                                                  _obj Any

                                                                                                                                                                                                                                  The object to get a repr for.

                                                                                                                                                                                                                                  required
                                                                                                                                                                                                                                  *args Any

                                                                                                                                                                                                                                  Arguments for the repr

                                                                                                                                                                                                                                  ()
                                                                                                                                                                                                                                  **kwargs Any

                                                                                                                                                                                                                                  Keyword arguments for the repr

                                                                                                                                                                                                                                  {}
                                                                                                                                                                                                                                  Source code in prettyqt/utils/__init__.py
                                                                                                                                                                                                                                  def get_repr(_obj: Any, *args: Any, **kwargs: Any) -> str:
                                                                                                                                                                                                                                      """Get a suitable __repr__ string for an object.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Args:
                                                                                                                                                                                                                                          _obj: The object to get a repr for.
                                                                                                                                                                                                                                          *args: Arguments for the repr
                                                                                                                                                                                                                                          **kwargs: Keyword arguments for the repr
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      classname = type(_obj).__name__
                                                                                                                                                                                                                                      parts = [repr(val) for val in args]
                                                                                                                                                                                                                                      kw_parts = [f"{name}={val!r}" for name, val in kwargs.items()]
                                                                                                                                                                                                                                      return f"{classname}({', '.join(parts + kw_parts)})"
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  run_in_gui_thread(fn: Callable[..., T], *args: Any, **kwargs: Any) -> T async

                                                                                                                                                                                                                                  Execute fn(*args, **kwargs) on Qt's main GUI thread and await the result.

                                                                                                                                                                                                                                  Source code in prettyqt/core/aio.py
                                                                                                                                                                                                                                  async def run_in_gui_thread[T](fn: Callable[..., T], *args: Any, **kwargs: Any) -> T:
                                                                                                                                                                                                                                      """Execute `fn(*args, **kwargs)` on Qt's main GUI thread and await the result."""
                                                                                                                                                                                                                                      app = QtCore.QCoreApplication.instance()
                                                                                                                                                                                                                                      if app is None or QtCore.QThread.currentThread() == app.thread():
                                                                                                                                                                                                                                          return fn(*args, **kwargs)
                                                                                                                                                                                                                                      loop = asyncio.get_running_loop()
                                                                                                                                                                                                                                      bridge = _loop_to_bridge.get(loop) or get_async_bridge(auto_start=True)
                                                                                                                                                                                                                                      return await bridge.call_in_gui_thread(fn, *args, **kwargs)
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  schedule_coroutine(coro: Coroutine[Any, Any, T], *, loop: asyncio.AbstractEventLoop | None = None, on_error: Callable[[BaseException], Any] | None = None, use_bridge: bool = True) -> asyncio.Task[T] | concurrent.futures.Future[T]

                                                                                                                                                                                                                                  Schedule a coroutine onto the active asyncio loop or AsyncBridge.

                                                                                                                                                                                                                                  • If a running asyncio loop exists on the current thread (or loop is passed), creates a tracked asyncio.Task (preserving contextvars and preventing premature GC).
                                                                                                                                                                                                                                  • Otherwise, if use_bridge is True, submits to the shared AsyncBridge (preserving contextvars across the thread boundary).
                                                                                                                                                                                                                                  Source code in prettyqt/core/aio.py
                                                                                                                                                                                                                                  def schedule_coroutine[T](
                                                                                                                                                                                                                                      coro: Coroutine[Any, Any, T],
                                                                                                                                                                                                                                      *,
                                                                                                                                                                                                                                      loop: asyncio.AbstractEventLoop | None = None,
                                                                                                                                                                                                                                      on_error: Callable[[BaseException], Any] | None = None,
                                                                                                                                                                                                                                      use_bridge: bool = True,
                                                                                                                                                                                                                                  ) -> asyncio.Task[T] | concurrent.futures.Future[T]:
                                                                                                                                                                                                                                      """Schedule a coroutine onto the active `asyncio` loop or `AsyncBridge`.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      - If a running `asyncio` loop exists on the current thread (or `loop` is
                                                                                                                                                                                                                                        passed), creates a tracked `asyncio.Task` (preserving `contextvars` and
                                                                                                                                                                                                                                        preventing premature GC).
                                                                                                                                                                                                                                      - Otherwise, if `use_bridge` is True, submits to the shared `AsyncBridge`
                                                                                                                                                                                                                                        (preserving `contextvars` across the thread boundary).
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      target_loop = loop
                                                                                                                                                                                                                                      if target_loop is None:
                                                                                                                                                                                                                                          with contextlib.suppress(RuntimeError):
                                                                                                                                                                                                                                              target_loop = asyncio.get_running_loop()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      if target_loop is not None:
                                                                                                                                                                                                                                          task: asyncio.Task[T] = target_loop.create_task(coro)
                                                                                                                                                                                                                                          _background_tasks.add(task)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          def _cleanup(done: asyncio.Task[T]) -> None:
                                                                                                                                                                                                                                              _background_tasks.discard(done)
                                                                                                                                                                                                                                              _report_future_error(done, on_error)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                          task.add_done_callback(_cleanup)
                                                                                                                                                                                                                                          return task
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      if not use_bridge:
                                                                                                                                                                                                                                          coro.close()
                                                                                                                                                                                                                                          msg = "No running asyncio event loop and use_bridge=False."
                                                                                                                                                                                                                                          raise RuntimeError(msg)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      bridge = get_async_bridge(auto_start=True)
                                                                                                                                                                                                                                      fut = bridge.submit(coro)
                                                                                                                                                                                                                                      fut.add_done_callback(lambda f: _report_future_error(f, on_error))
                                                                                                                                                                                                                                      return fut
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  wait_for_signal(signal: Any, *, timeout: float | None = None) -> Any async

                                                                                                                                                                                                                                  Await the next emission of a Qt signal.

                                                                                                                                                                                                                                  Returns None for 0-arg signals, the single argument for 1-arg signals, or a tuple of arguments for multi-arg signals. Safe across both main-thread loops (qasync/qtinter) and AsyncBridge worker threads.

                                                                                                                                                                                                                                  Source code in prettyqt/core/aio.py
                                                                                                                                                                                                                                  async def wait_for_signal(
                                                                                                                                                                                                                                      signal: Any,
                                                                                                                                                                                                                                      *,
                                                                                                                                                                                                                                      timeout: float | None = None,
                                                                                                                                                                                                                                  ) -> Any:
                                                                                                                                                                                                                                      """Await the next emission of a Qt signal.
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      Returns `None` for 0-arg signals, the single argument for 1-arg signals,
                                                                                                                                                                                                                                      or a tuple of arguments for multi-arg signals. Safe across both main-thread
                                                                                                                                                                                                                                      loops (`qasync`/`qtinter`) and `AsyncBridge` worker threads.
                                                                                                                                                                                                                                      """
                                                                                                                                                                                                                                      loop = asyncio.get_running_loop()
                                                                                                                                                                                                                                      fut: asyncio.Future[Any] = loop.create_future()
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      def _on_emit(*args: Any) -> None:
                                                                                                                                                                                                                                          value: Any
                                                                                                                                                                                                                                          if not args:
                                                                                                                                                                                                                                              value = None
                                                                                                                                                                                                                                          elif len(args) == 1:
                                                                                                                                                                                                                                              value = args[0]
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              value = args
                                                                                                                                                                                                                                          if not loop.is_closed():
                                                                                                                                                                                                                                              loop.call_soon_threadsafe(_set_result_if_pending, fut, value)
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      _on_emit._prettyqt_skip_trace = True  # ty: ignore[missing-attribute]
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                      # Connect and disconnect on Qt's main thread so cross-thread calls from
                                                                                                                                                                                                                                      # `AsyncBridge` never race with QObject connection lists on PyQt6/PySide6.
                                                                                                                                                                                                                                      conn = await run_in_gui_thread(signal.connect, _on_emit)
                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          if timeout is not None:
                                                                                                                                                                                                                                              return await asyncio.wait_for(fut, timeout=timeout)
                                                                                                                                                                                                                                          return await fut
                                                                                                                                                                                                                                      finally:
                                                                                                                                                                                                                                          with contextlib.suppress(RuntimeError, TypeError):
                                                                                                                                                                                                                                              await run_in_gui_thread(signal.disconnect, conn)