Skip to content

widgets

Class info

Classes

Name Children Inherits
AbstractButton
prettyqt.widgets.abstractbutton
    AbstractButtonMixin
    prettyqt.widgets.abstractbutton
    Abstract button widget base class, providing functionality common to buttons.
    AbstractGraphicsShapeItem
    prettyqt.widgets.abstractgraphicsshapeitem
    Common base for all path items.
      AbstractGraphicsShapeItemMixin
      prettyqt.widgets.abstractgraphicsshapeitem
      AbstractItemDelegate
      prettyqt.widgets.abstractitemdelegate
      Used to display and edit data items from a model.
        AbstractItemDelegateMixin
        prettyqt.widgets.abstractitemdelegate
        AbstractItemView
        prettyqt.widgets.abstractitemview
        The basic functionality for item view classes.
          AbstractItemViewMixin
          prettyqt.widgets.abstractitemview
          AbstractScrollArea
          prettyqt.widgets.abstractscrollarea
          Scrolling area with on-demand scroll bars.
            AbstractScrollAreaMixin
            prettyqt.widgets.abstractscrollarea
            AbstractSlider
            prettyqt.widgets.abstractslider
            Integer value within a range.
              AbstractSliderMixin
              prettyqt.widgets.abstractslider
              AbstractSpinBox
              prettyqt.widgets.abstractspinbox
              Spinbox and a line edit to display values.
                AbstractSpinBoxMixin
                prettyqt.widgets.abstractspinbox
                Application
                prettyqt.widgets.application
                Manages the GUI application's control flow and main settings.
                  BoxLayout
                  prettyqt.widgets.boxlayout
                  Lines up child widgets horizontally or vertically.
                  ButtonGroup
                  prettyqt.widgets.buttongroup
                  Container to organize groups of button widgets.
                    CalendarWidget
                    prettyqt.widgets.calendarwidget
                    Monthly based calendar widget allowing the user to select a date.
                      CheckBox
                      prettyqt.widgets.checkbox
                      Checkbox with a text label.
                      ColorDialog
                      prettyqt.widgets.colordialog
                      Dialog widget for specifying colors.
                        ColumnView
                        prettyqt.widgets.columnview
                        Model/view implementation of a column view.
                          ComboBox
                          prettyqt.widgets.combobox
                          Combined button and popup list.
                          ComboBoxMixin
                          prettyqt.widgets.combobox
                          Combobox that lets the user select a font family.
                          CommandLinkButton
                          prettyqt.widgets.commandlinkbutton
                          Vista style command link button.
                            CommonStyle
                            prettyqt.widgets.commonstyle
                            Encapsulates the common Look and Feel of a GUI.
                              CommonStyleMixin
                              prettyqt.widgets.commonstyle
                              Completer
                              prettyqt.widgets.completer
                              Completions based on an item model.
                              DataWidgetMapper
                              prettyqt.widgets.datawidgetmapper
                              Mapping between a section of a data model to widgets.
                                DateEdit
                                prettyqt.widgets.dateedit
                                Widget for editing dates based on the QDateTimeEdit widget.
                                  DateTimeEdit
                                  prettyqt.widgets.datetimeedit
                                    DateTimeEditMixin
                                    prettyqt.widgets.datetimeedit
                                    Widget for editing dates and times.
                                    Dial
                                    prettyqt.widgets.dial
                                    Rounded range control (like a speedometer or potentiometer).
                                      Dialog
                                      prettyqt.widgets.dialog
                                      The base class of dialog windows.
                                      DialogButtonBox
                                      prettyqt.widgets.dialogbuttonbox
                                      Widget presenting buttons in a layout that is appropriate to the widget style.
                                        DialogMixin
                                        prettyqt.widgets.dialog
                                        DockWidget
                                        prettyqt.widgets.dockwidget
                                        Widget that can be docked inside a QMainWindow .
                                          DoubleSpinBox
                                          prettyqt.widgets.doublespinbox
                                          Spin box widget that takes doubles.
                                            ErrorMessage
                                            prettyqt.widgets.errormessage
                                            Error message display dialog.
                                              FileDialog
                                              prettyqt.widgets.filedialog
                                              Dialog that allow users to select files or directories.
                                                FileIconProvider
                                                prettyqt.widgets.fileiconprovider
                                                File icons for the QFileSystemModel class.
                                                  FileSystemModel
                                                  prettyqt.widgets.filesystemmodel
                                                    FocusFrame
                                                    prettyqt.widgets.focusframe
                                                    Focus frame which can be outside of a widget's normal paintable area.
                                                      FontComboBox
                                                      prettyqt.widgets.fontcombobox
                                                      Combobox that lets the user select a font family.
                                                        FontDialog
                                                        prettyqt.widgets.fontdialog
                                                        Dialog widget for selecting a font.
                                                          FormLayout
                                                          prettyqt.widgets.formlayout
                                                          Manages forms of input widgets and their associated labels.
                                                            Frame
                                                            prettyqt.widgets.frame
                                                            The base class of widgets that can have a frame.
                                                            FrameMixin
                                                            prettyqt.widgets.frame
                                                            Gesture
                                                            prettyqt.widgets.gesture
                                                            A gesture, containing properties that describe the corresponding user input.
                                                              GestureMixin
                                                              prettyqt.widgets.gesture
                                                              GestureRecognizer
                                                              prettyqt.widgets.gesturerecognizer
                                                              Provides the infrastructure for gesture recognition.
                                                                GestureRecognizerMixin
                                                                prettyqt.widgets.gesturerecognizer
                                                                GraphicsAnchor
                                                                prettyqt.widgets.graphicsanchor
                                                                Represents an anchor between two items in a QGraphicsAnchorLayout.
                                                                  GraphicsAnchorLayout
                                                                  prettyqt.widgets.graphicsanchorlayout
                                                                    GraphicsBlurEffect
                                                                    prettyqt.widgets.graphicsblureffect
                                                                      GraphicsColorizeEffect
                                                                      prettyqt.widgets.graphicscolorizeeffect
                                                                        GraphicsDropShadowEffect
                                                                        prettyqt.widgets.graphicsdropshadoweffect
                                                                          GraphicsEffect
                                                                          prettyqt.widgets.graphicseffect
                                                                          The base class for all graphics effects.
                                                                            GraphicsEffectMixin
                                                                            prettyqt.widgets.graphicseffect
                                                                            GraphicsEllipseItem
                                                                            prettyqt.widgets.graphicsellipseitem
                                                                            Ellipse item that you can add to a QGraphicsScene.
                                                                              GraphicsGridLayout
                                                                              prettyqt.widgets.graphicsgridlayout
                                                                              Grid layout for managing widgets in Graphics View.
                                                                                GraphicsItem
                                                                                prettyqt.widgets.graphicsitem
                                                                                The base class for all graphical items in a QGraphicsScene.
                                                                                  GraphicsItemGroup
                                                                                  prettyqt.widgets.graphicsitemgroup
                                                                                  Container that treats a group of items as a single item.
                                                                                    GraphicsItemMixin
                                                                                    prettyqt.widgets.graphicsitem
                                                                                    GraphicsLayout
                                                                                    prettyqt.widgets.graphicslayout
                                                                                    The base class for all layouts in Graphics View.
                                                                                      GraphicsLayoutItem
                                                                                      prettyqt.widgets.graphicslayoutitem
                                                                                      Can be inherited to allow your custom items to be managed by layouts.
                                                                                        GraphicsLayoutItemMixin
                                                                                        prettyqt.widgets.graphicslayoutitem
                                                                                        GraphicsLayoutMixin
                                                                                        prettyqt.widgets.graphicslayout
                                                                                        GraphicsLineItem
                                                                                        prettyqt.widgets.graphicslineitem
                                                                                        Line item that you can add to a QGraphicsScene.
                                                                                          GraphicsLinearLayout
                                                                                          prettyqt.widgets.graphicslinearlayout
                                                                                          Horizontal or vertical layout for managing widgets in Graphics View.
                                                                                            GraphicsObject
                                                                                            prettyqt.widgets.graphicsobject
                                                                                            Base class for all graphics items that require signals, slots and properties.
                                                                                              GraphicsObjectMixin
                                                                                              prettyqt.widgets.graphicsobject
                                                                                              GraphicsOpacityEffect
                                                                                              prettyqt.widgets.graphicsopacityeffect
                                                                                                GraphicsPathItem
                                                                                                prettyqt.widgets.graphicspathitem
                                                                                                Path item that you can add to a QGraphicsScene.
                                                                                                  GraphicsPixmapItem
                                                                                                  prettyqt.widgets.graphicspixmapitem
                                                                                                  Pixmap item that you can add to a QGraphicsScene.
                                                                                                    GraphicsPolygonItem
                                                                                                    prettyqt.widgets.graphicspolygonitem
                                                                                                    Polygon item that you can add to a QGraphicsScene.
                                                                                                      GraphicsProxyWidget
                                                                                                      prettyqt.widgets.graphicsproxywidget
                                                                                                      Proxy layer for embedding a QWidget in a QGraphicsScene.
                                                                                                        GraphicsRectItem
                                                                                                        prettyqt.widgets.graphicsrectitem
                                                                                                        Rectangle item that you can add to a QGraphicsScene.
                                                                                                          GraphicsRotation
                                                                                                          prettyqt.widgets.graphicsrotation
                                                                                                          Rotation transformation around a given axis.
                                                                                                            GraphicsScale
                                                                                                            prettyqt.widgets.graphicsscale
                                                                                                              GraphicsScene
                                                                                                              prettyqt.widgets.graphicsscene
                                                                                                              Surface for managing a large number of 2D graphical items.
                                                                                                                GraphicsSimpleTextItem
                                                                                                                prettyqt.widgets.graphicssimpletextitem
                                                                                                                Simple text path item that you can add to a QGraphicsScene.
                                                                                                                  GraphicsTextItem
                                                                                                                  prettyqt.widgets.graphicstextitem
                                                                                                                  Text item that you can add to a QGraphicsScene to display formatted text.
                                                                                                                    GraphicsTransform
                                                                                                                    prettyqt.widgets.graphicstransform
                                                                                                                    Abstract base class for building advanced transformations on QGraphicsItems.
                                                                                                                      GraphicsTransformMixin
                                                                                                                      prettyqt.widgets.graphicstransform
                                                                                                                      GraphicsView
                                                                                                                      prettyqt.widgets.graphicsview
                                                                                                                      Widget for displaying the contents of a QGraphicsScene.
                                                                                                                        GraphicsViewMixin
                                                                                                                        prettyqt.widgets.graphicsview
                                                                                                                        GraphicsWidget
                                                                                                                        prettyqt.widgets.graphicswidget
                                                                                                                        The base class for all widget items in a QGraphicsScene.
                                                                                                                          GraphicsWidgetMixin
                                                                                                                          prettyqt.widgets.graphicswidget
                                                                                                                          GridLayout
                                                                                                                          prettyqt.widgets.gridlayout
                                                                                                                          Lays out widgets in a grid.
                                                                                                                            GroupBox
                                                                                                                            prettyqt.widgets.groupbox
                                                                                                                            Group box frame with a title.
                                                                                                                            HBoxLayout
                                                                                                                            prettyqt.widgets.hboxlayout
                                                                                                                            Lines up widgets horizontally.
                                                                                                                              HeaderView
                                                                                                                              prettyqt.widgets.headerview
                                                                                                                              Header row or header column for item views.
                                                                                                                              InputDialog
                                                                                                                              prettyqt.widgets.inputdialog
                                                                                                                              Simple convenience dialog to get a single value from the user.
                                                                                                                                ItemDelegate
                                                                                                                                prettyqt.widgets.itemdelegate
                                                                                                                                Display and editing facilities for data items from a model.
                                                                                                                                  ItemEditorCreatorBase
                                                                                                                                  prettyqt.widgets.itemeditorcreatorbase
                                                                                                                                  Abstract base class for implementing new item editor creators.
                                                                                                                                    ItemEditorFactory
                                                                                                                                    prettyqt.widgets.itemeditorfactory
                                                                                                                                    Widgets for editing item data in views and delegates.
                                                                                                                                      KeySequenceEdit
                                                                                                                                      prettyqt.widgets.keysequenceedit
                                                                                                                                      Allows to input a QKeySequence.
                                                                                                                                        LCDNumber
                                                                                                                                        prettyqt.widgets.lcdnumber
                                                                                                                                        Displays a number with LCD-like digits.
                                                                                                                                          Label
                                                                                                                                          prettyqt.widgets.label
                                                                                                                                          Text or image display.
                                                                                                                                          Layout
                                                                                                                                          prettyqt.widgets.layout
                                                                                                                                          The base class of geometry managers.
                                                                                                                                          LayoutItem
                                                                                                                                          prettyqt.widgets.layoutitem
                                                                                                                                          Abstract item that a QLayout manipulates.
                                                                                                                                            LayoutItemMixin
                                                                                                                                            prettyqt.widgets.layoutitem
                                                                                                                                            LayoutMixin
                                                                                                                                            prettyqt.widgets.layout
                                                                                                                                            LineEdit
                                                                                                                                            prettyqt.widgets.lineedit
                                                                                                                                            One-line text editor.
                                                                                                                                            ListView
                                                                                                                                            prettyqt.widgets.listview
                                                                                                                                            List or icon view onto a model.
                                                                                                                                              ListViewMixin
                                                                                                                                              prettyqt.widgets.listview
                                                                                                                                              ListWidget
                                                                                                                                              prettyqt.widgets.listwidget
                                                                                                                                              Item-based list widget.
                                                                                                                                              • MultiChoiceEditor
                                                                                                                                              ListWidgetItem
                                                                                                                                              prettyqt.widgets.listwidgetitem
                                                                                                                                              Item for use with the QListWidget item view class.
                                                                                                                                                MainWindow
                                                                                                                                                prettyqt.widgets.mainwindow
                                                                                                                                                Main application window.
                                                                                                                                                MdiArea
                                                                                                                                                prettyqt.widgets.mdiarea
                                                                                                                                                Area in which MDI windows are displayed.
                                                                                                                                                  MdiSubWindow
                                                                                                                                                  prettyqt.widgets.mdisubwindow
                                                                                                                                                  Subwindow class for QMdiArea.
                                                                                                                                                    Menu
                                                                                                                                                    prettyqt.widgets.menu
                                                                                                                                                    Menu widget for use in menu bars, context menus, and other popup menus.
                                                                                                                                                      MenuBar
                                                                                                                                                      prettyqt.widgets.menubar
                                                                                                                                                      Horizontal menu bar.
                                                                                                                                                        MessageBox
                                                                                                                                                        prettyqt.widgets.messagebox
                                                                                                                                                        Modal dialog for informing the user (and for receiving an answer).
                                                                                                                                                        PanGesture
                                                                                                                                                        prettyqt.widgets.pangesture
                                                                                                                                                        Describes a panning gesture made by the user.
                                                                                                                                                          PinchGesture
                                                                                                                                                          prettyqt.widgets.pinchgesture
                                                                                                                                                          Describes a pinch gesture made by the user.
                                                                                                                                                            PlainTextDocumentLayout
                                                                                                                                                            prettyqt.widgets.plaintextdocumentlayout
                                                                                                                                                            Implements a plain text layout for QTextDocument.
                                                                                                                                                              PlainTextEdit
                                                                                                                                                              prettyqt.widgets.plaintextedit
                                                                                                                                                              Widget that is used to edit and display plain text.
                                                                                                                                                              PlainTextEditMixin
                                                                                                                                                              prettyqt.widgets.plaintextedit
                                                                                                                                                              ProgressBar
                                                                                                                                                              prettyqt.widgets.progressbar
                                                                                                                                                              Horizontal or vertical progress bar.
                                                                                                                                                                ProgressDialog
                                                                                                                                                                prettyqt.widgets.progressdialog
                                                                                                                                                                Feedback on the progress of a slow operation.
                                                                                                                                                                  ProxyStyle
                                                                                                                                                                  prettyqt.widgets.proxystyle
                                                                                                                                                                  Convenience class that simplifies dynamically overriding QStyle elements.
                                                                                                                                                                  • HollowHandleStyle
                                                                                                                                                                  PushButton
                                                                                                                                                                  prettyqt.widgets.pushbutton
                                                                                                                                                                  Command button.
                                                                                                                                                                    PushButtonMixin
                                                                                                                                                                    prettyqt.widgets.pushbutton
                                                                                                                                                                    RadioButton
                                                                                                                                                                    prettyqt.widgets.radiobutton
                                                                                                                                                                    Radio button with a text label.
                                                                                                                                                                      RhiWidget
                                                                                                                                                                      prettyqt.widgets.rhiwidget
                                                                                                                                                                      Widget for rendering 3D graphics via the Qt Rendering Hardware Interface.
                                                                                                                                                                        RhiWidgetMixin
                                                                                                                                                                        prettyqt.widgets.rhiwidget
                                                                                                                                                                        RubberBand
                                                                                                                                                                        prettyqt.widgets.rubberband
                                                                                                                                                                        Rectangle or line that can indicate a selection or a boundary.
                                                                                                                                                                          ScrollArea
                                                                                                                                                                          prettyqt.widgets.scrollarea
                                                                                                                                                                          Scrolling view onto another widget.
                                                                                                                                                                            ScrollBar
                                                                                                                                                                            prettyqt.widgets.scrollbar
                                                                                                                                                                            Vertical or horizontal scroll bar.
                                                                                                                                                                            Scroller
                                                                                                                                                                            prettyqt.widgets.scroller
                                                                                                                                                                            Enables kinetic scrolling for any scrolling widget or graphics item.
                                                                                                                                                                              ScrollerProperties
                                                                                                                                                                              prettyqt.widgets.scrollerproperties
                                                                                                                                                                              Stores the settings for a QScroller.
                                                                                                                                                                                SizeGrip
                                                                                                                                                                                prettyqt.widgets.sizegrip
                                                                                                                                                                                Resize handle for resizing top-level windows.
                                                                                                                                                                                  SizePolicy
                                                                                                                                                                                  prettyqt.widgets.sizepolicy
                                                                                                                                                                                  Layout attribute describing horizontal and vertical resizing policy.
                                                                                                                                                                                    Slider
                                                                                                                                                                                    prettyqt.widgets.slider
                                                                                                                                                                                    Vertical or horizontal slider.
                                                                                                                                                                                    SpacerItem
                                                                                                                                                                                    prettyqt.widgets.spaceritem
                                                                                                                                                                                    Blank space in a layout.
                                                                                                                                                                                      SpinBox
                                                                                                                                                                                      prettyqt.widgets.spinbox
                                                                                                                                                                                        SplashScreen
                                                                                                                                                                                        prettyqt.widgets.splashscreen
                                                                                                                                                                                        Splash screen that can be shown during application startup.
                                                                                                                                                                                          Splitter
                                                                                                                                                                                          prettyqt.widgets.splitter
                                                                                                                                                                                          Implements a splitter widget.
                                                                                                                                                                                          SplitterHandle
                                                                                                                                                                                          prettyqt.widgets.splitterhandle
                                                                                                                                                                                          Handle functionality for the splitter.
                                                                                                                                                                                            StackedLayout
                                                                                                                                                                                            prettyqt.widgets.stackedlayout
                                                                                                                                                                                            Layout containing stack of widgets where only one widget is visible at a time.
                                                                                                                                                                                              StackedWidget
                                                                                                                                                                                              prettyqt.widgets.stackedwidget
                                                                                                                                                                                              Widget containing stack of widgets where only one widget is visible at a time.
                                                                                                                                                                                                StatusBar
                                                                                                                                                                                                prettyqt.widgets.statusbar
                                                                                                                                                                                                Horizontal bar suitable for presenting status information.
                                                                                                                                                                                                  Style
                                                                                                                                                                                                  prettyqt.widgets.style
                                                                                                                                                                                                  Abstract base class that encapsulates the look and feel of a GUI.
                                                                                                                                                                                                    StyleFactory
                                                                                                                                                                                                    prettyqt.widgets.stylefactory
                                                                                                                                                                                                      StyleMixin
                                                                                                                                                                                                      prettyqt.widgets.style
                                                                                                                                                                                                      StyleOption
                                                                                                                                                                                                      prettyqt.widgets.styleoption
                                                                                                                                                                                                        StyleOptionButton
                                                                                                                                                                                                        prettyqt.widgets.styleoptionbutton
                                                                                                                                                                                                          StyleOptionComboBox
                                                                                                                                                                                                          prettyqt.widgets.styleoptioncombobox
                                                                                                                                                                                                            StyleOptionComplex
                                                                                                                                                                                                            prettyqt.widgets.styleoptioncomplex
                                                                                                                                                                                                              StyleOptionComplexMixin
                                                                                                                                                                                                              prettyqt.widgets.styleoptioncomplex
                                                                                                                                                                                                              StyleOptionDockWidget
                                                                                                                                                                                                              prettyqt.widgets.styleoptiondockwidget
                                                                                                                                                                                                                StyleOptionFocusRect
                                                                                                                                                                                                                prettyqt.widgets.styleoptionfocusrect
                                                                                                                                                                                                                  StyleOptionFrame
                                                                                                                                                                                                                  prettyqt.widgets.styleoptionframe
                                                                                                                                                                                                                    StyleOptionGraphicsItem
                                                                                                                                                                                                                    prettyqt.widgets.styleoptiongraphicsitem
                                                                                                                                                                                                                      StyleOptionGroupBox
                                                                                                                                                                                                                      prettyqt.widgets.styleoptiongroupbox
                                                                                                                                                                                                                        StyleOptionHeader
                                                                                                                                                                                                                        prettyqt.widgets.styleoptionheader
                                                                                                                                                                                                                          StyleOptionHeaderMixin
                                                                                                                                                                                                                          prettyqt.widgets.styleoptionheader
                                                                                                                                                                                                                          StyleOptionHeaderV2
                                                                                                                                                                                                                          prettyqt.widgets.styleoptionheaderv2
                                                                                                                                                                                                                          Describes the parameters for drawing a header (v2).
                                                                                                                                                                                                                            StyleOptionMenuItem
                                                                                                                                                                                                                            prettyqt.widgets.styleoptionmenuitem
                                                                                                                                                                                                                              StyleOptionMenuItemMixin
                                                                                                                                                                                                                              prettyqt.widgets.styleoptionmenuitem
                                                                                                                                                                                                                              StyleOptionMenuItemV2
                                                                                                                                                                                                                              prettyqt.widgets.styleoptionmenuitemv2
                                                                                                                                                                                                                              Describes the parameters for drawing a menu item (v2).
                                                                                                                                                                                                                                StyleOptionMixin
                                                                                                                                                                                                                                prettyqt.widgets.styleoption
                                                                                                                                                                                                                                StyleOptionProgressBar
                                                                                                                                                                                                                                prettyqt.widgets.styleoptionprogressbar
                                                                                                                                                                                                                                  StyleOptionRubberBand
                                                                                                                                                                                                                                  prettyqt.widgets.styleoptionrubberband
                                                                                                                                                                                                                                    StyleOptionSizeGrip
                                                                                                                                                                                                                                    prettyqt.widgets.styleoptionsizegrip
                                                                                                                                                                                                                                      StyleOptionSlider
                                                                                                                                                                                                                                      prettyqt.widgets.styleoptionslider
                                                                                                                                                                                                                                        StyleOptionSpinBox
                                                                                                                                                                                                                                        prettyqt.widgets.styleoptionspinbox
                                                                                                                                                                                                                                          StyleOptionTab
                                                                                                                                                                                                                                          prettyqt.widgets.styleoptiontab
                                                                                                                                                                                                                                            StyleOptionTabBarBase
                                                                                                                                                                                                                                            prettyqt.widgets.styleoptiontabbarbase
                                                                                                                                                                                                                                              StyleOptionTabWidgetFrame
                                                                                                                                                                                                                                              prettyqt.widgets.styleoptiontabwidgetframe
                                                                                                                                                                                                                                                StyleOptionTitleBar
                                                                                                                                                                                                                                                prettyqt.widgets.styleoptiontitlebar
                                                                                                                                                                                                                                                  StyleOptionToolBar
                                                                                                                                                                                                                                                  prettyqt.widgets.styleoptiontoolbar
                                                                                                                                                                                                                                                    StyleOptionToolBox
                                                                                                                                                                                                                                                    prettyqt.widgets.styleoptiontoolbox
                                                                                                                                                                                                                                                      StyleOptionToolButton
                                                                                                                                                                                                                                                      prettyqt.widgets.styleoptiontoolbutton
                                                                                                                                                                                                                                                        StyleOptionViewItem
                                                                                                                                                                                                                                                        prettyqt.widgets.styleoptionviewitem
                                                                                                                                                                                                                                                          StylePainter
                                                                                                                                                                                                                                                          prettyqt.widgets.stylepainter
                                                                                                                                                                                                                                                          Convenience class for drawing QStyle elements inside a widget.
                                                                                                                                                                                                                                                            StyledItemDelegate
                                                                                                                                                                                                                                                            prettyqt.widgets.styleditemdelegate
                                                                                                                                                                                                                                                            SwipeGesture
                                                                                                                                                                                                                                                            prettyqt.widgets.swipegesture
                                                                                                                                                                                                                                                              SystemTrayIcon
                                                                                                                                                                                                                                                              prettyqt.widgets.systemtrayicon
                                                                                                                                                                                                                                                              Icon for an application in the system tray.
                                                                                                                                                                                                                                                                TabBar
                                                                                                                                                                                                                                                                prettyqt.widgets.tabbar
                                                                                                                                                                                                                                                                Tab bar, e.g. for use in tabbed dialogs.
                                                                                                                                                                                                                                                                  TabWidget
                                                                                                                                                                                                                                                                  prettyqt.widgets.tabwidget
                                                                                                                                                                                                                                                                  Stack of tabbed widgets.
                                                                                                                                                                                                                                                                    TableView
                                                                                                                                                                                                                                                                    prettyqt.widgets.tableview
                                                                                                                                                                                                                                                                    Default model/view implementation of a table view.
                                                                                                                                                                                                                                                                    TableViewMixin
                                                                                                                                                                                                                                                                    prettyqt.widgets.tableview
                                                                                                                                                                                                                                                                    TableWidget
                                                                                                                                                                                                                                                                    prettyqt.widgets.tablewidget
                                                                                                                                                                                                                                                                      TableWidgetItem
                                                                                                                                                                                                                                                                      prettyqt.widgets.tablewidgetitem
                                                                                                                                                                                                                                                                      Item for use with the QTableWidget class.
                                                                                                                                                                                                                                                                        TableWidgetSelectionRange
                                                                                                                                                                                                                                                                        prettyqt.widgets.tablewidgetselectionrange
                                                                                                                                                                                                                                                                          TapAndHoldGesture
                                                                                                                                                                                                                                                                          prettyqt.widgets.tapandholdgesture
                                                                                                                                                                                                                                                                            TapGesture
                                                                                                                                                                                                                                                                            prettyqt.widgets.tapgesture
                                                                                                                                                                                                                                                                            Describes a tap gesture made by the user.
                                                                                                                                                                                                                                                                              TextBrowser
                                                                                                                                                                                                                                                                              prettyqt.widgets.textbrowser
                                                                                                                                                                                                                                                                              Rich text browser with hypertext navigation.
                                                                                                                                                                                                                                                                                TextEdit
                                                                                                                                                                                                                                                                                prettyqt.widgets.textedit
                                                                                                                                                                                                                                                                                Widget that is used to edit and display both plain and rich text.
                                                                                                                                                                                                                                                                                TextEditMixin
                                                                                                                                                                                                                                                                                prettyqt.widgets.textedit
                                                                                                                                                                                                                                                                                TimeEdit
                                                                                                                                                                                                                                                                                prettyqt.widgets.timeedit
                                                                                                                                                                                                                                                                                Widget for editing times based on the QDateTimeEdit widget.
                                                                                                                                                                                                                                                                                  ToolBar
                                                                                                                                                                                                                                                                                  prettyqt.widgets.toolbar
                                                                                                                                                                                                                                                                                  Movable panel that contains a set of controls.
                                                                                                                                                                                                                                                                                  • BreadCrumbsToolBar
                                                                                                                                                                                                                                                                                  ToolBox
                                                                                                                                                                                                                                                                                  prettyqt.widgets.toolbox
                                                                                                                                                                                                                                                                                  Column of tabbed widget items.
                                                                                                                                                                                                                                                                                    ToolButton
                                                                                                                                                                                                                                                                                    prettyqt.widgets.toolbutton
                                                                                                                                                                                                                                                                                    Quick-access button to commands or options, usually used inside a QToolBar.
                                                                                                                                                                                                                                                                                    ToolTip
                                                                                                                                                                                                                                                                                    prettyqt.widgets.tooltip
                                                                                                                                                                                                                                                                                    Tool tips (balloon help) for any widget.
                                                                                                                                                                                                                                                                                      TreeView
                                                                                                                                                                                                                                                                                      prettyqt.widgets.treeview
                                                                                                                                                                                                                                                                                      Default model/view implementation of a tree view.
                                                                                                                                                                                                                                                                                      TreeViewMixin
                                                                                                                                                                                                                                                                                      prettyqt.widgets.treeview
                                                                                                                                                                                                                                                                                      TreeWidget
                                                                                                                                                                                                                                                                                      prettyqt.widgets.treewidget
                                                                                                                                                                                                                                                                                      Tree view that uses a predefined tree model.
                                                                                                                                                                                                                                                                                        TreeWidgetItem
                                                                                                                                                                                                                                                                                        prettyqt.widgets.treewidgetitem
                                                                                                                                                                                                                                                                                          TreeWidgetItemIterator
                                                                                                                                                                                                                                                                                          prettyqt.widgets.treewidgetitemiterator
                                                                                                                                                                                                                                                                                            UndoView
                                                                                                                                                                                                                                                                                            prettyqt.widgets.undoview
                                                                                                                                                                                                                                                                                            Displays the contents of a QUndoStack.
                                                                                                                                                                                                                                                                                              VBoxLayout
                                                                                                                                                                                                                                                                                              prettyqt.widgets.vboxlayout
                                                                                                                                                                                                                                                                                              Lines up widgets vertically.
                                                                                                                                                                                                                                                                                                WhatsThis
                                                                                                                                                                                                                                                                                                prettyqt.widgets.whatsthis
                                                                                                                                                                                                                                                                                                Simple description of any widget, i.e. answering the question "What's This?".
                                                                                                                                                                                                                                                                                                  Widget
                                                                                                                                                                                                                                                                                                  prettyqt.widgets.widget
                                                                                                                                                                                                                                                                                                  The base class of all user interface objects.
                                                                                                                                                                                                                                                                                                  WidgetAction
                                                                                                                                                                                                                                                                                                  prettyqt.widgets.widgetaction
                                                                                                                                                                                                                                                                                                    WidgetItem
                                                                                                                                                                                                                                                                                                    prettyqt.widgets.widgetitem
                                                                                                                                                                                                                                                                                                    Layout item that represents a widget.
                                                                                                                                                                                                                                                                                                      WidgetMixin
                                                                                                                                                                                                                                                                                                      prettyqt.widgets.widget
                                                                                                                                                                                                                                                                                                      Wizard
                                                                                                                                                                                                                                                                                                      prettyqt.widgets.wizard
                                                                                                                                                                                                                                                                                                      Framework for wizards.
                                                                                                                                                                                                                                                                                                        WizardPage
                                                                                                                                                                                                                                                                                                        prettyqt.widgets.wizardpage
                                                                                                                                                                                                                                                                                                        The base class for wizard pages.

                                                                                                                                                                                                                                                                                                          🛈 DocStrings

                                                                                                                                                                                                                                                                                                          Classes to extend Qt GUI with widgets.

                                                                                                                                                                                                                                                                                                          AbstractButtonMixin

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, _AbstractButtonBase

                                                                                                                                                                                                                                                                                                          Abstract button widget base class, providing functionality common to buttons.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractbutton.py
                                                                                                                                                                                                                                                                                                          class AbstractButtonMixin(widgets.WidgetMixin, _AbstractButtonBase):
                                                                                                                                                                                                                                                                                                              """Abstract button widget base class, providing functionality common to buttons."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __bool__(self):
                                                                                                                                                                                                                                                                                                                  return self.isChecked()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_icon(self, icon: datatypes.IconType):
                                                                                                                                                                                                                                                                                                                  """Set the icon for the button.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      icon: icon to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  icon = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                                  self.setIcon(icon)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_icon(self) -> gui.Icon | None:
                                                                                                                                                                                                                                                                                                                  icon = self.icon()
                                                                                                                                                                                                                                                                                                                  return None if icon.isNull() else gui.Icon(icon)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_style_icon(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  icon: widgets.style.StandardPixmapStr | widgets.QStyle.StandardPixmap,
                                                                                                                                                                                                                                                                                                                  size: datatypes.SizeType = 15,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set theme icon for the button.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      icon: icon to use
                                                                                                                                                                                                                                                                                                                      size: icon size
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  qicon = self.style().standardIcon(
                                                                                                                                                                                                                                                                                                                      widgets.style.STANDARD_PIXMAP.get_enum_value(icon), None, self
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  self.set_icon(qicon)
                                                                                                                                                                                                                                                                                                                  self.setIconSize(datatypes.to_size(size))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_shortcut(self, shortcut: datatypes.KeySequenceType):
                                                                                                                                                                                                                                                                                                                  self.setShortcut(datatypes.to_keysequence(shortcut))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_shortcut(self) -> gui.KeySequence:
                                                                                                                                                                                                                                                                                                                  return gui.KeySequence(
                                                                                                                                                                                                                                                                                                                      self.shortcut().toString(), gui.KeySequence.SequenceFormat.PortableText
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def setText(self, text: str):
                                                                                                                                                                                                                                                                                                                  if not self.objectName() and widgets.application.is_debug():
                                                                                                                                                                                                                                                                                                                      self.setObjectName(text)
                                                                                                                                                                                                                                                                                                                  super().setText(text)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              set_text = setText
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_icon_size(self, size: datatypes.SizeType):
                                                                                                                                                                                                                                                                                                                  """Set size of the icon."""
                                                                                                                                                                                                                                                                                                                  self.setIconSize(datatypes.to_size(size))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_icon_size(self) -> core.Size:
                                                                                                                                                                                                                                                                                                                  return core.Size(self.iconSize())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_value(self) -> bool:
                                                                                                                                                                                                                                                                                                                  return self.isChecked()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self, value: bool):
                                                                                                                                                                                                                                                                                                                  self.setChecked(value)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_icon(icon: datatypes.IconType)

                                                                                                                                                                                                                                                                                                          Set the icon for the button.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          icon IconType

                                                                                                                                                                                                                                                                                                          icon to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractbutton.py
                                                                                                                                                                                                                                                                                                          def set_icon(self, icon: datatypes.IconType):
                                                                                                                                                                                                                                                                                                              """Set the icon for the button.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  icon: icon to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              icon = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                              self.setIcon(icon)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_icon_size(size: datatypes.SizeType)

                                                                                                                                                                                                                                                                                                          Set size of the icon.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractbutton.py
                                                                                                                                                                                                                                                                                                          def set_icon_size(self, size: datatypes.SizeType):
                                                                                                                                                                                                                                                                                                              """Set size of the icon."""
                                                                                                                                                                                                                                                                                                              self.setIconSize(datatypes.to_size(size))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_style_icon(icon: widgets.style.StandardPixmapStr | widgets.QStyle.StandardPixmap, size: datatypes.SizeType = 15)

                                                                                                                                                                                                                                                                                                          Set theme icon for the button.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          icon StandardPixmapStr | StandardPixmap

                                                                                                                                                                                                                                                                                                          icon to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          size SizeType

                                                                                                                                                                                                                                                                                                          icon size

                                                                                                                                                                                                                                                                                                          15
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractbutton.py
                                                                                                                                                                                                                                                                                                          def set_style_icon(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              icon: widgets.style.StandardPixmapStr | widgets.QStyle.StandardPixmap,
                                                                                                                                                                                                                                                                                                              size: datatypes.SizeType = 15,
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set theme icon for the button.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  icon: icon to use
                                                                                                                                                                                                                                                                                                                  size: icon size
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              qicon = self.style().standardIcon(
                                                                                                                                                                                                                                                                                                                  widgets.style.STANDARD_PIXMAP.get_enum_value(icon), None, self
                                                                                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                                                                                              self.set_icon(qicon)
                                                                                                                                                                                                                                                                                                              self.setIconSize(datatypes.to_size(size))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          AbstractGraphicsShapeItem

                                                                                                                                                                                                                                                                                                          Bases: AbstractGraphicsShapeItemMixin, QAbstractGraphicsShapeItem

                                                                                                                                                                                                                                                                                                          Common base for all path items.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractgraphicsshapeitem.py
                                                                                                                                                                                                                                                                                                          class AbstractGraphicsShapeItem(
                                                                                                                                                                                                                                                                                                              AbstractGraphicsShapeItemMixin, widgets.QAbstractGraphicsShapeItem
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Common base for all path items."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          AbstractItemDelegate

                                                                                                                                                                                                                                                                                                          Bases: AbstractItemDelegateMixin, QAbstractItemDelegate

                                                                                                                                                                                                                                                                                                          Used to display and edit data items from a model.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemdelegate.py
                                                                                                                                                                                                                                                                                                          class AbstractItemDelegate(AbstractItemDelegateMixin, QtWidgets.QAbstractItemDelegate):
                                                                                                                                                                                                                                                                                                              """Used to display and edit data items from a model."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          AbstractItemView

                                                                                                                                                                                                                                                                                                          Bases: AbstractItemViewMixin, QAbstractItemView

                                                                                                                                                                                                                                                                                                          The basic functionality for item view classes.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          class AbstractItemView(AbstractItemViewMixin, widgets.QAbstractItemView):
                                                                                                                                                                                                                                                                                                              """The basic functionality for item view classes."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          AbstractItemViewMixin

                                                                                                                                                                                                                                                                                                          Bases: AbstractScrollAreaMixin, _AbstractItemViewBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          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
                                                                                                                                                                                                                                                                                                          552
                                                                                                                                                                                                                                                                                                          553
                                                                                                                                                                                                                                                                                                          554
                                                                                                                                                                                                                                                                                                          555
                                                                                                                                                                                                                                                                                                          556
                                                                                                                                                                                                                                                                                                          557
                                                                                                                                                                                                                                                                                                          558
                                                                                                                                                                                                                                                                                                          559
                                                                                                                                                                                                                                                                                                          560
                                                                                                                                                                                                                                                                                                          561
                                                                                                                                                                                                                                                                                                          562
                                                                                                                                                                                                                                                                                                          563
                                                                                                                                                                                                                                                                                                          564
                                                                                                                                                                                                                                                                                                          565
                                                                                                                                                                                                                                                                                                          566
                                                                                                                                                                                                                                                                                                          567
                                                                                                                                                                                                                                                                                                          568
                                                                                                                                                                                                                                                                                                          569
                                                                                                                                                                                                                                                                                                          570
                                                                                                                                                                                                                                                                                                          571
                                                                                                                                                                                                                                                                                                          572
                                                                                                                                                                                                                                                                                                          573
                                                                                                                                                                                                                                                                                                          574
                                                                                                                                                                                                                                                                                                          575
                                                                                                                                                                                                                                                                                                          576
                                                                                                                                                                                                                                                                                                          577
                                                                                                                                                                                                                                                                                                          578
                                                                                                                                                                                                                                                                                                          579
                                                                                                                                                                                                                                                                                                          580
                                                                                                                                                                                                                                                                                                          581
                                                                                                                                                                                                                                                                                                          582
                                                                                                                                                                                                                                                                                                          583
                                                                                                                                                                                                                                                                                                          584
                                                                                                                                                                                                                                                                                                          585
                                                                                                                                                                                                                                                                                                          586
                                                                                                                                                                                                                                                                                                          587
                                                                                                                                                                                                                                                                                                          588
                                                                                                                                                                                                                                                                                                          589
                                                                                                                                                                                                                                                                                                          590
                                                                                                                                                                                                                                                                                                          591
                                                                                                                                                                                                                                                                                                          592
                                                                                                                                                                                                                                                                                                          593
                                                                                                                                                                                                                                                                                                          594
                                                                                                                                                                                                                                                                                                          595
                                                                                                                                                                                                                                                                                                          596
                                                                                                                                                                                                                                                                                                          597
                                                                                                                                                                                                                                                                                                          598
                                                                                                                                                                                                                                                                                                          599
                                                                                                                                                                                                                                                                                                          600
                                                                                                                                                                                                                                                                                                          601
                                                                                                                                                                                                                                                                                                          602
                                                                                                                                                                                                                                                                                                          603
                                                                                                                                                                                                                                                                                                          604
                                                                                                                                                                                                                                                                                                          605
                                                                                                                                                                                                                                                                                                          606
                                                                                                                                                                                                                                                                                                          607
                                                                                                                                                                                                                                                                                                          608
                                                                                                                                                                                                                                                                                                          609
                                                                                                                                                                                                                                                                                                          610
                                                                                                                                                                                                                                                                                                          611
                                                                                                                                                                                                                                                                                                          612
                                                                                                                                                                                                                                                                                                          613
                                                                                                                                                                                                                                                                                                          614
                                                                                                                                                                                                                                                                                                          615
                                                                                                                                                                                                                                                                                                          616
                                                                                                                                                                                                                                                                                                          617
                                                                                                                                                                                                                                                                                                          618
                                                                                                                                                                                                                                                                                                          619
                                                                                                                                                                                                                                                                                                          620
                                                                                                                                                                                                                                                                                                          621
                                                                                                                                                                                                                                                                                                          622
                                                                                                                                                                                                                                                                                                          623
                                                                                                                                                                                                                                                                                                          624
                                                                                                                                                                                                                                                                                                          625
                                                                                                                                                                                                                                                                                                          626
                                                                                                                                                                                                                                                                                                          627
                                                                                                                                                                                                                                                                                                          628
                                                                                                                                                                                                                                                                                                          629
                                                                                                                                                                                                                                                                                                          630
                                                                                                                                                                                                                                                                                                          631
                                                                                                                                                                                                                                                                                                          632
                                                                                                                                                                                                                                                                                                          633
                                                                                                                                                                                                                                                                                                          634
                                                                                                                                                                                                                                                                                                          635
                                                                                                                                                                                                                                                                                                          636
                                                                                                                                                                                                                                                                                                          637
                                                                                                                                                                                                                                                                                                          638
                                                                                                                                                                                                                                                                                                          639
                                                                                                                                                                                                                                                                                                          640
                                                                                                                                                                                                                                                                                                          641
                                                                                                                                                                                                                                                                                                          642
                                                                                                                                                                                                                                                                                                          643
                                                                                                                                                                                                                                                                                                          644
                                                                                                                                                                                                                                                                                                          645
                                                                                                                                                                                                                                                                                                          646
                                                                                                                                                                                                                                                                                                          647
                                                                                                                                                                                                                                                                                                          648
                                                                                                                                                                                                                                                                                                          649
                                                                                                                                                                                                                                                                                                          650
                                                                                                                                                                                                                                                                                                          651
                                                                                                                                                                                                                                                                                                          652
                                                                                                                                                                                                                                                                                                          653
                                                                                                                                                                                                                                                                                                          654
                                                                                                                                                                                                                                                                                                          655
                                                                                                                                                                                                                                                                                                          656
                                                                                                                                                                                                                                                                                                          657
                                                                                                                                                                                                                                                                                                          658
                                                                                                                                                                                                                                                                                                          659
                                                                                                                                                                                                                                                                                                          660
                                                                                                                                                                                                                                                                                                          661
                                                                                                                                                                                                                                                                                                          662
                                                                                                                                                                                                                                                                                                          663
                                                                                                                                                                                                                                                                                                          664
                                                                                                                                                                                                                                                                                                          665
                                                                                                                                                                                                                                                                                                          666
                                                                                                                                                                                                                                                                                                          667
                                                                                                                                                                                                                                                                                                          668
                                                                                                                                                                                                                                                                                                          669
                                                                                                                                                                                                                                                                                                          670
                                                                                                                                                                                                                                                                                                          671
                                                                                                                                                                                                                                                                                                          672
                                                                                                                                                                                                                                                                                                          673
                                                                                                                                                                                                                                                                                                          674
                                                                                                                                                                                                                                                                                                          675
                                                                                                                                                                                                                                                                                                          676
                                                                                                                                                                                                                                                                                                          677
                                                                                                                                                                                                                                                                                                          678
                                                                                                                                                                                                                                                                                                          679
                                                                                                                                                                                                                                                                                                          680
                                                                                                                                                                                                                                                                                                          681
                                                                                                                                                                                                                                                                                                          682
                                                                                                                                                                                                                                                                                                          683
                                                                                                                                                                                                                                                                                                          684
                                                                                                                                                                                                                                                                                                          685
                                                                                                                                                                                                                                                                                                          686
                                                                                                                                                                                                                                                                                                          687
                                                                                                                                                                                                                                                                                                          688
                                                                                                                                                                                                                                                                                                          689
                                                                                                                                                                                                                                                                                                          690
                                                                                                                                                                                                                                                                                                          691
                                                                                                                                                                                                                                                                                                          692
                                                                                                                                                                                                                                                                                                          693
                                                                                                                                                                                                                                                                                                          694
                                                                                                                                                                                                                                                                                                          695
                                                                                                                                                                                                                                                                                                          696
                                                                                                                                                                                                                                                                                                          697
                                                                                                                                                                                                                                                                                                          698
                                                                                                                                                                                                                                                                                                          699
                                                                                                                                                                                                                                                                                                          700
                                                                                                                                                                                                                                                                                                          701
                                                                                                                                                                                                                                                                                                          702
                                                                                                                                                                                                                                                                                                          703
                                                                                                                                                                                                                                                                                                          704
                                                                                                                                                                                                                                                                                                          705
                                                                                                                                                                                                                                                                                                          706
                                                                                                                                                                                                                                                                                                          707
                                                                                                                                                                                                                                                                                                          708
                                                                                                                                                                                                                                                                                                          709
                                                                                                                                                                                                                                                                                                          710
                                                                                                                                                                                                                                                                                                          711
                                                                                                                                                                                                                                                                                                          712
                                                                                                                                                                                                                                                                                                          713
                                                                                                                                                                                                                                                                                                          714
                                                                                                                                                                                                                                                                                                          715
                                                                                                                                                                                                                                                                                                          716
                                                                                                                                                                                                                                                                                                          717
                                                                                                                                                                                                                                                                                                          718
                                                                                                                                                                                                                                                                                                          719
                                                                                                                                                                                                                                                                                                          720
                                                                                                                                                                                                                                                                                                          721
                                                                                                                                                                                                                                                                                                          722
                                                                                                                                                                                                                                                                                                          723
                                                                                                                                                                                                                                                                                                          724
                                                                                                                                                                                                                                                                                                          725
                                                                                                                                                                                                                                                                                                          726
                                                                                                                                                                                                                                                                                                          727
                                                                                                                                                                                                                                                                                                          728
                                                                                                                                                                                                                                                                                                          729
                                                                                                                                                                                                                                                                                                          730
                                                                                                                                                                                                                                                                                                          731
                                                                                                                                                                                                                                                                                                          732
                                                                                                                                                                                                                                                                                                          733
                                                                                                                                                                                                                                                                                                          734
                                                                                                                                                                                                                                                                                                          735
                                                                                                                                                                                                                                                                                                          736
                                                                                                                                                                                                                                                                                                          737
                                                                                                                                                                                                                                                                                                          738
                                                                                                                                                                                                                                                                                                          739
                                                                                                                                                                                                                                                                                                          740
                                                                                                                                                                                                                                                                                                          741
                                                                                                                                                                                                                                                                                                          742
                                                                                                                                                                                                                                                                                                          743
                                                                                                                                                                                                                                                                                                          744
                                                                                                                                                                                                                                                                                                          745
                                                                                                                                                                                                                                                                                                          746
                                                                                                                                                                                                                                                                                                          747
                                                                                                                                                                                                                                                                                                          748
                                                                                                                                                                                                                                                                                                          749
                                                                                                                                                                                                                                                                                                          class AbstractItemViewMixin(widgets.AbstractScrollAreaMixin, _AbstractItemViewBase):
                                                                                                                                                                                                                                                                                                              model_changed = core.Signal(core.QAbstractItemModel)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  *args,
                                                                                                                                                                                                                                                                                                                  horizontal_scroll_mode="pixel",
                                                                                                                                                                                                                                                                                                                  vertical_scroll_mode="pixel",
                                                                                                                                                                                                                                                                                                                  **kwargs,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  super().__init__(
                                                                                                                                                                                                                                                                                                                      *args,
                                                                                                                                                                                                                                                                                                                      horizontal_scroll_mode=horizontal_scroll_mode,
                                                                                                                                                                                                                                                                                                                      vertical_scroll_mode=vertical_scroll_mode,
                                                                                                                                                                                                                                                                                                                      **kwargs,
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  from prettyqt.utils import proxifier
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  self.proxifier = proxifier.Proxifier(self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __len__(self) -> int:
                                                                                                                                                                                                                                                                                                                  return model.rowCount() if (model := self.model()) is not None else 0
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "dragDropMode": DRAG_DROP_MODE,
                                                                                                                                                                                                                                                                                                                      "horizontalScrollMode": SCROLL_MODE,
                                                                                                                                                                                                                                                                                                                      "verticalScrollMode": SCROLL_MODE,
                                                                                                                                                                                                                                                                                                                      "selectionMode": SELECTION_MODE,
                                                                                                                                                                                                                                                                                                                      "selectionBehavior": SELECTION_BEHAVIOR,
                                                                                                                                                                                                                                                                                                                      "defaultDropAction": constants.DROP_ACTION,
                                                                                                                                                                                                                                                                                                                      "textElideMode": constants.TEXT_ELIDE_MODE,
                                                                                                                                                                                                                                                                                                                      "editTriggers": EDIT_TRIGGERS,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def selectAll(self):
                                                                                                                                                                                                                                                                                                                  """Override, we dont want to selectAll for too many items bc of performance."""
                                                                                                                                                                                                                                                                                                                  if self.model() is None:
                                                                                                                                                                                                                                                                                                                      return
                                                                                                                                                                                                                                                                                                                  if self.model().rowCount() * self.model().columnCount() > 1_000_000:  # noqa: PLR2004
                                                                                                                                                                                                                                                                                                                      logger.warning("Too many cells to select.")
                                                                                                                                                                                                                                                                                                                      return
                                                                                                                                                                                                                                                                                                                  super().selectAll()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_model(self, model: core.QAbstractItemModel | None):
                                                                                                                                                                                                                                                                                                                  """Set the model of this View."""
                                                                                                                                                                                                                                                                                                                  # Delete old selection model explicitely, seems to help with memory usage.
                                                                                                                                                                                                                                                                                                                  old_model = self.model()
                                                                                                                                                                                                                                                                                                                  old_sel_model = self.selectionModel()
                                                                                                                                                                                                                                                                                                                  if old_model is not None or model is not None:
                                                                                                                                                                                                                                                                                                                      self.setModel(model)
                                                                                                                                                                                                                                                                                                                      if model is not None:
                                                                                                                                                                                                                                                                                                                          # always set a parent. PySide6 needs one for proxying.
                                                                                                                                                                                                                                                                                                                          model.setParent(self)
                                                                                                                                                                                                                                                                                                                          self.setSelectionModel(core.ItemSelectionModel(model))
                                                                                                                                                                                                                                                                                                                      self.model_changed.emit(model)
                                                                                                                                                                                                                                                                                                                  # if old_model:
                                                                                                                                                                                                                                                                                                                  #     old_model.deleteLater()
                                                                                                                                                                                                                                                                                                                  #     del old_model
                                                                                                                                                                                                                                                                                                                  if old_sel_model:
                                                                                                                                                                                                                                                                                                                      old_sel_model.deleteLater()
                                                                                                                                                                                                                                                                                                                      del old_sel_model
                                                                                                                                                                                                                                                                                                                  return model
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_model_for(self, data: Any):
                                                                                                                                                                                                                                                                                                                  """Set model for given data type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Pass any data structure and an appropriate model will be chosen automatically.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      data: data to choose model for.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  # we import to collect the models
                                                                                                                                                                                                                                                                                                                  from prettyqt import itemmodels  # noqa: F401
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  for kls in classhelpers.get_subclasses(core.QAbstractItemModel):
                                                                                                                                                                                                                                                                                                                      if (
                                                                                                                                                                                                                                                                                                                          "supports" in kls.__dict__
                                                                                                                                                                                                                                                                                                                          and callable(supports := getattr(kls, "supports", None))
                                                                                                                                                                                                                                                                                                                          and supports(data)
                                                                                                                                                                                                                                                                                                                          and kls.__name__ != "PythonObjectTreeModel"
                                                                                                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                                                                                                          logger.debug("found model for data structure %r", data)
                                                                                                                                                                                                                                                                                                                          break
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      msg = "No suiting model found."
                                                                                                                                                                                                                                                                                                                      raise TypeError(msg)
                                                                                                                                                                                                                                                                                                                  model = kls(data, parent=self)
                                                                                                                                                                                                                                                                                                                  self.set_model(model)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_model(self, skip_proxies: bool = False) -> core.QAbstractItemModel:
                                                                                                                                                                                                                                                                                                                  """Get current model of the ItemView.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Arguments:
                                                                                                                                                                                                                                                                                                                      skip_proxies: Whether to get current model or the non-proxy sourceModel.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  model = self.model()
                                                                                                                                                                                                                                                                                                                  if skip_proxies:
                                                                                                                                                                                                                                                                                                                      while isinstance(model, core.QAbstractProxyModel):
                                                                                                                                                                                                                                                                                                                          model = model.sourceModel()
                                                                                                                                                                                                                                                                                                                  return model
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_models(
                                                                                                                                                                                                                                                                                                                  self, proxies_only: bool = False
                                                                                                                                                                                                                                                                                                              ) -> listdelegators.ListDelegator[core.QAbstractProxyModel]:
                                                                                                                                                                                                                                                                                                                  """Get a list of all (proxy) models connected to this view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Arguments:
                                                                                                                                                                                                                                                                                                                      proxies_only: whether the non-proxy sourceModel should be included.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  model = self.model()
                                                                                                                                                                                                                                                                                                                  models = []
                                                                                                                                                                                                                                                                                                                  while isinstance(model, core.QAbstractProxyModel):
                                                                                                                                                                                                                                                                                                                      models.append(model)
                                                                                                                                                                                                                                                                                                                      model = model.sourceModel()
                                                                                                                                                                                                                                                                                                                  if (not proxies_only) and model is not None:
                                                                                                                                                                                                                                                                                                                      models.append(model)
                                                                                                                                                                                                                                                                                                                  return listdelegators.ListDelegator(models)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_current_index(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  index: core.QModelIndex | tuple | None,
                                                                                                                                                                                                                                                                                                                  operation: Literal["select", "deselect", "toggle"] = "select",
                                                                                                                                                                                                                                                                                                                  *,
                                                                                                                                                                                                                                                                                                                  clear: bool = True,
                                                                                                                                                                                                                                                                                                                  current: bool = False,
                                                                                                                                                                                                                                                                                                                  expand: Literal["rows", "columns"] | None = None,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set current index.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Arguments:
                                                                                                                                                                                                                                                                                                                      index: Index to set.
                                                                                                                                                                                                                                                                                                                      operation: Whether to select, deselect or toggle the current state.
                                                                                                                                                                                                                                                                                                                      clear: Clear Whether to clear previously selected indexes.
                                                                                                                                                                                                                                                                                                                      current: Current selection will be updated.
                                                                                                                                                                                                                                                                                                                      expand: Whether to expand selection to whole column / row.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  match index:
                                                                                                                                                                                                                                                                                                                      case None:
                                                                                                                                                                                                                                                                                                                          self.selectionModel().setCurrentIndex(
                                                                                                                                                                                                                                                                                                                              core.ModelIndex(), core.ItemSelectionModel.SelectionFlag.Clear
                                                                                                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                                                                                                          return
                                                                                                                                                                                                                                                                                                                      case tuple():
                                                                                                                                                                                                                                                                                                                          index = self.model().index(*index)
                                                                                                                                                                                                                                                                                                                      case core.QModelIndex():
                                                                                                                                                                                                                                                                                                                          pass
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise ValueError(index)
                                                                                                                                                                                                                                                                                                                  match operation:
                                                                                                                                                                                                                                                                                                                      case "select":
                                                                                                                                                                                                                                                                                                                          flag = core.ItemSelectionModel.SelectionFlag.Select
                                                                                                                                                                                                                                                                                                                      case "deselect":
                                                                                                                                                                                                                                                                                                                          flag = core.ItemSelectionModel.SelectionFlag.Deselect
                                                                                                                                                                                                                                                                                                                      case "toggle":
                                                                                                                                                                                                                                                                                                                          flag = core.ItemSelectionModel.SelectionFlag.Toggle
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise ValueError(operation)
                                                                                                                                                                                                                                                                                                                  if clear:
                                                                                                                                                                                                                                                                                                                      flag |= core.ItemSelectionModel.SelectionFlag.Clear
                                                                                                                                                                                                                                                                                                                  if current:
                                                                                                                                                                                                                                                                                                                      flag |= core.ItemSelectionModel.SelectionFlag.Current
                                                                                                                                                                                                                                                                                                                  match expand:
                                                                                                                                                                                                                                                                                                                      case "rows":
                                                                                                                                                                                                                                                                                                                          flag |= core.ItemSelectionModel.SelectionFlag.Rows
                                                                                                                                                                                                                                                                                                                      case "columns":
                                                                                                                                                                                                                                                                                                                          flag |= core.ItemSelectionModel.SelectionFlag.Columns
                                                                                                                                                                                                                                                                                                                      case None:
                                                                                                                                                                                                                                                                                                                          pass
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise ValueError(expand)
                                                                                                                                                                                                                                                                                                                  self.selectionModel().setCurrentIndex(index, flag)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def select_index(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  index: core.QModelIndex | tuple | None,
                                                                                                                                                                                                                                                                                                                  operation: Literal["select", "deselect", "toggle"] = "select",
                                                                                                                                                                                                                                                                                                                  *,
                                                                                                                                                                                                                                                                                                                  clear: bool = True,
                                                                                                                                                                                                                                                                                                                  current: bool = False,
                                                                                                                                                                                                                                                                                                                  expand: Literal["rows", "columns"] | None = None,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  # index = self.model().index(self._selected_index)
                                                                                                                                                                                                                                                                                                                  match index:
                                                                                                                                                                                                                                                                                                                      case None:
                                                                                                                                                                                                                                                                                                                          self.selectionModel().setCurrentIndex(
                                                                                                                                                                                                                                                                                                                              core.ModelIndex(), core.ItemSelectionModel.SelectionFlag.Clear
                                                                                                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                                                                                                          return
                                                                                                                                                                                                                                                                                                                      case tuple():
                                                                                                                                                                                                                                                                                                                          index = self.model().index(*index)
                                                                                                                                                                                                                                                                                                                      case core.QModelIndex():
                                                                                                                                                                                                                                                                                                                          pass
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise ValueError(index)
                                                                                                                                                                                                                                                                                                                  match operation:
                                                                                                                                                                                                                                                                                                                      case "select":
                                                                                                                                                                                                                                                                                                                          flag = core.ItemSelectionModel.SelectionFlag.Select
                                                                                                                                                                                                                                                                                                                      case "deselect":
                                                                                                                                                                                                                                                                                                                          flag = core.ItemSelectionModel.SelectionFlag.Deselect
                                                                                                                                                                                                                                                                                                                      case "toggle":
                                                                                                                                                                                                                                                                                                                          flag = core.ItemSelectionModel.SelectionFlag.Toggle
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise ValueError(operation)
                                                                                                                                                                                                                                                                                                                  if clear:
                                                                                                                                                                                                                                                                                                                      flag |= core.ItemSelectionModel.SelectionFlag.Clear
                                                                                                                                                                                                                                                                                                                  if current:
                                                                                                                                                                                                                                                                                                                      flag |= core.ItemSelectionModel.SelectionFlag.Current
                                                                                                                                                                                                                                                                                                                  match expand:
                                                                                                                                                                                                                                                                                                                      case "rows":
                                                                                                                                                                                                                                                                                                                          flag |= core.ItemSelectionModel.SelectionFlag.Rows
                                                                                                                                                                                                                                                                                                                      case "columns":
                                                                                                                                                                                                                                                                                                                          flag |= core.ItemSelectionModel.SelectionFlag.Columns
                                                                                                                                                                                                                                                                                                                      case None:
                                                                                                                                                                                                                                                                                                                          pass
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise ValueError(expand)
                                                                                                                                                                                                                                                                                                                  self.selectionModel().select(index, flag)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # def move_selection(self, row_offset: int = 0, column_offset: int = 0):
                                                                                                                                                                                                                                                                                                              #     """Move selection by an offset."""
                                                                                                                                                                                                                                                                                                              #     for index in self.selectedIndexes():
                                                                                                                                                                                                                                                                                                              #         new_idx = self.model().index(
                                                                                                                                                                                                                                                                                                              #             index.row() + row_offset, index.column() + column_offset, index.parent()
                                                                                                                                                                                                                                                                                                              #         )
                                                                                                                                                                                                                                                                                                              #         if new_idx.isValid():
                                                                                                                                                                                                                                                                                                              #             self.set_current_index(new_idx, current=True, expand="rows")
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def move_row_selection(self, dy: int):
                                                                                                                                                                                                                                                                                                                  for row in self.selected_rows():
                                                                                                                                                                                                                                                                                                                      new_idx = self.model().index(row + dy, 0)
                                                                                                                                                                                                                                                                                                                      if new_idx.isValid():
                                                                                                                                                                                                                                                                                                                          self.set_current_index(new_idx, current=True, expand="rows")
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_delegate(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  delegate: widgets.QAbstractItemDelegate | DelegateStr | None,
                                                                                                                                                                                                                                                                                                                  *,
                                                                                                                                                                                                                                                                                                                  column: int | Sequence | None = None,
                                                                                                                                                                                                                                                                                                                  row: int | Sequence | None = None,
                                                                                                                                                                                                                                                                                                                  persistent: bool = False,
                                                                                                                                                                                                                                                                                                                  **kwargs: Any,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set a item delegate for the view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Arguments:
                                                                                                                                                                                                                                                                                                                      delegate: Delegate to set. Can also be the id of the delegate.
                                                                                                                                                                                                                                                                                                                      column: Column the delegate should be set for.
                                                                                                                                                                                                                                                                                                                      row: Row the column should be set for.
                                                                                                                                                                                                                                                                                                                      persistent: If True, open persistent editors for given area.
                                                                                                                                                                                                                                                                                                                      kwargs: Keyword args to pass to the Delegate ctor if delegate is set by id.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  match delegate:
                                                                                                                                                                                                                                                                                                                      case widgets.QAbstractItemDelegate():
                                                                                                                                                                                                                                                                                                                          dlg = delegate
                                                                                                                                                                                                                                                                                                                      # case "editor":
                                                                                                                                                                                                                                                                                                                      #     delegate = itemdelegates.EditorDelegate(parent=self, **kwargs)
                                                                                                                                                                                                                                                                                                                      # case "widget":
                                                                                                                                                                                                                                                                                                                      #     delegate = itemdelegates.WidgetDelegate(parent=self, **kwargs)
                                                                                                                                                                                                                                                                                                                      # case "html":
                                                                                                                                                                                                                                                                                                                      #     delegate = itemdelegates.HtmlItemDelegate(parent=self, **kwargs)
                                                                                                                                                                                                                                                                                                                      # case "button":
                                                                                                                                                                                                                                                                                                                      #     delegate = itemdelegates.ButtonDelegate(parent=self, **kwargs)
                                                                                                                                                                                                                                                                                                                      case str():
                                                                                                                                                                                                                                                                                                                          kls = classhelpers.get_class_for_id(widgets.StyledItemDelegate, delegate)
                                                                                                                                                                                                                                                                                                                          dlg = kls(parent=self, **kwargs)
                                                                                                                                                                                                                                                                                                                      case None:
                                                                                                                                                                                                                                                                                                                          dlg = widgets.StyledItemDelegate()
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise ValueError(delegate)
                                                                                                                                                                                                                                                                                                                  match column, row:
                                                                                                                                                                                                                                                                                                                      case int(), int():
                                                                                                                                                                                                                                                                                                                          msg = "Only set column or row, not both."
                                                                                                                                                                                                                                                                                                                          raise ValueError(msg)
                                                                                                                                                                                                                                                                                                                      case Sequence(), None:
                                                                                                                                                                                                                                                                                                                          for i in column:
                                                                                                                                                                                                                                                                                                                              self.set_delegate(delegate, column=i, row=row, persistent=persistent)
                                                                                                                                                                                                                                                                                                                      case int(), None:
                                                                                                                                                                                                                                                                                                                          self.setItemDelegateForColumn(column, dlg)
                                                                                                                                                                                                                                                                                                                          if persistent:
                                                                                                                                                                                                                                                                                                                              model = self.model()
                                                                                                                                                                                                                                                                                                                              for i in range(model.rowCount()):
                                                                                                                                                                                                                                                                                                                                  index = model.index(i, column)
                                                                                                                                                                                                                                                                                                                                  self.openPersistentEditor(index)
                                                                                                                                                                                                                                                                                                                      case None, Sequence():
                                                                                                                                                                                                                                                                                                                          for i in row:
                                                                                                                                                                                                                                                                                                                              self.set_delegate(
                                                                                                                                                                                                                                                                                                                                  delegate, column=column, row=i, persistent=persistent
                                                                                                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                                                                                                      case None, int():
                                                                                                                                                                                                                                                                                                                          self.setItemDelegateForRow(row, dlg)
                                                                                                                                                                                                                                                                                                                          if persistent:
                                                                                                                                                                                                                                                                                                                              model = self.model()
                                                                                                                                                                                                                                                                                                                              for i in range(model.columnCount()):
                                                                                                                                                                                                                                                                                                                                  self.openPersistentEditor(model.index(row, i))
                                                                                                                                                                                                                                                                                                                      case None, None:
                                                                                                                                                                                                                                                                                                                          self.setItemDelegate(dlg)
                                                                                                                                                                                                                                                                                                                          if persistent:
                                                                                                                                                                                                                                                                                                                              model = self.model()
                                                                                                                                                                                                                                                                                                                              for i in range(model.rowCount()):
                                                                                                                                                                                                                                                                                                                                  for j in range(model.columnCount()):
                                                                                                                                                                                                                                                                                                                                      self.openPersistentEditor(model.index(i, j))
                                                                                                                                                                                                                                                                                                                  return dlg
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def toggle_select_all(self):
                                                                                                                                                                                                                                                                                                                  """Select all items from list (deselect when all selected)."""
                                                                                                                                                                                                                                                                                                                  if self.selectionModel() is None:
                                                                                                                                                                                                                                                                                                                      return
                                                                                                                                                                                                                                                                                                                  if self.selectionModel().hasSelection():
                                                                                                                                                                                                                                                                                                                      self.clearSelection()
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.selectAll()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_table_color(self, color: str):
                                                                                                                                                                                                                                                                                                                  with self.edit_stylesheet() as ss:
                                                                                                                                                                                                                                                                                                                      ss.QHeaderView.section.backgroundColor.setValue(color)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def current_index(self) -> core.QModelIndex | None:
                                                                                                                                                                                                                                                                                                                  if (model := self.selectionModel()) is not None:
                                                                                                                                                                                                                                                                                                                      return model.currentIndex()
                                                                                                                                                                                                                                                                                                                  return None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def current_data(self, role=constants.USER_ROLE):
                                                                                                                                                                                                                                                                                                                  if (model := self.selectionModel()) is not None:
                                                                                                                                                                                                                                                                                                                      idx = model.currentIndex()
                                                                                                                                                                                                                                                                                                                      return idx.data(role)
                                                                                                                                                                                                                                                                                                                  return None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def current_row(self) -> int | None:
                                                                                                                                                                                                                                                                                                                  if (model := self.selectionModel()) is not None:
                                                                                                                                                                                                                                                                                                                      return model.currentIndex().row()
                                                                                                                                                                                                                                                                                                                  return None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def current_column(self) -> int | None:
                                                                                                                                                                                                                                                                                                                  if (model := self.selectionModel()) is not None:
                                                                                                                                                                                                                                                                                                                      return model.currentIndex().column()
                                                                                                                                                                                                                                                                                                                  return None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def selected_indexes(self) -> listdelegators.ListDelegator[core.QModelIndex]:
                                                                                                                                                                                                                                                                                                                  """Return list of selected indexes in first row."""
                                                                                                                                                                                                                                                                                                                  indexes = (x for x in self.selectedIndexes() if x.column() == 0)
                                                                                                                                                                                                                                                                                                                  indexes = sorted(indexes, key=lambda x: x.row())
                                                                                                                                                                                                                                                                                                                  return listdelegators.ListDelegator(indexes)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def selected_names(self) -> Generator[Any]:
                                                                                                                                                                                                                                                                                                                  """Return generator yielding item names."""
                                                                                                                                                                                                                                                                                                                  return (x.data(constants.NAME_ROLE) for x in self.selected_indexes())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def selected_rows(self) -> Generator[int]:
                                                                                                                                                                                                                                                                                                                  """Return generator yielding row nums."""
                                                                                                                                                                                                                                                                                                                  return (x.row() for x in self.selected_indexes())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def selected_data(
                                                                                                                                                                                                                                                                                                                  self, role: constants.ItemDataRole = constants.USER_ROLE
                                                                                                                                                                                                                                                                                                              ) -> Generator[Any]:
                                                                                                                                                                                                                                                                                                                  """Return generator yielding selected userData.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Arguments:
                                                                                                                                                                                                                                                                                                                      role: ItemRole to return data for.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return (x.data(role) for x in self.selected_indexes())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def setup_dragdrop_move(self):
                                                                                                                                                                                                                                                                                                                  self.setDragEnabled(True)
                                                                                                                                                                                                                                                                                                                  self.setAcceptDrops(True)
                                                                                                                                                                                                                                                                                                                  self.setDragDropMode(self.DragDropMode.DragDrop)
                                                                                                                                                                                                                                                                                                                  self.setDefaultDropAction(constants.MOVE_ACTION)
                                                                                                                                                                                                                                                                                                                  self.setDropIndicatorShown(True)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_edit_triggers(self, *triggers: EditTriggerStr | None):
                                                                                                                                                                                                                                                                                                                  items = ["none" if t is None else t for t in triggers]
                                                                                                                                                                                                                                                                                                                  flags = EDIT_TRIGGERS.merge_flags(items)
                                                                                                                                                                                                                                                                                                                  self.setEditTriggers(flags)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_edit_triggers(self) -> list[EditTriggerStr]:
                                                                                                                                                                                                                                                                                                                  return EDIT_TRIGGERS.get_list(self.editTriggers())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_selection_behavior(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  behavior: SelectionBehaviourStr | widgets.QAbstractItemView.SelectionBehavior,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set selection behavior for given item view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Arguments:
                                                                                                                                                                                                                                                                                                                      behavior: Selection behavior
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setSelectionBehavior(SELECTION_BEHAVIOR.get_enum_value(behavior))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_selection_behavior(self) -> SelectionBehaviourStr:
                                                                                                                                                                                                                                                                                                                  """Return current selection behavior.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      selection behavior
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return SELECTION_BEHAVIOR.inverse[self.selectionBehavior()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_drop_indicator_position(self) -> DropIndicatorPositionStr:
                                                                                                                                                                                                                                                                                                                  """Return position of the drop indicator in relation to the closest item."""
                                                                                                                                                                                                                                                                                                                  return DROP_INDICATOR_POSITION.inverse[self.dropIndicatorPosition()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_drag_drop_mode(
                                                                                                                                                                                                                                                                                                                  self, mode: DragDropModeStr | widgets.QAbstractItemView.DragDropMode
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set drag-drop mode for given item view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: drag-drop mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setDragDropMode(DRAG_DROP_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_drag_drop_mode(self) -> DragDropModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current drag-drop mode."""
                                                                                                                                                                                                                                                                                                                  return DRAG_DROP_MODE.inverse[self.dragDropMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_state(self, state: StateStr | widgets.QAbstractItemView.State):
                                                                                                                                                                                                                                                                                                                  """Set state for given item view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      state: state to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setState(STATE.get_enum_value(state))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_state(self) -> StateStr:
                                                                                                                                                                                                                                                                                                                  """Return current state."""
                                                                                                                                                                                                                                                                                                                  return STATE.inverse[self.state()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_selection_mode(
                                                                                                                                                                                                                                                                                                                  self, mode: SelectionModeStr | widgets.QAbstractItemView.SelectionMode | None
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set selection mode for given item view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: selection mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if mode is None:
                                                                                                                                                                                                                                                                                                                      mode = "none"
                                                                                                                                                                                                                                                                                                                  self.setSelectionMode(SELECTION_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_selection_mode(self) -> SelectionModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current selection mode."""
                                                                                                                                                                                                                                                                                                                  return SELECTION_MODE.inverse[self.selectionMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_scroll_mode(self, mode: ScrollModeStr | widgets.QAbstractItemView.ScrollMode):
                                                                                                                                                                                                                                                                                                                  """Set the scroll mode for both directions.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: mode to set
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setHorizontalScrollMode(SCROLL_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                                  self.setVerticalScrollMode(SCROLL_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_horizontal_scroll_mode(
                                                                                                                                                                                                                                                                                                                  self, mode: ScrollModeStr | widgets.QAbstractItemView.ScrollMode
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the horizontal scroll mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: mode to set
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setHorizontalScrollMode(SCROLL_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_horizontal_scroll_mode(self) -> ScrollModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current horizontal scroll mode."""
                                                                                                                                                                                                                                                                                                                  return SCROLL_MODE.inverse[self.horizontalScrollMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_vertical_scroll_mode(
                                                                                                                                                                                                                                                                                                                  self, mode: ScrollModeStr | widgets.QAbstractItemView.ScrollMode
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the vertical scroll mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: mode to set
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setVerticalScrollMode(SCROLL_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_vertical_scroll_mode(self) -> ScrollModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current vertical scroll mode."""
                                                                                                                                                                                                                                                                                                                  return SCROLL_MODE.inverse[self.verticalScrollMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def num_selected(self) -> int:
                                                                                                                                                                                                                                                                                                                  """Return amount of selected rows.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      amount of selected rows
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if (model := self.selectionModel()) is not None:
                                                                                                                                                                                                                                                                                                                      return len(model.selectedRows())
                                                                                                                                                                                                                                                                                                                  return 0
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def jump_to_column(self, col_num: int):
                                                                                                                                                                                                                                                                                                                  """Make sure column at given index is visible.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  scrolls to column at given index
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      col_num: column to scroll to
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if (model := self.model()) is not None:
                                                                                                                                                                                                                                                                                                                      idx = model.index(0, col_num)
                                                                                                                                                                                                                                                                                                                      self.scrollTo(idx)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def scroll_to_top(self):
                                                                                                                                                                                                                                                                                                                  """Override to use abstractitemview-way of scrolling to top."""
                                                                                                                                                                                                                                                                                                                  self.scrollToTop()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def scroll_to_bottom(self):
                                                                                                                                                                                                                                                                                                                  """Override to use abstractitemview-way of scrolling to bottom."""
                                                                                                                                                                                                                                                                                                                  self.scrollToBottom()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def select_last_row(self):
                                                                                                                                                                                                                                                                                                                  idx = self.model().createIndex(self.model().rowCount() - 1, 0)
                                                                                                                                                                                                                                                                                                                  self.setCurrentIndex(idx)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def select_first_row(self):
                                                                                                                                                                                                                                                                                                                  idx = self.model().index(0, 0)
                                                                                                                                                                                                                                                                                                                  self.set_current_index(idx, current=True, expand="rows")
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def scroll_to(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  index: core.QModelIndex,
                                                                                                                                                                                                                                                                                                                  mode: ScrollHintStr | widgets.QAbstractItemView.ScrollHint = "ensure_visible",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  self.scrollTo(index, SCROLL_HINT.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def highlight_when_inactive(self):
                                                                                                                                                                                                                                                                                                                  """Highlight items when widget does not have focus."""
                                                                                                                                                                                                                                                                                                                  p = self.get_palette()
                                                                                                                                                                                                                                                                                                                  p.highlight_inactive()
                                                                                                                                                                                                                                                                                                                  self.setPalette(p)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_icon_size(self, size: datatypes.SizeType):
                                                                                                                                                                                                                                                                                                                  self.setIconSize(datatypes.to_size(size))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_size_hint_for_column(self, col: int, row_limit: int = 25) -> int:
                                                                                                                                                                                                                                                                                                                  """Get a size hint for given column by finding widest cell.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Arguments:
                                                                                                                                                                                                                                                                                                                      col: columnt to get size hint for.
                                                                                                                                                                                                                                                                                                                      row_limit: number of rows to check.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  to_check = min(row_limit, self.model().rowCount())
                                                                                                                                                                                                                                                                                                                  return max(
                                                                                                                                                                                                                                                                                                                      self.sizeHintForIndex(self.model().index(row, col)).width()
                                                                                                                                                                                                                                                                                                                      for row in range(to_check)
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def sync_with(
                                                                                                                                                                                                                                                                                                                  self: widgets.TableViewMixin,
                                                                                                                                                                                                                                                                                                                  table_to_sync: widgets.TableViewMixin,
                                                                                                                                                                                                                                                                                                                  orientation: constants.OrientationStr | constants.Orientation,
                                                                                                                                                                                                                                                                                                              ) -> list[core.QMetaObject.Connection]:
                                                                                                                                                                                                                                                                                                                  orientation = constants.ORIENTATION.get_enum_value(orientation)
                                                                                                                                                                                                                                                                                                                  """Sync ItemView cell widths and scrollbars with another ItemView.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Arguments:
                                                                                                                                                                                                                                                                                                                      table_to_sync: Table to sync with
                                                                                                                                                                                                                                                                                                                      orientation: Whether to sync horizontal or vertical orientation.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  def _table_resized(col, _, new_size, table, orientation):
                                                                                                                                                                                                                                                                                                                      if orientation == constants.HORIZONTAL:
                                                                                                                                                                                                                                                                                                                          table.setColumnWidth(col, new_size)
                                                                                                                                                                                                                                                                                                                      else:
                                                                                                                                                                                                                                                                                                                          table.setRowHeight(col, new_size)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  _table_1_resized = functools.partial(
                                                                                                                                                                                                                                                                                                                      _table_resized, table=self, orientation=orientation
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  _table_2_resized = functools.partial(
                                                                                                                                                                                                                                                                                                                      _table_resized, table=table_to_sync, orientation=orientation
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  if orientation == constants.VERTICAL:
                                                                                                                                                                                                                                                                                                                      h1 = self.v_scrollbar.valueChanged.connect(table_to_sync.v_scrollbar.setValue)
                                                                                                                                                                                                                                                                                                                      h2 = table_to_sync.v_scrollbar.valueChanged.connect(self.v_scrollbar.setValue)
                                                                                                                                                                                                                                                                                                                      h3 = self.v_header.sectionResized.connect(_table_2_resized)
                                                                                                                                                                                                                                                                                                                      h4 = table_to_sync.v_header.sectionResized.connect(_table_1_resized)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      h1 = self.h_scrollbar.valueChanged.connect(table_to_sync.h_scrollbar.setValue)
                                                                                                                                                                                                                                                                                                                      h2 = table_to_sync.h_scrollbar.valueChanged.connect(self.h_scrollbar.setValue)
                                                                                                                                                                                                                                                                                                                      h3 = self.h_header.sectionResized.connect(_table_2_resized)
                                                                                                                                                                                                                                                                                                                      h4 = table_to_sync.h_header.sectionResized.connect(_table_1_resized)
                                                                                                                                                                                                                                                                                                                  return [h1, h2, h3, h4]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_visible_section_span(
                                                                                                                                                                                                                                                                                                                  self, orientation: constants.OrientationStr | constants.Orientation
                                                                                                                                                                                                                                                                                                              ) -> tuple[int, int]:
                                                                                                                                                                                                                                                                                                                  """Get range of visible sections.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Arguments:
                                                                                                                                                                                                                                                                                                                      orientation: Whether to get section span for horizontal or vertical header.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  orientation = constants.ORIENTATION.get_enum_value(orientation)
                                                                                                                                                                                                                                                                                                                  top_left = core.QPoint(0, 0)
                                                                                                                                                                                                                                                                                                                  bottom_right = self.viewport().rect().bottomRight()
                                                                                                                                                                                                                                                                                                                  if orientation == constants.HORIZONTAL:
                                                                                                                                                                                                                                                                                                                      start = self.indexAt(top_left).column()
                                                                                                                                                                                                                                                                                                                      count = self.model().columnCount()
                                                                                                                                                                                                                                                                                                                      end = self.indexAt(bottom_right).column()
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      start = self.indexAt(top_left).row()
                                                                                                                                                                                                                                                                                                                      count = self.model().rowCount()
                                                                                                                                                                                                                                                                                                                      end = self.indexAt(bottom_right).row()
                                                                                                                                                                                                                                                                                                                  if count == 0:
                                                                                                                                                                                                                                                                                                                      return (-1, -1)
                                                                                                                                                                                                                                                                                                                  end = count if end == -1 else end + 1
                                                                                                                                                                                                                                                                                                                  return (start, end)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_drag_drop_mode() -> DragDropModeStr

                                                                                                                                                                                                                                                                                                          Return current drag-drop mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def get_drag_drop_mode(self) -> DragDropModeStr:
                                                                                                                                                                                                                                                                                                              """Return current drag-drop mode."""
                                                                                                                                                                                                                                                                                                              return DRAG_DROP_MODE.inverse[self.dragDropMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_drop_indicator_position() -> DropIndicatorPositionStr

                                                                                                                                                                                                                                                                                                          Return position of the drop indicator in relation to the closest item.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def get_drop_indicator_position(self) -> DropIndicatorPositionStr:
                                                                                                                                                                                                                                                                                                              """Return position of the drop indicator in relation to the closest item."""
                                                                                                                                                                                                                                                                                                              return DROP_INDICATOR_POSITION.inverse[self.dropIndicatorPosition()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_horizontal_scroll_mode() -> ScrollModeStr

                                                                                                                                                                                                                                                                                                          Return current horizontal scroll mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def get_horizontal_scroll_mode(self) -> ScrollModeStr:
                                                                                                                                                                                                                                                                                                              """Return current horizontal scroll mode."""
                                                                                                                                                                                                                                                                                                              return SCROLL_MODE.inverse[self.horizontalScrollMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_model(skip_proxies: bool = False) -> core.QAbstractItemModel

                                                                                                                                                                                                                                                                                                          Get current model of the ItemView.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          skip_proxies bool

                                                                                                                                                                                                                                                                                                          Whether to get current model or the non-proxy sourceModel.

                                                                                                                                                                                                                                                                                                          False
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def get_model(self, skip_proxies: bool = False) -> core.QAbstractItemModel:
                                                                                                                                                                                                                                                                                                              """Get current model of the ItemView.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Arguments:
                                                                                                                                                                                                                                                                                                                  skip_proxies: Whether to get current model or the non-proxy sourceModel.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              model = self.model()
                                                                                                                                                                                                                                                                                                              if skip_proxies:
                                                                                                                                                                                                                                                                                                                  while isinstance(model, core.QAbstractProxyModel):
                                                                                                                                                                                                                                                                                                                      model = model.sourceModel()
                                                                                                                                                                                                                                                                                                              return model
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_models(proxies_only: bool = False) -> listdelegators.ListDelegator[core.QAbstractProxyModel]

                                                                                                                                                                                                                                                                                                          Get a list of all (proxy) models connected to this view.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          proxies_only bool

                                                                                                                                                                                                                                                                                                          whether the non-proxy sourceModel should be included.

                                                                                                                                                                                                                                                                                                          False
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def get_models(
                                                                                                                                                                                                                                                                                                              self, proxies_only: bool = False
                                                                                                                                                                                                                                                                                                          ) -> listdelegators.ListDelegator[core.QAbstractProxyModel]:
                                                                                                                                                                                                                                                                                                              """Get a list of all (proxy) models connected to this view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Arguments:
                                                                                                                                                                                                                                                                                                                  proxies_only: whether the non-proxy sourceModel should be included.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              model = self.model()
                                                                                                                                                                                                                                                                                                              models = []
                                                                                                                                                                                                                                                                                                              while isinstance(model, core.QAbstractProxyModel):
                                                                                                                                                                                                                                                                                                                  models.append(model)
                                                                                                                                                                                                                                                                                                                  model = model.sourceModel()
                                                                                                                                                                                                                                                                                                              if (not proxies_only) and model is not None:
                                                                                                                                                                                                                                                                                                                  models.append(model)
                                                                                                                                                                                                                                                                                                              return listdelegators.ListDelegator(models)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_selection_behavior() -> SelectionBehaviourStr

                                                                                                                                                                                                                                                                                                          Return current selection behavior.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def get_selection_behavior(self) -> SelectionBehaviourStr:
                                                                                                                                                                                                                                                                                                              """Return current selection behavior.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  selection behavior
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return SELECTION_BEHAVIOR.inverse[self.selectionBehavior()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_selection_mode() -> SelectionModeStr

                                                                                                                                                                                                                                                                                                          Return current selection mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def get_selection_mode(self) -> SelectionModeStr:
                                                                                                                                                                                                                                                                                                              """Return current selection mode."""
                                                                                                                                                                                                                                                                                                              return SELECTION_MODE.inverse[self.selectionMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_size_hint_for_column(col: int, row_limit: int = 25) -> int

                                                                                                                                                                                                                                                                                                          Get a size hint for given column by finding widest cell.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          col int

                                                                                                                                                                                                                                                                                                          columnt to get size hint for.

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          row_limit int

                                                                                                                                                                                                                                                                                                          number of rows to check.

                                                                                                                                                                                                                                                                                                          25
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def get_size_hint_for_column(self, col: int, row_limit: int = 25) -> int:
                                                                                                                                                                                                                                                                                                              """Get a size hint for given column by finding widest cell.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Arguments:
                                                                                                                                                                                                                                                                                                                  col: columnt to get size hint for.
                                                                                                                                                                                                                                                                                                                  row_limit: number of rows to check.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              to_check = min(row_limit, self.model().rowCount())
                                                                                                                                                                                                                                                                                                              return max(
                                                                                                                                                                                                                                                                                                                  self.sizeHintForIndex(self.model().index(row, col)).width()
                                                                                                                                                                                                                                                                                                                  for row in range(to_check)
                                                                                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_state() -> StateStr

                                                                                                                                                                                                                                                                                                          Return current state.

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

                                                                                                                                                                                                                                                                                                          get_vertical_scroll_mode() -> ScrollModeStr

                                                                                                                                                                                                                                                                                                          Return current vertical scroll mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def get_vertical_scroll_mode(self) -> ScrollModeStr:
                                                                                                                                                                                                                                                                                                              """Return current vertical scroll mode."""
                                                                                                                                                                                                                                                                                                              return SCROLL_MODE.inverse[self.verticalScrollMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_visible_section_span(orientation: constants.OrientationStr | constants.Orientation) -> tuple[int, int]

                                                                                                                                                                                                                                                                                                          Get range of visible sections.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          orientation OrientationStr | Orientation

                                                                                                                                                                                                                                                                                                          Whether to get section span for horizontal or vertical header.

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def get_visible_section_span(
                                                                                                                                                                                                                                                                                                              self, orientation: constants.OrientationStr | constants.Orientation
                                                                                                                                                                                                                                                                                                          ) -> tuple[int, int]:
                                                                                                                                                                                                                                                                                                              """Get range of visible sections.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Arguments:
                                                                                                                                                                                                                                                                                                                  orientation: Whether to get section span for horizontal or vertical header.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              orientation = constants.ORIENTATION.get_enum_value(orientation)
                                                                                                                                                                                                                                                                                                              top_left = core.QPoint(0, 0)
                                                                                                                                                                                                                                                                                                              bottom_right = self.viewport().rect().bottomRight()
                                                                                                                                                                                                                                                                                                              if orientation == constants.HORIZONTAL:
                                                                                                                                                                                                                                                                                                                  start = self.indexAt(top_left).column()
                                                                                                                                                                                                                                                                                                                  count = self.model().columnCount()
                                                                                                                                                                                                                                                                                                                  end = self.indexAt(bottom_right).column()
                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                  start = self.indexAt(top_left).row()
                                                                                                                                                                                                                                                                                                                  count = self.model().rowCount()
                                                                                                                                                                                                                                                                                                                  end = self.indexAt(bottom_right).row()
                                                                                                                                                                                                                                                                                                              if count == 0:
                                                                                                                                                                                                                                                                                                                  return (-1, -1)
                                                                                                                                                                                                                                                                                                              end = count if end == -1 else end + 1
                                                                                                                                                                                                                                                                                                              return (start, end)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          highlight_when_inactive()

                                                                                                                                                                                                                                                                                                          Highlight items when widget does not have focus.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def highlight_when_inactive(self):
                                                                                                                                                                                                                                                                                                              """Highlight items when widget does not have focus."""
                                                                                                                                                                                                                                                                                                              p = self.get_palette()
                                                                                                                                                                                                                                                                                                              p.highlight_inactive()
                                                                                                                                                                                                                                                                                                              self.setPalette(p)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          jump_to_column(col_num: int)

                                                                                                                                                                                                                                                                                                          Make sure column at given index is visible.

                                                                                                                                                                                                                                                                                                          scrolls to column at given index

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          col_num int

                                                                                                                                                                                                                                                                                                          column to scroll to

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def jump_to_column(self, col_num: int):
                                                                                                                                                                                                                                                                                                              """Make sure column at given index is visible.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              scrolls to column at given index
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  col_num: column to scroll to
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if (model := self.model()) is not None:
                                                                                                                                                                                                                                                                                                                  idx = model.index(0, col_num)
                                                                                                                                                                                                                                                                                                                  self.scrollTo(idx)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          num_selected() -> int

                                                                                                                                                                                                                                                                                                          Return amount of selected rows.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def num_selected(self) -> int:
                                                                                                                                                                                                                                                                                                              """Return amount of selected rows.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  amount of selected rows
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if (model := self.selectionModel()) is not None:
                                                                                                                                                                                                                                                                                                                  return len(model.selectedRows())
                                                                                                                                                                                                                                                                                                              return 0
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          scroll_to_bottom()

                                                                                                                                                                                                                                                                                                          Override to use abstractitemview-way of scrolling to bottom.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def scroll_to_bottom(self):
                                                                                                                                                                                                                                                                                                              """Override to use abstractitemview-way of scrolling to bottom."""
                                                                                                                                                                                                                                                                                                              self.scrollToBottom()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          scroll_to_top()

                                                                                                                                                                                                                                                                                                          Override to use abstractitemview-way of scrolling to top.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def scroll_to_top(self):
                                                                                                                                                                                                                                                                                                              """Override to use abstractitemview-way of scrolling to top."""
                                                                                                                                                                                                                                                                                                              self.scrollToTop()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          selectAll()

                                                                                                                                                                                                                                                                                                          Override, we dont want to selectAll for too many items bc of performance.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def selectAll(self):
                                                                                                                                                                                                                                                                                                              """Override, we dont want to selectAll for too many items bc of performance."""
                                                                                                                                                                                                                                                                                                              if self.model() is None:
                                                                                                                                                                                                                                                                                                                  return
                                                                                                                                                                                                                                                                                                              if self.model().rowCount() * self.model().columnCount() > 1_000_000:  # noqa: PLR2004
                                                                                                                                                                                                                                                                                                                  logger.warning("Too many cells to select.")
                                                                                                                                                                                                                                                                                                                  return
                                                                                                                                                                                                                                                                                                              super().selectAll()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          selected_data(role: constants.ItemDataRole = constants.USER_ROLE) -> Generator[Any]

                                                                                                                                                                                                                                                                                                          Return generator yielding selected userData.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          role ItemDataRole

                                                                                                                                                                                                                                                                                                          ItemRole to return data for.

                                                                                                                                                                                                                                                                                                          USER_ROLE
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def selected_data(
                                                                                                                                                                                                                                                                                                              self, role: constants.ItemDataRole = constants.USER_ROLE
                                                                                                                                                                                                                                                                                                          ) -> Generator[Any]:
                                                                                                                                                                                                                                                                                                              """Return generator yielding selected userData.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Arguments:
                                                                                                                                                                                                                                                                                                                  role: ItemRole to return data for.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return (x.data(role) for x in self.selected_indexes())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          selected_indexes() -> listdelegators.ListDelegator[core.QModelIndex]

                                                                                                                                                                                                                                                                                                          Return list of selected indexes in first row.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def selected_indexes(self) -> listdelegators.ListDelegator[core.QModelIndex]:
                                                                                                                                                                                                                                                                                                              """Return list of selected indexes in first row."""
                                                                                                                                                                                                                                                                                                              indexes = (x for x in self.selectedIndexes() if x.column() == 0)
                                                                                                                                                                                                                                                                                                              indexes = sorted(indexes, key=lambda x: x.row())
                                                                                                                                                                                                                                                                                                              return listdelegators.ListDelegator(indexes)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          selected_names() -> Generator[Any]

                                                                                                                                                                                                                                                                                                          Return generator yielding item names.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def selected_names(self) -> Generator[Any]:
                                                                                                                                                                                                                                                                                                              """Return generator yielding item names."""
                                                                                                                                                                                                                                                                                                              return (x.data(constants.NAME_ROLE) for x in self.selected_indexes())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          selected_rows() -> Generator[int]

                                                                                                                                                                                                                                                                                                          Return generator yielding row nums.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def selected_rows(self) -> Generator[int]:
                                                                                                                                                                                                                                                                                                              """Return generator yielding row nums."""
                                                                                                                                                                                                                                                                                                              return (x.row() for x in self.selected_indexes())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_current_index(index: core.QModelIndex | tuple | None, operation: Literal['select', 'deselect', 'toggle'] = 'select', *, clear: bool = True, current: bool = False, expand: Literal['rows', 'columns'] | None = None)

                                                                                                                                                                                                                                                                                                          Set current index.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          index QModelIndex | tuple | None

                                                                                                                                                                                                                                                                                                          Index to set.

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          operation Literal['select', 'deselect', 'toggle']

                                                                                                                                                                                                                                                                                                          Whether to select, deselect or toggle the current state.

                                                                                                                                                                                                                                                                                                          'select'
                                                                                                                                                                                                                                                                                                          clear bool

                                                                                                                                                                                                                                                                                                          Clear Whether to clear previously selected indexes.

                                                                                                                                                                                                                                                                                                          True
                                                                                                                                                                                                                                                                                                          current bool

                                                                                                                                                                                                                                                                                                          Current selection will be updated.

                                                                                                                                                                                                                                                                                                          False
                                                                                                                                                                                                                                                                                                          expand Literal['rows', 'columns'] | None

                                                                                                                                                                                                                                                                                                          Whether to expand selection to whole column / row.

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def set_current_index(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              index: core.QModelIndex | tuple | None,
                                                                                                                                                                                                                                                                                                              operation: Literal["select", "deselect", "toggle"] = "select",
                                                                                                                                                                                                                                                                                                              *,
                                                                                                                                                                                                                                                                                                              clear: bool = True,
                                                                                                                                                                                                                                                                                                              current: bool = False,
                                                                                                                                                                                                                                                                                                              expand: Literal["rows", "columns"] | None = None,
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set current index.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Arguments:
                                                                                                                                                                                                                                                                                                                  index: Index to set.
                                                                                                                                                                                                                                                                                                                  operation: Whether to select, deselect or toggle the current state.
                                                                                                                                                                                                                                                                                                                  clear: Clear Whether to clear previously selected indexes.
                                                                                                                                                                                                                                                                                                                  current: Current selection will be updated.
                                                                                                                                                                                                                                                                                                                  expand: Whether to expand selection to whole column / row.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              match index:
                                                                                                                                                                                                                                                                                                                  case None:
                                                                                                                                                                                                                                                                                                                      self.selectionModel().setCurrentIndex(
                                                                                                                                                                                                                                                                                                                          core.ModelIndex(), core.ItemSelectionModel.SelectionFlag.Clear
                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                                      return
                                                                                                                                                                                                                                                                                                                  case tuple():
                                                                                                                                                                                                                                                                                                                      index = self.model().index(*index)
                                                                                                                                                                                                                                                                                                                  case core.QModelIndex():
                                                                                                                                                                                                                                                                                                                      pass
                                                                                                                                                                                                                                                                                                                  case _:
                                                                                                                                                                                                                                                                                                                      raise ValueError(index)
                                                                                                                                                                                                                                                                                                              match operation:
                                                                                                                                                                                                                                                                                                                  case "select":
                                                                                                                                                                                                                                                                                                                      flag = core.ItemSelectionModel.SelectionFlag.Select
                                                                                                                                                                                                                                                                                                                  case "deselect":
                                                                                                                                                                                                                                                                                                                      flag = core.ItemSelectionModel.SelectionFlag.Deselect
                                                                                                                                                                                                                                                                                                                  case "toggle":
                                                                                                                                                                                                                                                                                                                      flag = core.ItemSelectionModel.SelectionFlag.Toggle
                                                                                                                                                                                                                                                                                                                  case _:
                                                                                                                                                                                                                                                                                                                      raise ValueError(operation)
                                                                                                                                                                                                                                                                                                              if clear:
                                                                                                                                                                                                                                                                                                                  flag |= core.ItemSelectionModel.SelectionFlag.Clear
                                                                                                                                                                                                                                                                                                              if current:
                                                                                                                                                                                                                                                                                                                  flag |= core.ItemSelectionModel.SelectionFlag.Current
                                                                                                                                                                                                                                                                                                              match expand:
                                                                                                                                                                                                                                                                                                                  case "rows":
                                                                                                                                                                                                                                                                                                                      flag |= core.ItemSelectionModel.SelectionFlag.Rows
                                                                                                                                                                                                                                                                                                                  case "columns":
                                                                                                                                                                                                                                                                                                                      flag |= core.ItemSelectionModel.SelectionFlag.Columns
                                                                                                                                                                                                                                                                                                                  case None:
                                                                                                                                                                                                                                                                                                                      pass
                                                                                                                                                                                                                                                                                                                  case _:
                                                                                                                                                                                                                                                                                                                      raise ValueError(expand)
                                                                                                                                                                                                                                                                                                              self.selectionModel().setCurrentIndex(index, flag)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_delegate(delegate: widgets.QAbstractItemDelegate | DelegateStr | None, *, column: int | Sequence | None = None, row: int | Sequence | None = None, persistent: bool = False, **kwargs: Any)

                                                                                                                                                                                                                                                                                                          Set a item delegate for the view.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          delegate QAbstractItemDelegate | DelegateStr | None

                                                                                                                                                                                                                                                                                                          Delegate to set. Can also be the id of the delegate.

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          column int | Sequence | None

                                                                                                                                                                                                                                                                                                          Column the delegate should be set for.

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          row int | Sequence | None

                                                                                                                                                                                                                                                                                                          Row the column should be set for.

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          persistent bool

                                                                                                                                                                                                                                                                                                          If True, open persistent editors for given area.

                                                                                                                                                                                                                                                                                                          False
                                                                                                                                                                                                                                                                                                          kwargs Any

                                                                                                                                                                                                                                                                                                          Keyword args to pass to the Delegate ctor if delegate is set by id.

                                                                                                                                                                                                                                                                                                          {}
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def set_delegate(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              delegate: widgets.QAbstractItemDelegate | DelegateStr | None,
                                                                                                                                                                                                                                                                                                              *,
                                                                                                                                                                                                                                                                                                              column: int | Sequence | None = None,
                                                                                                                                                                                                                                                                                                              row: int | Sequence | None = None,
                                                                                                                                                                                                                                                                                                              persistent: bool = False,
                                                                                                                                                                                                                                                                                                              **kwargs: Any,
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set a item delegate for the view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Arguments:
                                                                                                                                                                                                                                                                                                                  delegate: Delegate to set. Can also be the id of the delegate.
                                                                                                                                                                                                                                                                                                                  column: Column the delegate should be set for.
                                                                                                                                                                                                                                                                                                                  row: Row the column should be set for.
                                                                                                                                                                                                                                                                                                                  persistent: If True, open persistent editors for given area.
                                                                                                                                                                                                                                                                                                                  kwargs: Keyword args to pass to the Delegate ctor if delegate is set by id.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              match delegate:
                                                                                                                                                                                                                                                                                                                  case widgets.QAbstractItemDelegate():
                                                                                                                                                                                                                                                                                                                      dlg = delegate
                                                                                                                                                                                                                                                                                                                  # case "editor":
                                                                                                                                                                                                                                                                                                                  #     delegate = itemdelegates.EditorDelegate(parent=self, **kwargs)
                                                                                                                                                                                                                                                                                                                  # case "widget":
                                                                                                                                                                                                                                                                                                                  #     delegate = itemdelegates.WidgetDelegate(parent=self, **kwargs)
                                                                                                                                                                                                                                                                                                                  # case "html":
                                                                                                                                                                                                                                                                                                                  #     delegate = itemdelegates.HtmlItemDelegate(parent=self, **kwargs)
                                                                                                                                                                                                                                                                                                                  # case "button":
                                                                                                                                                                                                                                                                                                                  #     delegate = itemdelegates.ButtonDelegate(parent=self, **kwargs)
                                                                                                                                                                                                                                                                                                                  case str():
                                                                                                                                                                                                                                                                                                                      kls = classhelpers.get_class_for_id(widgets.StyledItemDelegate, delegate)
                                                                                                                                                                                                                                                                                                                      dlg = kls(parent=self, **kwargs)
                                                                                                                                                                                                                                                                                                                  case None:
                                                                                                                                                                                                                                                                                                                      dlg = widgets.StyledItemDelegate()
                                                                                                                                                                                                                                                                                                                  case _:
                                                                                                                                                                                                                                                                                                                      raise ValueError(delegate)
                                                                                                                                                                                                                                                                                                              match column, row:
                                                                                                                                                                                                                                                                                                                  case int(), int():
                                                                                                                                                                                                                                                                                                                      msg = "Only set column or row, not both."
                                                                                                                                                                                                                                                                                                                      raise ValueError(msg)
                                                                                                                                                                                                                                                                                                                  case Sequence(), None:
                                                                                                                                                                                                                                                                                                                      for i in column:
                                                                                                                                                                                                                                                                                                                          self.set_delegate(delegate, column=i, row=row, persistent=persistent)
                                                                                                                                                                                                                                                                                                                  case int(), None:
                                                                                                                                                                                                                                                                                                                      self.setItemDelegateForColumn(column, dlg)
                                                                                                                                                                                                                                                                                                                      if persistent:
                                                                                                                                                                                                                                                                                                                          model = self.model()
                                                                                                                                                                                                                                                                                                                          for i in range(model.rowCount()):
                                                                                                                                                                                                                                                                                                                              index = model.index(i, column)
                                                                                                                                                                                                                                                                                                                              self.openPersistentEditor(index)
                                                                                                                                                                                                                                                                                                                  case None, Sequence():
                                                                                                                                                                                                                                                                                                                      for i in row:
                                                                                                                                                                                                                                                                                                                          self.set_delegate(
                                                                                                                                                                                                                                                                                                                              delegate, column=column, row=i, persistent=persistent
                                                                                                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                                                                                                  case None, int():
                                                                                                                                                                                                                                                                                                                      self.setItemDelegateForRow(row, dlg)
                                                                                                                                                                                                                                                                                                                      if persistent:
                                                                                                                                                                                                                                                                                                                          model = self.model()
                                                                                                                                                                                                                                                                                                                          for i in range(model.columnCount()):
                                                                                                                                                                                                                                                                                                                              self.openPersistentEditor(model.index(row, i))
                                                                                                                                                                                                                                                                                                                  case None, None:
                                                                                                                                                                                                                                                                                                                      self.setItemDelegate(dlg)
                                                                                                                                                                                                                                                                                                                      if persistent:
                                                                                                                                                                                                                                                                                                                          model = self.model()
                                                                                                                                                                                                                                                                                                                          for i in range(model.rowCount()):
                                                                                                                                                                                                                                                                                                                              for j in range(model.columnCount()):
                                                                                                                                                                                                                                                                                                                                  self.openPersistentEditor(model.index(i, j))
                                                                                                                                                                                                                                                                                                              return dlg
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_drag_drop_mode(mode: DragDropModeStr | widgets.QAbstractItemView.DragDropMode)

                                                                                                                                                                                                                                                                                                          Set drag-drop mode for given item view.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode DragDropModeStr | DragDropMode

                                                                                                                                                                                                                                                                                                          drag-drop mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def set_drag_drop_mode(
                                                                                                                                                                                                                                                                                                              self, mode: DragDropModeStr | widgets.QAbstractItemView.DragDropMode
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set drag-drop mode for given item view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: drag-drop mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setDragDropMode(DRAG_DROP_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_horizontal_scroll_mode(mode: ScrollModeStr | widgets.QAbstractItemView.ScrollMode)

                                                                                                                                                                                                                                                                                                          Set the horizontal scroll mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ScrollModeStr | ScrollMode

                                                                                                                                                                                                                                                                                                          mode to set

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def set_horizontal_scroll_mode(
                                                                                                                                                                                                                                                                                                              self, mode: ScrollModeStr | widgets.QAbstractItemView.ScrollMode
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the horizontal scroll mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: mode to set
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setHorizontalScrollMode(SCROLL_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_model(model: core.QAbstractItemModel | None)

                                                                                                                                                                                                                                                                                                          Set the model of this View.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def set_model(self, model: core.QAbstractItemModel | None):
                                                                                                                                                                                                                                                                                                              """Set the model of this View."""
                                                                                                                                                                                                                                                                                                              # Delete old selection model explicitely, seems to help with memory usage.
                                                                                                                                                                                                                                                                                                              old_model = self.model()
                                                                                                                                                                                                                                                                                                              old_sel_model = self.selectionModel()
                                                                                                                                                                                                                                                                                                              if old_model is not None or model is not None:
                                                                                                                                                                                                                                                                                                                  self.setModel(model)
                                                                                                                                                                                                                                                                                                                  if model is not None:
                                                                                                                                                                                                                                                                                                                      # always set a parent. PySide6 needs one for proxying.
                                                                                                                                                                                                                                                                                                                      model.setParent(self)
                                                                                                                                                                                                                                                                                                                      self.setSelectionModel(core.ItemSelectionModel(model))
                                                                                                                                                                                                                                                                                                                  self.model_changed.emit(model)
                                                                                                                                                                                                                                                                                                              # if old_model:
                                                                                                                                                                                                                                                                                                              #     old_model.deleteLater()
                                                                                                                                                                                                                                                                                                              #     del old_model
                                                                                                                                                                                                                                                                                                              if old_sel_model:
                                                                                                                                                                                                                                                                                                                  old_sel_model.deleteLater()
                                                                                                                                                                                                                                                                                                                  del old_sel_model
                                                                                                                                                                                                                                                                                                              return model
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_model_for(data: Any)

                                                                                                                                                                                                                                                                                                          Set model for given data type.

                                                                                                                                                                                                                                                                                                          Pass any data structure and an appropriate model will be chosen automatically.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          data Any

                                                                                                                                                                                                                                                                                                          data to choose model for.

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def set_model_for(self, data: Any):
                                                                                                                                                                                                                                                                                                              """Set model for given data type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Pass any data structure and an appropriate model will be chosen automatically.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  data: data to choose model for.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              # we import to collect the models
                                                                                                                                                                                                                                                                                                              from prettyqt import itemmodels  # noqa: F401
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              for kls in classhelpers.get_subclasses(core.QAbstractItemModel):
                                                                                                                                                                                                                                                                                                                  if (
                                                                                                                                                                                                                                                                                                                      "supports" in kls.__dict__
                                                                                                                                                                                                                                                                                                                      and callable(supports := getattr(kls, "supports", None))
                                                                                                                                                                                                                                                                                                                      and supports(data)
                                                                                                                                                                                                                                                                                                                      and kls.__name__ != "PythonObjectTreeModel"
                                                                                                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                                                                                                      logger.debug("found model for data structure %r", data)
                                                                                                                                                                                                                                                                                                                      break
                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                  msg = "No suiting model found."
                                                                                                                                                                                                                                                                                                                  raise TypeError(msg)
                                                                                                                                                                                                                                                                                                              model = kls(data, parent=self)
                                                                                                                                                                                                                                                                                                              self.set_model(model)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_scroll_mode(mode: ScrollModeStr | widgets.QAbstractItemView.ScrollMode)

                                                                                                                                                                                                                                                                                                          Set the scroll mode for both directions.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ScrollModeStr | ScrollMode

                                                                                                                                                                                                                                                                                                          mode to set

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def set_scroll_mode(self, mode: ScrollModeStr | widgets.QAbstractItemView.ScrollMode):
                                                                                                                                                                                                                                                                                                              """Set the scroll mode for both directions.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: mode to set
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setHorizontalScrollMode(SCROLL_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                              self.setVerticalScrollMode(SCROLL_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_selection_behavior(behavior: SelectionBehaviourStr | widgets.QAbstractItemView.SelectionBehavior)

                                                                                                                                                                                                                                                                                                          Set selection behavior for given item view.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          behavior SelectionBehaviourStr | SelectionBehavior

                                                                                                                                                                                                                                                                                                          Selection behavior

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def set_selection_behavior(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              behavior: SelectionBehaviourStr | widgets.QAbstractItemView.SelectionBehavior,
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set selection behavior for given item view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Arguments:
                                                                                                                                                                                                                                                                                                                  behavior: Selection behavior
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setSelectionBehavior(SELECTION_BEHAVIOR.get_enum_value(behavior))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_selection_mode(mode: SelectionModeStr | widgets.QAbstractItemView.SelectionMode | None)

                                                                                                                                                                                                                                                                                                          Set selection mode for given item view.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode SelectionModeStr | SelectionMode | None

                                                                                                                                                                                                                                                                                                          selection mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def set_selection_mode(
                                                                                                                                                                                                                                                                                                              self, mode: SelectionModeStr | widgets.QAbstractItemView.SelectionMode | None
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set selection mode for given item view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: selection mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if mode is None:
                                                                                                                                                                                                                                                                                                                  mode = "none"
                                                                                                                                                                                                                                                                                                              self.setSelectionMode(SELECTION_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_state(state: StateStr | widgets.QAbstractItemView.State)

                                                                                                                                                                                                                                                                                                          Set state for given item view.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          state StateStr | State

                                                                                                                                                                                                                                                                                                          state to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def set_state(self, state: StateStr | widgets.QAbstractItemView.State):
                                                                                                                                                                                                                                                                                                              """Set state for given item view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  state: state to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setState(STATE.get_enum_value(state))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_vertical_scroll_mode(mode: ScrollModeStr | widgets.QAbstractItemView.ScrollMode)

                                                                                                                                                                                                                                                                                                          Set the vertical scroll mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ScrollModeStr | ScrollMode

                                                                                                                                                                                                                                                                                                          mode to set

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def set_vertical_scroll_mode(
                                                                                                                                                                                                                                                                                                              self, mode: ScrollModeStr | widgets.QAbstractItemView.ScrollMode
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the vertical scroll mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: mode to set
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setVerticalScrollMode(SCROLL_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          toggle_select_all()

                                                                                                                                                                                                                                                                                                          Select all items from list (deselect when all selected).

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractitemview.py
                                                                                                                                                                                                                                                                                                          def toggle_select_all(self):
                                                                                                                                                                                                                                                                                                              """Select all items from list (deselect when all selected)."""
                                                                                                                                                                                                                                                                                                              if self.selectionModel() is None:
                                                                                                                                                                                                                                                                                                                  return
                                                                                                                                                                                                                                                                                                              if self.selectionModel().hasSelection():
                                                                                                                                                                                                                                                                                                                  self.clearSelection()
                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                  self.selectAll()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          AbstractScrollArea

                                                                                                                                                                                                                                                                                                          Bases: AbstractScrollAreaMixin, QAbstractScrollArea

                                                                                                                                                                                                                                                                                                          Scrolling area with on-demand scroll bars.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractscrollarea.py
                                                                                                                                                                                                                                                                                                          class AbstractScrollArea(AbstractScrollAreaMixin, widgets.QAbstractScrollArea):
                                                                                                                                                                                                                                                                                                              """Scrolling area with on-demand scroll bars."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          AbstractScrollAreaMixin

                                                                                                                                                                                                                                                                                                          Bases: FrameMixin, _AbstractScrollAreaBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractscrollarea.py
                                                                                                                                                                                                                                                                                                          class AbstractScrollAreaMixin(widgets.FrameMixin, _AbstractScrollAreaBase):
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.setHorizontalScrollBar(widgets.ScrollBar(parent=self))
                                                                                                                                                                                                                                                                                                                  self.setVerticalScrollBar(widgets.ScrollBar(parent=self))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "horizontalScrollBarPolicy": constants.SCROLLBAR_POLICY,
                                                                                                                                                                                                                                                                                                                      "sizeAdjustPolicy": SIZE_ADJUST_POLICY,
                                                                                                                                                                                                                                                                                                                      "verticalScrollBarPolicy": constants.SCROLLBAR_POLICY,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @property
                                                                                                                                                                                                                                                                                                              def h_scrollbar(self) -> widgets.ScrollBar:
                                                                                                                                                                                                                                                                                                                  # prettyqt installs its own ScrollBar on construction
                                                                                                                                                                                                                                                                                                                  return cast("widgets.ScrollBar", self.horizontalScrollBar())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @h_scrollbar.setter
                                                                                                                                                                                                                                                                                                              def h_scrollbar(self, scrollbar: widgets.ScrollBar):
                                                                                                                                                                                                                                                                                                                  self.setHorizontalScrollBar(scrollbar)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @property
                                                                                                                                                                                                                                                                                                              def v_scrollbar(self) -> widgets.ScrollBar:
                                                                                                                                                                                                                                                                                                                  return cast("widgets.ScrollBar", self.verticalScrollBar())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @v_scrollbar.setter
                                                                                                                                                                                                                                                                                                              def v_scrollbar(self, scrollbar: widgets.ScrollBar):
                                                                                                                                                                                                                                                                                                                  self.setVerticalScrollBar(scrollbar)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def scroll_by_pixels(self, x: int = 0, y: int = 0):
                                                                                                                                                                                                                                                                                                                  new_x = self.h_scrollbar.value() + x
                                                                                                                                                                                                                                                                                                                  x_val = max(min(new_x, self.h_scrollbar.maximum()), self.h_scrollbar.minimum())
                                                                                                                                                                                                                                                                                                                  new_y = self.h_scrollbar.value() + y
                                                                                                                                                                                                                                                                                                                  y_val = max(min(new_y, self.v_scrollbar.maximum()), self.v_scrollbar.minimum())
                                                                                                                                                                                                                                                                                                                  self.h_scrollbar.setValue(x_val)
                                                                                                                                                                                                                                                                                                                  self.v_scrollbar.setValue(y_val)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_size_adjust_policy(self, policy: SizeAdjustPolicyStr | area.SizeAdjustPolicy):
                                                                                                                                                                                                                                                                                                                  """Set size adjust policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      policy: size adjust policy to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setSizeAdjustPolicy(SIZE_ADJUST_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_size_adjust_policy(self) -> SizeAdjustPolicyStr:
                                                                                                                                                                                                                                                                                                                  """Return size adjust policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      size adjust policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return SIZE_ADJUST_POLICY.inverse[self.sizeAdjustPolicy()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_scrollbar_smooth(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  value: bool = True,
                                                                                                                                                                                                                                                                                                                  animation_duration: int = 500,
                                                                                                                                                                                                                                                                                                                  easing: core.easingcurve.TypeStr | core.QEasingCurve.Type = "out_cubic",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  from prettyqt import custom_widgets
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  if value:
                                                                                                                                                                                                                                                                                                                      self.h_scrollbar = custom_widgets.SmoothScrollBar(
                                                                                                                                                                                                                                                                                                                          "horizontal",
                                                                                                                                                                                                                                                                                                                          parent=self,
                                                                                                                                                                                                                                                                                                                          animation_duration=animation_duration,
                                                                                                                                                                                                                                                                                                                          easing=easing,
                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                                      self.v_scrollbar = custom_widgets.SmoothScrollBar(
                                                                                                                                                                                                                                                                                                                          "vertical",
                                                                                                                                                                                                                                                                                                                          parent=self,
                                                                                                                                                                                                                                                                                                                          animation_duration=animation_duration,
                                                                                                                                                                                                                                                                                                                          easing=easing,
                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.h_scrollbar = widgets.ScrollBar(parent=self)
                                                                                                                                                                                                                                                                                                                      self.v_scrollbar = widgets.ScrollBar(parent=self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_scrollbar_policy(
                                                                                                                                                                                                                                                                                                                  self, mode: constants.ScrollBarPolicyStr | constants.ScrollBarPolicy
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the policy for both scrollbars.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: visibilty to set
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setHorizontalScrollBarPolicy(constants.SCROLLBAR_POLICY.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                                  self.setVerticalScrollBarPolicy(constants.SCROLLBAR_POLICY.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_horizontal_scrollbar_policy(
                                                                                                                                                                                                                                                                                                                  self, mode: constants.ScrollBarPolicyStr | constants.ScrollBarPolicy
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the horizontal scrollbar visibility.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: visibilty to set
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setHorizontalScrollBarPolicy(constants.SCROLLBAR_POLICY[mode])
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_horizontal_scrollbar_policy(self) -> constants.ScrollBarPolicyStr:
                                                                                                                                                                                                                                                                                                                  return constants.SCROLLBAR_POLICY.inverse[self.horizontalScrollBarPolicy()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_vertical_scrollbar_policy(
                                                                                                                                                                                                                                                                                                                  self, mode: constants.ScrollBarPolicyStr | constants.ScrollBarPolicy
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the vertical scrollbar visibility.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: visibilty to set
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setVerticalScrollBarPolicy(constants.SCROLLBAR_POLICY.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_vertical_scrollbar_policy(self) -> constants.ScrollBarPolicyStr:
                                                                                                                                                                                                                                                                                                                  return constants.SCROLLBAR_POLICY.inverse[self.verticalScrollBarPolicy()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_scrollbar_width(self, width: int):
                                                                                                                                                                                                                                                                                                                  """Set the width for both scrollbars.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      width: width in pixels
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.set_horizontal_scrollbar_width(width)
                                                                                                                                                                                                                                                                                                                  self.set_vertical_scrollbar_width(width)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_horizontal_scrollbar_width(self, width: int):
                                                                                                                                                                                                                                                                                                                  """Set the horizontal scrollbar width.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      width: width in pixels
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  with self.h_scrollbar.edit_stylesheet() as ss:
                                                                                                                                                                                                                                                                                                                      ss.QScrollBar.horizontal.height.setValue(f"{width}px")
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_vertical_scrollbar_width(self, width: int):
                                                                                                                                                                                                                                                                                                                  """Set the vertical scrollbar width.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      width: width in pixels
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  with self.v_scrollbar.edit_stylesheet() as ss:
                                                                                                                                                                                                                                                                                                                      ss.QScrollBar.horizontal.height.setValue(f"{width}px")
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def scroll_to_top(self):
                                                                                                                                                                                                                                                                                                                  """Scroll to the top of the scroll area."""
                                                                                                                                                                                                                                                                                                                  self.v_scrollbar.scroll_to_min()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def scroll_to_bottom(self):
                                                                                                                                                                                                                                                                                                                  """Scroll to the bottom of the scroll area."""
                                                                                                                                                                                                                                                                                                                  self.v_scrollbar.scroll_to_max()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_viewport_margins(self, margins: int):
                                                                                                                                                                                                                                                                                                                  self.setViewportMargins(margins, margins, margins, margins)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_scrollbar_widget(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  widget: widgets.QWidget,
                                                                                                                                                                                                                                                                                                                  alignment: constants.AlignmentStr | constants.AlignmentFlag,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  alignment = constants.ALIGNMENTS.get_enum_value(alignment)
                                                                                                                                                                                                                                                                                                                  self.addScrollBarWidget(widget, alignment)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_size_adjust_policy() -> SizeAdjustPolicyStr

                                                                                                                                                                                                                                                                                                          Return size adjust policy.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractscrollarea.py
                                                                                                                                                                                                                                                                                                          def get_size_adjust_policy(self) -> SizeAdjustPolicyStr:
                                                                                                                                                                                                                                                                                                              """Return size adjust policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  size adjust policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return SIZE_ADJUST_POLICY.inverse[self.sizeAdjustPolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          scroll_to_bottom()

                                                                                                                                                                                                                                                                                                          Scroll to the bottom of the scroll area.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractscrollarea.py
                                                                                                                                                                                                                                                                                                          def scroll_to_bottom(self):
                                                                                                                                                                                                                                                                                                              """Scroll to the bottom of the scroll area."""
                                                                                                                                                                                                                                                                                                              self.v_scrollbar.scroll_to_max()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          scroll_to_top()

                                                                                                                                                                                                                                                                                                          Scroll to the top of the scroll area.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractscrollarea.py
                                                                                                                                                                                                                                                                                                          def scroll_to_top(self):
                                                                                                                                                                                                                                                                                                              """Scroll to the top of the scroll area."""
                                                                                                                                                                                                                                                                                                              self.v_scrollbar.scroll_to_min()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_horizontal_scrollbar_policy(mode: constants.ScrollBarPolicyStr | constants.ScrollBarPolicy)

                                                                                                                                                                                                                                                                                                          Set the horizontal scrollbar visibility.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ScrollBarPolicyStr | ScrollBarPolicy

                                                                                                                                                                                                                                                                                                          visibilty to set

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractscrollarea.py
                                                                                                                                                                                                                                                                                                          def set_horizontal_scrollbar_policy(
                                                                                                                                                                                                                                                                                                              self, mode: constants.ScrollBarPolicyStr | constants.ScrollBarPolicy
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the horizontal scrollbar visibility.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: visibilty to set
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setHorizontalScrollBarPolicy(constants.SCROLLBAR_POLICY[mode])
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_horizontal_scrollbar_width(width: int)

                                                                                                                                                                                                                                                                                                          Set the horizontal scrollbar width.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          width int

                                                                                                                                                                                                                                                                                                          width in pixels

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractscrollarea.py
                                                                                                                                                                                                                                                                                                          def set_horizontal_scrollbar_width(self, width: int):
                                                                                                                                                                                                                                                                                                              """Set the horizontal scrollbar width.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  width: width in pixels
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              with self.h_scrollbar.edit_stylesheet() as ss:
                                                                                                                                                                                                                                                                                                                  ss.QScrollBar.horizontal.height.setValue(f"{width}px")
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_scrollbar_policy(mode: constants.ScrollBarPolicyStr | constants.ScrollBarPolicy)

                                                                                                                                                                                                                                                                                                          Set the policy for both scrollbars.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ScrollBarPolicyStr | ScrollBarPolicy

                                                                                                                                                                                                                                                                                                          visibilty to set

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractscrollarea.py
                                                                                                                                                                                                                                                                                                          def set_scrollbar_policy(
                                                                                                                                                                                                                                                                                                              self, mode: constants.ScrollBarPolicyStr | constants.ScrollBarPolicy
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the policy for both scrollbars.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: visibilty to set
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setHorizontalScrollBarPolicy(constants.SCROLLBAR_POLICY.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                              self.setVerticalScrollBarPolicy(constants.SCROLLBAR_POLICY.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_scrollbar_width(width: int)

                                                                                                                                                                                                                                                                                                          Set the width for both scrollbars.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          width int

                                                                                                                                                                                                                                                                                                          width in pixels

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractscrollarea.py
                                                                                                                                                                                                                                                                                                          def set_scrollbar_width(self, width: int):
                                                                                                                                                                                                                                                                                                              """Set the width for both scrollbars.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  width: width in pixels
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.set_horizontal_scrollbar_width(width)
                                                                                                                                                                                                                                                                                                              self.set_vertical_scrollbar_width(width)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_size_adjust_policy(policy: SizeAdjustPolicyStr | area.SizeAdjustPolicy)

                                                                                                                                                                                                                                                                                                          Set size adjust policy.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          policy SizeAdjustPolicyStr | SizeAdjustPolicy

                                                                                                                                                                                                                                                                                                          size adjust policy to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractscrollarea.py
                                                                                                                                                                                                                                                                                                          def set_size_adjust_policy(self, policy: SizeAdjustPolicyStr | area.SizeAdjustPolicy):
                                                                                                                                                                                                                                                                                                              """Set size adjust policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  policy: size adjust policy to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setSizeAdjustPolicy(SIZE_ADJUST_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_vertical_scrollbar_policy(mode: constants.ScrollBarPolicyStr | constants.ScrollBarPolicy)

                                                                                                                                                                                                                                                                                                          Set the vertical scrollbar visibility.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ScrollBarPolicyStr | ScrollBarPolicy

                                                                                                                                                                                                                                                                                                          visibilty to set

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractscrollarea.py
                                                                                                                                                                                                                                                                                                          def set_vertical_scrollbar_policy(
                                                                                                                                                                                                                                                                                                              self, mode: constants.ScrollBarPolicyStr | constants.ScrollBarPolicy
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the vertical scrollbar visibility.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: visibilty to set
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setVerticalScrollBarPolicy(constants.SCROLLBAR_POLICY.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_vertical_scrollbar_width(width: int)

                                                                                                                                                                                                                                                                                                          Set the vertical scrollbar width.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          width int

                                                                                                                                                                                                                                                                                                          width in pixels

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractscrollarea.py
                                                                                                                                                                                                                                                                                                          def set_vertical_scrollbar_width(self, width: int):
                                                                                                                                                                                                                                                                                                              """Set the vertical scrollbar width.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  width: width in pixels
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              with self.v_scrollbar.edit_stylesheet() as ss:
                                                                                                                                                                                                                                                                                                                  ss.QScrollBar.horizontal.height.setValue(f"{width}px")
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          AbstractSlider

                                                                                                                                                                                                                                                                                                          Bases: AbstractSliderMixin, QAbstractSlider

                                                                                                                                                                                                                                                                                                          Integer value within a range.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractslider.py
                                                                                                                                                                                                                                                                                                          class AbstractSlider(AbstractSliderMixin, widgets.QAbstractSlider):
                                                                                                                                                                                                                                                                                                              """Integer value within a range."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          AbstractSliderMixin

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, _AbstractSliderBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractslider.py
                                                                                                                                                                                                                                                                                                          class AbstractSliderMixin(widgets.WidgetMixin, _AbstractSliderBase):
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(int)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "orientation": constants.ORIENTATION,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def on_value_change(self):
                                                                                                                                                                                                                                                                                                                  self.value_changed.emit(self.value())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def is_horizontal(self) -> bool:
                                                                                                                                                                                                                                                                                                                  """Check if silder is horizontal.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      True if horizontal, else False
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return self.orientation() == constants.HORIZONTAL
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def is_vertical(self) -> bool:
                                                                                                                                                                                                                                                                                                                  """Check if silder is vertical.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      True if vertical, else False
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return self.orientation() == constants.VERTICAL
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_horizontal(self):
                                                                                                                                                                                                                                                                                                                  """Set slider orientation to horizontal."""
                                                                                                                                                                                                                                                                                                                  self.setOrientation(constants.HORIZONTAL)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_vertical(self):
                                                                                                                                                                                                                                                                                                                  """Set slider orientation to vertical."""
                                                                                                                                                                                                                                                                                                                  self.setOrientation(constants.VERTICAL)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_orientation(
                                                                                                                                                                                                                                                                                                                  self, orientation: constants.OrientationStr | constants.Orientation
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the orientation of the slider.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      orientation: orientation for the slider
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setOrientation(constants.ORIENTATION.get_enum_value(orientation))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_orientation(self) -> constants.OrientationStr:
                                                                                                                                                                                                                                                                                                                  """Return current orientation.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      orientation
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.ORIENTATION.inverse[self.orientation()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def scroll_to_min(self):
                                                                                                                                                                                                                                                                                                                  """Scroll to the minimum value of the slider."""
                                                                                                                                                                                                                                                                                                                  self.setValue(self.minimum())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def scroll_to_max(self):
                                                                                                                                                                                                                                                                                                                  """Scroll to the maximum value of the slider."""
                                                                                                                                                                                                                                                                                                                  self.setValue(self.maximum())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_range(self, min_val: int, max_val: int):
                                                                                                                                                                                                                                                                                                                  self.setRange(min_val, max_val)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_step_size(self, step_size: int):
                                                                                                                                                                                                                                                                                                                  self.setSingleStep(step_size)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_repeat_action(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  action: SliderActionStr | widgets.QAbstractSlider.SliderAction,
                                                                                                                                                                                                                                                                                                                  threshold: int = 500,
                                                                                                                                                                                                                                                                                                                  repeat_time: int = 50,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the repeat action.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      action: repeat action
                                                                                                                                                                                                                                                                                                                      threshold: initial delay in ms
                                                                                                                                                                                                                                                                                                                      repeat_time: repeat time in ms
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setRepeatAction(SLIDER_ACTION.get_enum_value(action), threshold, repeat_time)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_repeat_action(self) -> SliderActionStr:
                                                                                                                                                                                                                                                                                                                  """Get current repeat action.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      current repeat action
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return SLIDER_ACTION.inverse[self.repeatAction()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def trigger_action(
                                                                                                                                                                                                                                                                                                                  self, action: SliderActionStr | widgets.QAbstractSlider.SliderAction
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Trigger slider action."""
                                                                                                                                                                                                                                                                                                                  self.triggerAction(SLIDER_ACTION.get_enum_value(action))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_value(self) -> int:
                                                                                                                                                                                                                                                                                                                  return self.value()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self, value: int):
                                                                                                                                                                                                                                                                                                                  self.setValue(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def on_scrollbar_range_changed(self, minval: int, maxval: int):
                                                                                                                                                                                                                                                                                                                  if self.value() >= self.maximum() - 1:
                                                                                                                                                                                                                                                                                                                      self.setValue(maxval)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_auto_scroll_to_end(self, scroll: bool = True):
                                                                                                                                                                                                                                                                                                                  """Set to always scroll to the end when range changes."""
                                                                                                                                                                                                                                                                                                                  if scroll:
                                                                                                                                                                                                                                                                                                                      self.rangeChanged.connect(self.on_scrollbar_range_changed)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.rangeChanged.disconnect(self.on_scrollbar_range_changed)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_orientation() -> constants.OrientationStr

                                                                                                                                                                                                                                                                                                          Return current orientation.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractslider.py
                                                                                                                                                                                                                                                                                                          def get_orientation(self) -> constants.OrientationStr:
                                                                                                                                                                                                                                                                                                              """Return current orientation.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  orientation
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.ORIENTATION.inverse[self.orientation()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_repeat_action() -> SliderActionStr

                                                                                                                                                                                                                                                                                                          Get current repeat action.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractslider.py
                                                                                                                                                                                                                                                                                                          def get_repeat_action(self) -> SliderActionStr:
                                                                                                                                                                                                                                                                                                              """Get current repeat action.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  current repeat action
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return SLIDER_ACTION.inverse[self.repeatAction()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          is_horizontal() -> bool

                                                                                                                                                                                                                                                                                                          Check if silder is horizontal.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractslider.py
                                                                                                                                                                                                                                                                                                          def is_horizontal(self) -> bool:
                                                                                                                                                                                                                                                                                                              """Check if silder is horizontal.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  True if horizontal, else False
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return self.orientation() == constants.HORIZONTAL
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          is_vertical() -> bool

                                                                                                                                                                                                                                                                                                          Check if silder is vertical.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractslider.py
                                                                                                                                                                                                                                                                                                          def is_vertical(self) -> bool:
                                                                                                                                                                                                                                                                                                              """Check if silder is vertical.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  True if vertical, else False
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return self.orientation() == constants.VERTICAL
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          scroll_to_max()

                                                                                                                                                                                                                                                                                                          Scroll to the maximum value of the slider.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractslider.py
                                                                                                                                                                                                                                                                                                          def scroll_to_max(self):
                                                                                                                                                                                                                                                                                                              """Scroll to the maximum value of the slider."""
                                                                                                                                                                                                                                                                                                              self.setValue(self.maximum())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          scroll_to_min()

                                                                                                                                                                                                                                                                                                          Scroll to the minimum value of the slider.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractslider.py
                                                                                                                                                                                                                                                                                                          def scroll_to_min(self):
                                                                                                                                                                                                                                                                                                              """Scroll to the minimum value of the slider."""
                                                                                                                                                                                                                                                                                                              self.setValue(self.minimum())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_auto_scroll_to_end(scroll: bool = True)

                                                                                                                                                                                                                                                                                                          Set to always scroll to the end when range changes.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractslider.py
                                                                                                                                                                                                                                                                                                          def set_auto_scroll_to_end(self, scroll: bool = True):
                                                                                                                                                                                                                                                                                                              """Set to always scroll to the end when range changes."""
                                                                                                                                                                                                                                                                                                              if scroll:
                                                                                                                                                                                                                                                                                                                  self.rangeChanged.connect(self.on_scrollbar_range_changed)
                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                  self.rangeChanged.disconnect(self.on_scrollbar_range_changed)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_horizontal()

                                                                                                                                                                                                                                                                                                          Set slider orientation to horizontal.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractslider.py
                                                                                                                                                                                                                                                                                                          def set_horizontal(self):
                                                                                                                                                                                                                                                                                                              """Set slider orientation to horizontal."""
                                                                                                                                                                                                                                                                                                              self.setOrientation(constants.HORIZONTAL)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_orientation(orientation: constants.OrientationStr | constants.Orientation)

                                                                                                                                                                                                                                                                                                          Set the orientation of the slider.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          orientation OrientationStr | Orientation

                                                                                                                                                                                                                                                                                                          orientation for the slider

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractslider.py
                                                                                                                                                                                                                                                                                                          def set_orientation(
                                                                                                                                                                                                                                                                                                              self, orientation: constants.OrientationStr | constants.Orientation
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the orientation of the slider.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  orientation: orientation for the slider
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setOrientation(constants.ORIENTATION.get_enum_value(orientation))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_repeat_action(action: SliderActionStr | widgets.QAbstractSlider.SliderAction, threshold: int = 500, repeat_time: int = 50)

                                                                                                                                                                                                                                                                                                          Set the repeat action.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          action SliderActionStr | SliderAction

                                                                                                                                                                                                                                                                                                          repeat action

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          threshold int

                                                                                                                                                                                                                                                                                                          initial delay in ms

                                                                                                                                                                                                                                                                                                          500
                                                                                                                                                                                                                                                                                                          repeat_time int

                                                                                                                                                                                                                                                                                                          repeat time in ms

                                                                                                                                                                                                                                                                                                          50
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractslider.py
                                                                                                                                                                                                                                                                                                          def set_repeat_action(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              action: SliderActionStr | widgets.QAbstractSlider.SliderAction,
                                                                                                                                                                                                                                                                                                              threshold: int = 500,
                                                                                                                                                                                                                                                                                                              repeat_time: int = 50,
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the repeat action.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  action: repeat action
                                                                                                                                                                                                                                                                                                                  threshold: initial delay in ms
                                                                                                                                                                                                                                                                                                                  repeat_time: repeat time in ms
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setRepeatAction(SLIDER_ACTION.get_enum_value(action), threshold, repeat_time)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_vertical()

                                                                                                                                                                                                                                                                                                          Set slider orientation to vertical.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractslider.py
                                                                                                                                                                                                                                                                                                          def set_vertical(self):
                                                                                                                                                                                                                                                                                                              """Set slider orientation to vertical."""
                                                                                                                                                                                                                                                                                                              self.setOrientation(constants.VERTICAL)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          trigger_action(action: SliderActionStr | widgets.QAbstractSlider.SliderAction)

                                                                                                                                                                                                                                                                                                          Trigger slider action.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractslider.py
                                                                                                                                                                                                                                                                                                          def trigger_action(
                                                                                                                                                                                                                                                                                                              self, action: SliderActionStr | widgets.QAbstractSlider.SliderAction
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Trigger slider action."""
                                                                                                                                                                                                                                                                                                              self.triggerAction(SLIDER_ACTION.get_enum_value(action))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          AbstractSpinBox

                                                                                                                                                                                                                                                                                                          Bases: AbstractSpinBoxMixin, QAbstractSpinBox

                                                                                                                                                                                                                                                                                                          Spinbox and a line edit to display values.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractspinbox.py
                                                                                                                                                                                                                                                                                                          class AbstractSpinBox(AbstractSpinBoxMixin, QtWidgets.QAbstractSpinBox):
                                                                                                                                                                                                                                                                                                              """Spinbox and a line edit to display values."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          AbstractSpinBoxMixin

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, _AbstractSpinBoxBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractspinbox.py
                                                                                                                                                                                                                                                                                                          class AbstractSpinBoxMixin(widgets.WidgetMixin, _AbstractSpinBoxBase):
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, show_group_separator: bool = True, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, show_group_separator=show_group_separator, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.setLineEdit(widgets.LineEdit(parent=self))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "alignment": constants.ALIGNMENTS,
                                                                                                                                                                                                                                                                                                                      "buttonSymbols": SYMBOLS,
                                                                                                                                                                                                                                                                                                                      "correctionMode": CORRECTION_MODES,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def is_valid(self) -> bool:
                                                                                                                                                                                                                                                                                                                  return self.hasAcceptableInput()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_validator(
                                                                                                                                                                                                                                                                                                                  self, validator: QtGui.QValidator | widgets.lineedit.ValidatorStr | None, **kwargs
                                                                                                                                                                                                                                                                                                              ) -> QtGui.QValidator | None:
                                                                                                                                                                                                                                                                                                                  # prettyqt installs its own LineEdit
                                                                                                                                                                                                                                                                                                                  line_edit = cast("widgets.LineEdit", self.lineEdit())
                                                                                                                                                                                                                                                                                                                  return line_edit.set_validator(validator, **kwargs)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_button_symbols(self) -> SymbolStr:
                                                                                                                                                                                                                                                                                                                  """Return button symbol type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      button symbol type
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return SYMBOLS.inverse[self.buttonSymbols()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_button_symbols(self, mode: SymbolStr | QtWidgets.QSpinBox.ButtonSymbols):
                                                                                                                                                                                                                                                                                                                  """Set button symbol type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: button symbol type to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setButtonSymbols(SYMBOLS.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_correction_mode(
                                                                                                                                                                                                                                                                                                                  self, mode: CorrectionModeStr | QtWidgets.QSpinBox.CorrectionMode
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set correction mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: correction mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setCorrectionMode(CORRECTION_MODES.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_correction_mode(self) -> CorrectionModeStr:
                                                                                                                                                                                                                                                                                                                  """Return correction mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      correction mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return CORRECTION_MODES.inverse[self.correctionMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_step_type(
                                                                                                                                                                                                                                                                                                                  self: _NumericSpinBox, mode: StepTypeStr | QtWidgets.QSpinBox.StepType
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set step type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: step type to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setStepType(STEP_TYPES.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_step_type(self: _NumericSpinBox) -> StepTypeStr:
                                                                                                                                                                                                                                                                                                                  """Return step type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      step type
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return STEP_TYPES.inverse[self.stepType()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_special_value(self, value: str):
                                                                                                                                                                                                                                                                                                                  self.setSpecialValueText(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_value(self: _NumericSpinBox) -> float:
                                                                                                                                                                                                                                                                                                                  return self.value()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self: _NumericSpinBox, value: float):
                                                                                                                                                                                                                                                                                                                  self.setValue(value)  # ty: ignore[invalid-argument-type]  # int for QSpinBox
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_button_symbols() -> SymbolStr

                                                                                                                                                                                                                                                                                                          Return button symbol type.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractspinbox.py
                                                                                                                                                                                                                                                                                                          def get_button_symbols(self) -> SymbolStr:
                                                                                                                                                                                                                                                                                                              """Return button symbol type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  button symbol type
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return SYMBOLS.inverse[self.buttonSymbols()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_correction_mode() -> CorrectionModeStr

                                                                                                                                                                                                                                                                                                          Return correction mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractspinbox.py
                                                                                                                                                                                                                                                                                                          def get_correction_mode(self) -> CorrectionModeStr:
                                                                                                                                                                                                                                                                                                              """Return correction mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  correction mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return CORRECTION_MODES.inverse[self.correctionMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_step_type() -> StepTypeStr

                                                                                                                                                                                                                                                                                                          Return step type.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractspinbox.py
                                                                                                                                                                                                                                                                                                          def get_step_type(self: _NumericSpinBox) -> StepTypeStr:
                                                                                                                                                                                                                                                                                                              """Return step type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  step type
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return STEP_TYPES.inverse[self.stepType()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_button_symbols(mode: SymbolStr | QtWidgets.QSpinBox.ButtonSymbols)

                                                                                                                                                                                                                                                                                                          Set button symbol type.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode SymbolStr | ButtonSymbols

                                                                                                                                                                                                                                                                                                          button symbol type to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractspinbox.py
                                                                                                                                                                                                                                                                                                          def set_button_symbols(self, mode: SymbolStr | QtWidgets.QSpinBox.ButtonSymbols):
                                                                                                                                                                                                                                                                                                              """Set button symbol type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: button symbol type to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setButtonSymbols(SYMBOLS.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_correction_mode(mode: CorrectionModeStr | QtWidgets.QSpinBox.CorrectionMode)

                                                                                                                                                                                                                                                                                                          Set correction mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode CorrectionModeStr | CorrectionMode

                                                                                                                                                                                                                                                                                                          correction mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractspinbox.py
                                                                                                                                                                                                                                                                                                          def set_correction_mode(
                                                                                                                                                                                                                                                                                                              self, mode: CorrectionModeStr | QtWidgets.QSpinBox.CorrectionMode
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set correction mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: correction mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setCorrectionMode(CORRECTION_MODES.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_step_type(mode: StepTypeStr | QtWidgets.QSpinBox.StepType)

                                                                                                                                                                                                                                                                                                          Set step type.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode StepTypeStr | StepType

                                                                                                                                                                                                                                                                                                          step type to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/abstractspinbox.py
                                                                                                                                                                                                                                                                                                          def set_step_type(
                                                                                                                                                                                                                                                                                                              self: _NumericSpinBox, mode: StepTypeStr | QtWidgets.QSpinBox.StepType
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set step type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: step type to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setStepType(STEP_TYPES.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Application

                                                                                                                                                                                                                                                                                                          Bases: ApplicationMixin, QApplication

                                                                                                                                                                                                                                                                                                          Manages the GUI application's control flow and main settings.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/application.py
                                                                                                                                                                                                                                                                                                          class Application(ApplicationMixin, widgets.QApplication):
                                                                                                                                                                                                                                                                                                              """Manages the GUI application's control flow and main settings."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          BoxLayout

                                                                                                                                                                                                                                                                                                          Bases: BoxLayoutMixin, QBoxLayout

                                                                                                                                                                                                                                                                                                          Lines up child widgets horizontally or vertically.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/boxlayout.py
                                                                                                                                                                                                                                                                                                          class BoxLayout(BoxLayoutMixin, widgets.QBoxLayout):
                                                                                                                                                                                                                                                                                                              """Lines up child widgets horizontally or vertically."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              ID = "box"
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ButtonGroup

                                                                                                                                                                                                                                                                                                          Bases: ObjectMixin, QButtonGroup

                                                                                                                                                                                                                                                                                                          Container to organize groups of button widgets.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/buttongroup.py
                                                                                                                                                                                                                                                                                                          5
                                                                                                                                                                                                                                                                                                          6
                                                                                                                                                                                                                                                                                                          7
                                                                                                                                                                                                                                                                                                          8
                                                                                                                                                                                                                                                                                                          9
                                                                                                                                                                                                                                                                                                          class ButtonGroup(core.ObjectMixin, QtWidgets.QButtonGroup):
                                                                                                                                                                                                                                                                                                              """Container to organize groups of button widgets."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(self, index: int) -> QtWidgets.QAbstractButton:
                                                                                                                                                                                                                                                                                                                  return self.button(index)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          CalendarWidget

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QCalendarWidget

                                                                                                                                                                                                                                                                                                          Monthly based calendar widget allowing the user to select a date.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/calendarwidget.py
                                                                                                                                                                                                                                                                                                          class CalendarWidget(widgets.WidgetMixin, widgets.QCalendarWidget):
                                                                                                                                                                                                                                                                                                              """Monthly based calendar widget allowing the user to select a date."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "firstDayOfWeek": constants.DAY_OF_WEEK,
                                                                                                                                                                                                                                                                                                                      "horizontalHeaderFormat": HORIZONTAL_HEADER_FORMAT,
                                                                                                                                                                                                                                                                                                                      "verticalHeaderFormat": VERTICAL_HEADER_FORMAT,
                                                                                                                                                                                                                                                                                                                      "selectionMode": SELECTION_MODE,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_date(self) -> dt.date:
                                                                                                                                                                                                                                                                                                                  return cast("dt.date", self.selectedDate().toPython())  # stub: object
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_value(self) -> dt.date:
                                                                                                                                                                                                                                                                                                                  return self.get_date()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self, value: datatypes.DateType):
                                                                                                                                                                                                                                                                                                                  self.setSelectedDate(datatypes.to_date(value))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_range(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  lower: datatypes.DateType,
                                                                                                                                                                                                                                                                                                                  upper: datatypes.DateType,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  self.setMinimumDate(datatypes.to_date(lower))
                                                                                                                                                                                                                                                                                                                  self.setMaximumDate(datatypes.to_date(upper))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_selection_mode(
                                                                                                                                                                                                                                                                                                                  self, mode: SelectionModeStr | widgets.QCalendarWidget.SelectionMode | None
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set selection mode for given calendar widget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: selection mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if mode is None:
                                                                                                                                                                                                                                                                                                                      mode = "none"
                                                                                                                                                                                                                                                                                                                  self.setSelectionMode(SELECTION_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_selection_mode(self) -> SelectionModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current selection mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      selection mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return SELECTION_MODE.inverse[self.selectionMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_selection_mode() -> SelectionModeStr

                                                                                                                                                                                                                                                                                                          Return current selection mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/calendarwidget.py
                                                                                                                                                                                                                                                                                                          def get_selection_mode(self) -> SelectionModeStr:
                                                                                                                                                                                                                                                                                                              """Return current selection mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  selection mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return SELECTION_MODE.inverse[self.selectionMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_selection_mode(mode: SelectionModeStr | widgets.QCalendarWidget.SelectionMode | None)

                                                                                                                                                                                                                                                                                                          Set selection mode for given calendar widget.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode SelectionModeStr | SelectionMode | None

                                                                                                                                                                                                                                                                                                          selection mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/calendarwidget.py
                                                                                                                                                                                                                                                                                                          def set_selection_mode(
                                                                                                                                                                                                                                                                                                              self, mode: SelectionModeStr | widgets.QCalendarWidget.SelectionMode | None
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set selection mode for given calendar widget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: selection mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if mode is None:
                                                                                                                                                                                                                                                                                                                  mode = "none"
                                                                                                                                                                                                                                                                                                              self.setSelectionMode(SELECTION_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          CheckBox

                                                                                                                                                                                                                                                                                                          Bases: AbstractButtonMixin, QCheckBox

                                                                                                                                                                                                                                                                                                          Checkbox with a text label.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/checkbox.py
                                                                                                                                                                                                                                                                                                          class CheckBox(widgets.AbstractButtonMixin, widgets.QCheckBox):
                                                                                                                                                                                                                                                                                                              """Checkbox with a text label."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(int)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.stateChanged.connect(self.value_changed)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def supports(cls, instance) -> bool:
                                                                                                                                                                                                                                                                                                                  return isinstance(instance, bool)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_checkstate(self, state: constants.CheckStateStr | constants.CheckState):
                                                                                                                                                                                                                                                                                                                  """Set checkstate of the checkbox.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      state: checkstate to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setCheckState(constants.CHECK_STATE.get_enum_value(state))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_checkstate(self) -> constants.CheckStateStr:
                                                                                                                                                                                                                                                                                                                  """Return checkstate.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      checkstate
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.CHECK_STATE.inverse[self.checkState()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_checkstate() -> constants.CheckStateStr

                                                                                                                                                                                                                                                                                                          Return checkstate.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/checkbox.py
                                                                                                                                                                                                                                                                                                          def get_checkstate(self) -> constants.CheckStateStr:
                                                                                                                                                                                                                                                                                                              """Return checkstate.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  checkstate
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.CHECK_STATE.inverse[self.checkState()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_checkstate(state: constants.CheckStateStr | constants.CheckState)

                                                                                                                                                                                                                                                                                                          Set checkstate of the checkbox.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          state CheckStateStr | CheckState

                                                                                                                                                                                                                                                                                                          checkstate to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/checkbox.py
                                                                                                                                                                                                                                                                                                          def set_checkstate(self, state: constants.CheckStateStr | constants.CheckState):
                                                                                                                                                                                                                                                                                                              """Set checkstate of the checkbox.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  state: checkstate to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setCheckState(constants.CHECK_STATE.get_enum_value(state))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ColorDialog

                                                                                                                                                                                                                                                                                                          Bases: DialogMixin, QColorDialog

                                                                                                                                                                                                                                                                                                          Dialog widget for specifying colors.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/colordialog.py
                                                                                                                                                                                                                                                                                                          class ColorDialog(widgets.DialogMixin, widgets.QColorDialog):
                                                                                                                                                                                                                                                                                                              """Dialog widget for specifying colors."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def get_color(
                                                                                                                                                                                                                                                                                                                  cls,
                                                                                                                                                                                                                                                                                                                  preset: datatypes.ColorType = None,
                                                                                                                                                                                                                                                                                                                  allow_alpha: bool = False,
                                                                                                                                                                                                                                                                                                                  parent: widgets.QWidget | None = None,
                                                                                                                                                                                                                                                                                                              ) -> gui.Color:
                                                                                                                                                                                                                                                                                                                  preset = colors.get_color(preset)
                                                                                                                                                                                                                                                                                                                  kwargs = (
                                                                                                                                                                                                                                                                                                                      dict(options=cls.ColorDialogOption.ShowAlphaChannel) if allow_alpha else {}
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  color = cls.getColor(preset, parent, **kwargs)  # type: ignore
                                                                                                                                                                                                                                                                                                                  return gui.Color(color)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def current_color(self) -> gui.Color:
                                                                                                                                                                                                                                                                                                                  return gui.Color(self.currentColor())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_qcolorshower(self) -> QtCore.QObject:
                                                                                                                                                                                                                                                                                                                  return next(
                                                                                                                                                                                                                                                                                                                      a
                                                                                                                                                                                                                                                                                                                      for a in self.children()
                                                                                                                                                                                                                                                                                                                      if hasattr(a, "metaObject")
                                                                                                                                                                                                                                                                                                                      and a.metaObject().className() == "QtPrivate::QColorShower"
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_qcolorshowlabel(self) -> QtCore.QObject:
                                                                                                                                                                                                                                                                                                                  qcs = self.get_qcolorshower()
                                                                                                                                                                                                                                                                                                                  return next(
                                                                                                                                                                                                                                                                                                                      b
                                                                                                                                                                                                                                                                                                                      for b in qcs.children()
                                                                                                                                                                                                                                                                                                                      if hasattr(b, "metaObject")
                                                                                                                                                                                                                                                                                                                      and b.metaObject().className() == "QtPrivate::QColorShowLabel"
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def replace_qcolorshowlabel(self, widget: widgets.QWidget):
                                                                                                                                                                                                                                                                                                                  # Find the dialog widget used to display the current
                                                                                                                                                                                                                                                                                                                  # color, so we can replace it with our implementation
                                                                                                                                                                                                                                                                                                                  qcs = self.get_qcolorshower()
                                                                                                                                                                                                                                                                                                                  qcsl = self.get_qcolorshowlabel()
                                                                                                                                                                                                                                                                                                                  if not isinstance(qcs, widgets.QWidget) or not isinstance(qcsl, widgets.QWidget):
                                                                                                                                                                                                                                                                                                                      raise TypeError(qcs)
                                                                                                                                                                                                                                                                                                                  if (layout := qcs.layout()) is None:
                                                                                                                                                                                                                                                                                                                      raise RuntimeError(qcs)
                                                                                                                                                                                                                                                                                                                  layout.replaceWidget(qcsl, widget)
                                                                                                                                                                                                                                                                                                                  # Make sure it doesn't receive signals while hidden
                                                                                                                                                                                                                                                                                                                  qcsl.blockSignals(True)
                                                                                                                                                                                                                                                                                                                  qcsl.hide()
                                                                                                                                                                                                                                                                                                                  widget.show()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def use_alpha_channel(self, value: bool = True):
                                                                                                                                                                                                                                                                                                                  self.setOption(self.ColorDialogOption.ShowAlphaChannel, value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def hide_buttons(self, value: bool = True):
                                                                                                                                                                                                                                                                                                                  self.setOption(self.ColorDialogOption.NoButtons, value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def use_native_dialog(self, value: bool = True):
                                                                                                                                                                                                                                                                                                                  self.setOption(self.ColorDialogOption.DontUseNativeDialog, not value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def get_custom_colors(cls) -> list[gui.Color]:
                                                                                                                                                                                                                                                                                                                  return [gui.Color(cls.customColor(i)) for i in range(cls.customCount())]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def set_custom_colors(cls, colors_: list[datatypes.ColorType]):
                                                                                                                                                                                                                                                                                                                  num = min(len(colors_), cls.customCount())
                                                                                                                                                                                                                                                                                                                  for i in range(num):
                                                                                                                                                                                                                                                                                                                      color = colors.get_color(colors_[i])
                                                                                                                                                                                                                                                                                                                      cls.setCustomColor(i, color)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ColumnView

                                                                                                                                                                                                                                                                                                          Bases: AbstractItemViewMixin, QColumnView

                                                                                                                                                                                                                                                                                                          Model/view implementation of a column view.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/columnview.py
                                                                                                                                                                                                                                                                                                          class ColumnView(widgets.AbstractItemViewMixin, widgets.QColumnView):
                                                                                                                                                                                                                                                                                                              """Model/view implementation of a column view."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ComboBox

                                                                                                                                                                                                                                                                                                          Bases: ComboBoxMixin, QComboBox

                                                                                                                                                                                                                                                                                                          Combined button and popup list.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/combobox.py
                                                                                                                                                                                                                                                                                                          class ComboBox(ComboBoxMixin, widgets.QComboBox):
                                                                                                                                                                                                                                                                                                              """Combined button and popup list."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ComboBoxMixin

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, _ComboBoxBase

                                                                                                                                                                                                                                                                                                          Combobox that lets the user select a font family.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/combobox.py
                                                                                                                                                                                                                                                                                                          class ComboBoxMixin(widgets.WidgetMixin, _ComboBoxBase):
                                                                                                                                                                                                                                                                                                              """Combobox that lets the user select a font family."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(object)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.currentIndexChanged.connect(self._index_changed)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __len__(self) -> int:
                                                                                                                                                                                                                                                                                                                  return self.count()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "insertPolicy": INSERT_POLICY,
                                                                                                                                                                                                                                                                                                                      "sizeAdjustPolicy": SIZE_ADJUST_POLICY,
                                                                                                                                                                                                                                                                                                                      "labelDrawingMode": LABEL_DRAWING_MODE,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # def __reduce__(self):
                                                                                                                                                                                                                                                                                                              #     return type(self), (), self.__getstate__()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _index_changed(self, index: int):
                                                                                                                                                                                                                                                                                                                  # data = self.itemData(index)
                                                                                                                                                                                                                                                                                                                  data = self.get_value()
                                                                                                                                                                                                                                                                                                                  self.value_changed.emit(data)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_items(
                                                                                                                                                                                                                                                                                                                  self, items: Iterable[str | tuple | list] | Mapping[Any, str], default=...
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  if isinstance(items, Mapping):
                                                                                                                                                                                                                                                                                                                      for k, v in items.items():
                                                                                                                                                                                                                                                                                                                          self.addItem(v, userData=k)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      for i in items:
                                                                                                                                                                                                                                                                                                                          if isinstance(i, tuple | list):
                                                                                                                                                                                                                                                                                                                              self.add(*i)
                                                                                                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                                                                                                              self.addItem(i, i)
                                                                                                                                                                                                                                                                                                                  if default is not ...:
                                                                                                                                                                                                                                                                                                                      self.set_value(default)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add(self, label: str, data=..., icon: datatypes.IconType = None):
                                                                                                                                                                                                                                                                                                                  if data is ...:
                                                                                                                                                                                                                                                                                                                      data = label
                                                                                                                                                                                                                                                                                                                  if icon is not None:
                                                                                                                                                                                                                                                                                                                      icon = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                                      self.addItem(gui.Icon(icon), label, userData=data)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.addItem(label, userData=data)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_item_icon(self, index: int) -> gui.Icon | None:
                                                                                                                                                                                                                                                                                                                  icon = self.itemIcon(index)
                                                                                                                                                                                                                                                                                                                  return None if icon.isNull() else gui.Icon(icon)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_editable(self, editable: bool):
                                                                                                                                                                                                                                                                                                                  self.setEditable(editable)
                                                                                                                                                                                                                                                                                                                  if self.completer() is None and editable:
                                                                                                                                                                                                                                                                                                                      self.setCompleter(widgets.Completer(self))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_insert_policy(self, policy: InsertPolicyStr | mod.InsertPolicy):
                                                                                                                                                                                                                                                                                                                  """Set insert policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      policy: insert policy to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setInsertPolicy(INSERT_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_insert_policy(self) -> InsertPolicyStr:
                                                                                                                                                                                                                                                                                                                  """Return insert policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      insert policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return INSERT_POLICY.inverse[self.insertPolicy()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_size_adjust_policy(self, policy: SizeAdjustPolicyStr | mod.SizeAdjustPolicy):
                                                                                                                                                                                                                                                                                                                  """Set size adjust policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      policy: size adjust policy to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setSizeAdjustPolicy(SIZE_ADJUST_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_size_adjust_policy(self) -> SizeAdjustPolicyStr:
                                                                                                                                                                                                                                                                                                                  """Return size adjust policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      size adjust policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return SIZE_ADJUST_POLICY.inverse[self.sizeAdjustPolicy()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_icon_size(self, size: datatypes.SizeType):
                                                                                                                                                                                                                                                                                                                  """Set size of the icons."""
                                                                                                                                                                                                                                                                                                                  self.setIconSize(datatypes.to_size(size))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_icon_size(self) -> core.Size:
                                                                                                                                                                                                                                                                                                                  return core.Size(self.iconSize())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_min_char_length(self, chars: int):
                                                                                                                                                                                                                                                                                                                  self.setMinimumContentsLength(chars)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_value(self) -> Any:
                                                                                                                                                                                                                                                                                                                  # if all(self.itemData(i) is None for i in range(self.count())):
                                                                                                                                                                                                                                                                                                                  #     return self.currentText()
                                                                                                                                                                                                                                                                                                                  # else:
                                                                                                                                                                                                                                                                                                                  #     return self.currentData()
                                                                                                                                                                                                                                                                                                                  return self.currentData()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self, value: Any):
                                                                                                                                                                                                                                                                                                                  self.set_data(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_text(self, text: str):
                                                                                                                                                                                                                                                                                                                  self.setCurrentText(text)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_data(self, data: Any):
                                                                                                                                                                                                                                                                                                                  idx = self.findData(data)
                                                                                                                                                                                                                                                                                                                  if idx == -1:
                                                                                                                                                                                                                                                                                                                      msg = "invalid data"
                                                                                                                                                                                                                                                                                                                      raise ValueError(msg)
                                                                                                                                                                                                                                                                                                                  self.setCurrentIndex(idx)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def text(self) -> str:
                                                                                                                                                                                                                                                                                                                  return self.currentText()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def hide_completer(self):
                                                                                                                                                                                                                                                                                                                  """Hides the completion widget."""
                                                                                                                                                                                                                                                                                                                  completer = widgets.Completer(self)
                                                                                                                                                                                                                                                                                                                  self.setCompleter(completer)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_label_drawing_mode(self, mode: LabelDrawingModeStr | mod.LabelDrawingMode):
                                                                                                                                                                                                                                                                                                                  """Set label drawing mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: label drawing mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setLabelDrawingMode(LABEL_DRAWING_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_label_drawing_mode(self) -> LabelDrawingModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current label drawing mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      label drawing mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return LABEL_DRAWING_MODE.inverse[self.labelDrawingMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_insert_policy() -> InsertPolicyStr

                                                                                                                                                                                                                                                                                                          Return insert policy.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/combobox.py
                                                                                                                                                                                                                                                                                                          def get_insert_policy(self) -> InsertPolicyStr:
                                                                                                                                                                                                                                                                                                              """Return insert policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  insert policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return INSERT_POLICY.inverse[self.insertPolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_label_drawing_mode() -> LabelDrawingModeStr

                                                                                                                                                                                                                                                                                                          Return current label drawing mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/combobox.py
                                                                                                                                                                                                                                                                                                          def get_label_drawing_mode(self) -> LabelDrawingModeStr:
                                                                                                                                                                                                                                                                                                              """Return current label drawing mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  label drawing mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return LABEL_DRAWING_MODE.inverse[self.labelDrawingMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_size_adjust_policy() -> SizeAdjustPolicyStr

                                                                                                                                                                                                                                                                                                          Return size adjust policy.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/combobox.py
                                                                                                                                                                                                                                                                                                          def get_size_adjust_policy(self) -> SizeAdjustPolicyStr:
                                                                                                                                                                                                                                                                                                              """Return size adjust policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  size adjust policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return SIZE_ADJUST_POLICY.inverse[self.sizeAdjustPolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          hide_completer()

                                                                                                                                                                                                                                                                                                          Hides the completion widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/combobox.py
                                                                                                                                                                                                                                                                                                          def hide_completer(self):
                                                                                                                                                                                                                                                                                                              """Hides the completion widget."""
                                                                                                                                                                                                                                                                                                              completer = widgets.Completer(self)
                                                                                                                                                                                                                                                                                                              self.setCompleter(completer)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_icon_size(size: datatypes.SizeType)

                                                                                                                                                                                                                                                                                                          Set size of the icons.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/combobox.py
                                                                                                                                                                                                                                                                                                          def set_icon_size(self, size: datatypes.SizeType):
                                                                                                                                                                                                                                                                                                              """Set size of the icons."""
                                                                                                                                                                                                                                                                                                              self.setIconSize(datatypes.to_size(size))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_insert_policy(policy: InsertPolicyStr | mod.InsertPolicy)

                                                                                                                                                                                                                                                                                                          Set insert policy.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          policy InsertPolicyStr | InsertPolicy

                                                                                                                                                                                                                                                                                                          insert policy to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/combobox.py
                                                                                                                                                                                                                                                                                                          def set_insert_policy(self, policy: InsertPolicyStr | mod.InsertPolicy):
                                                                                                                                                                                                                                                                                                              """Set insert policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  policy: insert policy to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setInsertPolicy(INSERT_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_label_drawing_mode(mode: LabelDrawingModeStr | mod.LabelDrawingMode)

                                                                                                                                                                                                                                                                                                          Set label drawing mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode LabelDrawingModeStr | LabelDrawingMode

                                                                                                                                                                                                                                                                                                          label drawing mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/combobox.py
                                                                                                                                                                                                                                                                                                          def set_label_drawing_mode(self, mode: LabelDrawingModeStr | mod.LabelDrawingMode):
                                                                                                                                                                                                                                                                                                              """Set label drawing mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: label drawing mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setLabelDrawingMode(LABEL_DRAWING_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_size_adjust_policy(policy: SizeAdjustPolicyStr | mod.SizeAdjustPolicy)

                                                                                                                                                                                                                                                                                                          Set size adjust policy.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          policy SizeAdjustPolicyStr | SizeAdjustPolicy

                                                                                                                                                                                                                                                                                                          size adjust policy to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/combobox.py
                                                                                                                                                                                                                                                                                                          def set_size_adjust_policy(self, policy: SizeAdjustPolicyStr | mod.SizeAdjustPolicy):
                                                                                                                                                                                                                                                                                                              """Set size adjust policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  policy: size adjust policy to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setSizeAdjustPolicy(SIZE_ADJUST_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          CommandLinkButton

                                                                                                                                                                                                                                                                                                          Bases: PushButtonMixin, QCommandLinkButton

                                                                                                                                                                                                                                                                                                          Vista style command link button.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/commandlinkbutton.py
                                                                                                                                                                                                                                                                                                          4
                                                                                                                                                                                                                                                                                                          5
                                                                                                                                                                                                                                                                                                          6
                                                                                                                                                                                                                                                                                                          7
                                                                                                                                                                                                                                                                                                          class CommandLinkButton(widgets.PushButtonMixin, widgets.QCommandLinkButton):
                                                                                                                                                                                                                                                                                                              """Vista style command link button."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(bool)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          CommonStyle

                                                                                                                                                                                                                                                                                                          Bases: CommonStyleMixin, QCommonStyle

                                                                                                                                                                                                                                                                                                          Encapsulates the common Look and Feel of a GUI.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/commonstyle.py
                                                                                                                                                                                                                                                                                                          class CommonStyle(CommonStyleMixin, widgets.QCommonStyle):
                                                                                                                                                                                                                                                                                                              """Encapsulates the common Look and Feel of a GUI."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Completer

                                                                                                                                                                                                                                                                                                          Bases: ObjectMixin, QCompleter

                                                                                                                                                                                                                                                                                                          Completions based on an item model.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/completer.py
                                                                                                                                                                                                                                                                                                          class Completer(core.ObjectMixin, widgets.QCompleter):
                                                                                                                                                                                                                                                                                                              """Completions based on an item model."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              path_updated = core.Signal(str)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "caseSensitivity": constants.CASE_SENSITIVITY,
                                                                                                                                                                                                                                                                                                                      "completionMode": COMPLETION_MODE,
                                                                                                                                                                                                                                                                                                                      "modelSorting": SORT_MODE,
                                                                                                                                                                                                                                                                                                                      "filterMode": constants.MATCH_FLAGS,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def splitPath(self, path: str) -> list[str]:
                                                                                                                                                                                                                                                                                                                  self.path_updated.emit(path)
                                                                                                                                                                                                                                                                                                                  return super().splitPath(path)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_completions(self) -> list[str]:
                                                                                                                                                                                                                                                                                                                  completions = []
                                                                                                                                                                                                                                                                                                                  # count = self.completionCount()
                                                                                                                                                                                                                                                                                                                  # for i in range(count):
                                                                                                                                                                                                                                                                                                                  #     self.setCurrentRow(i)
                                                                                                                                                                                                                                                                                                                  #     completions.append(self.currentCompletion())
                                                                                                                                                                                                                                                                                                                  # according to docs, completionCount should be avoided. Not sure if thats true.
                                                                                                                                                                                                                                                                                                                  i = 0
                                                                                                                                                                                                                                                                                                                  while self.setCurrentRow(i):
                                                                                                                                                                                                                                                                                                                      completions.append(self.currentCompletion())
                                                                                                                                                                                                                                                                                                                      i += 1
                                                                                                                                                                                                                                                                                                                  return completions
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_strings(self, strings: list[str]):
                                                                                                                                                                                                                                                                                                                  model = core.StringListModel(strings)
                                                                                                                                                                                                                                                                                                                  self.setModel(model)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_sort_mode(self, mode: SortModeStr | widgets.QCompleter.ModelSorting | None):
                                                                                                                                                                                                                                                                                                                  """Set sort mode to use.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: sort mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if mode is None:
                                                                                                                                                                                                                                                                                                                      mode = "unsorted"
                                                                                                                                                                                                                                                                                                                  self.setModelSorting(SORT_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_sort_mode(self) -> SortModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current sort mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      sort mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return SORT_MODE.inverse[self.modelSorting()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_completion_mode(
                                                                                                                                                                                                                                                                                                                  self, mode: CompletionModeStr | widgets.QCompleter.CompletionMode
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set completion mode to use.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: completion mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setCompletionMode(COMPLETION_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_completion_mode(self) -> CompletionModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current completion mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      completion mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return COMPLETION_MODE.inverse[self.completionMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_filter_mode(self, mode: constants.FilterModeStr | constants.MatchFlag):
                                                                                                                                                                                                                                                                                                                  """Set filter mode to use.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: filter mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setFilterMode(constants.FILTER_MODES.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_filter_mode(self) -> constants.FilterModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current filter mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      filter mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.FILTER_MODES.inverse[self.filterMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              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 self.caseSensitivity() == constants.CaseSensitivity.CaseSensitive
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_completion_role(
                                                                                                                                                                                                                                                                                                                  self, role: constants.ItemDataRoleStr | constants.ItemDataRole | int
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  role = constants.ITEM_DATA_ROLE[role] if isinstance(role, str) else role
                                                                                                                                                                                                                                                                                                                  self.setCompletionRole(role)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_completion_mode() -> CompletionModeStr

                                                                                                                                                                                                                                                                                                          Return current completion mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/completer.py
                                                                                                                                                                                                                                                                                                          def get_completion_mode(self) -> CompletionModeStr:
                                                                                                                                                                                                                                                                                                              """Return current completion mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  completion mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return COMPLETION_MODE.inverse[self.completionMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_filter_mode() -> constants.FilterModeStr

                                                                                                                                                                                                                                                                                                          Return current filter mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/completer.py
                                                                                                                                                                                                                                                                                                          def get_filter_mode(self) -> constants.FilterModeStr:
                                                                                                                                                                                                                                                                                                              """Return current filter mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  filter mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.FILTER_MODES.inverse[self.filterMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_sort_mode() -> SortModeStr

                                                                                                                                                                                                                                                                                                          Return current sort mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/completer.py
                                                                                                                                                                                                                                                                                                          def get_sort_mode(self) -> SortModeStr:
                                                                                                                                                                                                                                                                                                              """Return current sort mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  sort mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return SORT_MODE.inverse[self.modelSorting()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          is_case_sensitive() -> bool

                                                                                                                                                                                                                                                                                                          Return case sensitivity.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/completer.py
                                                                                                                                                                                                                                                                                                          def is_case_sensitive(self) -> bool:
                                                                                                                                                                                                                                                                                                              """Return case sensitivity.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  case sensitivity
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return self.caseSensitivity() == constants.CaseSensitivity.CaseSensitive
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_case_sensitive(state: bool)

                                                                                                                                                                                                                                                                                                          Set case sensitivity.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          state bool

                                                                                                                                                                                                                                                                                                          case sensitive

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/completer.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)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_completion_mode(mode: CompletionModeStr | widgets.QCompleter.CompletionMode)

                                                                                                                                                                                                                                                                                                          Set completion mode to use.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode CompletionModeStr | CompletionMode

                                                                                                                                                                                                                                                                                                          completion mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/completer.py
                                                                                                                                                                                                                                                                                                          def set_completion_mode(
                                                                                                                                                                                                                                                                                                              self, mode: CompletionModeStr | widgets.QCompleter.CompletionMode
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set completion mode to use.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: completion mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setCompletionMode(COMPLETION_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_filter_mode(mode: constants.FilterModeStr | constants.MatchFlag)

                                                                                                                                                                                                                                                                                                          Set filter mode to use.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode FilterModeStr | MatchFlag

                                                                                                                                                                                                                                                                                                          filter mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/completer.py
                                                                                                                                                                                                                                                                                                          def set_filter_mode(self, mode: constants.FilterModeStr | constants.MatchFlag):
                                                                                                                                                                                                                                                                                                              """Set filter mode to use.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: filter mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setFilterMode(constants.FILTER_MODES.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_sort_mode(mode: SortModeStr | widgets.QCompleter.ModelSorting | None)

                                                                                                                                                                                                                                                                                                          Set sort mode to use.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode SortModeStr | ModelSorting | None

                                                                                                                                                                                                                                                                                                          sort mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/completer.py
                                                                                                                                                                                                                                                                                                          def set_sort_mode(self, mode: SortModeStr | widgets.QCompleter.ModelSorting | None):
                                                                                                                                                                                                                                                                                                              """Set sort mode to use.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: sort mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if mode is None:
                                                                                                                                                                                                                                                                                                                  mode = "unsorted"
                                                                                                                                                                                                                                                                                                              self.setModelSorting(SORT_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          DataWidgetMapper

                                                                                                                                                                                                                                                                                                          Bases: ObjectMixin, QDataWidgetMapper

                                                                                                                                                                                                                                                                                                          Mapping between a section of a data model to widgets.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/datawidgetmapper.py
                                                                                                                                                                                                                                                                                                          class DataWidgetMapper(core.ObjectMixin, widgets.QDataWidgetMapper):
                                                                                                                                                                                                                                                                                                              """Mapping between a section of a data model to widgets."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __setitem__(self, key: int, value: widgets.QWidget):
                                                                                                                                                                                                                                                                                                                  self.addMapping(value, key)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(self, key: int) -> widgets.QWidget:
                                                                                                                                                                                                                                                                                                                  return self.mappedWidgetAt(key)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __delitem__(self, key_or_widget: int | widgets.QWidget):
                                                                                                                                                                                                                                                                                                                  widget = (
                                                                                                                                                                                                                                                                                                                      self.mappedWidgetAt(key_or_widget)
                                                                                                                                                                                                                                                                                                                      if isinstance(key_or_widget, int)
                                                                                                                                                                                                                                                                                                                      else key_or_widget
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  self.removeMapping(widget)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {"submitPolicy": SUBMIT_POLICY, "orientation": constants.ORIENTATION}
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_orientation(
                                                                                                                                                                                                                                                                                                                  self, orientation: constants.OrientationStr | constants.Orientation
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the orientation of the data widget mapper.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      orientation: orientation for the data widget mapper
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setOrientation(constants.ORIENTATION.get_enum_value(orientation))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_orientation(self) -> constants.OrientationStr:
                                                                                                                                                                                                                                                                                                                  """Return current orientation.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      orientation
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.ORIENTATION.inverse[self.orientation()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_submit_policy(
                                                                                                                                                                                                                                                                                                                  self, policy: SubmitPolicyStr | widgets.QDataWidgetMapper.SubmitPolicy
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the submit policy of the mapper.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      policy: submit_policy for the data widget mapper
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setSubmitPolicy(SUBMIT_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_submit_policy(self) -> SubmitPolicyStr:
                                                                                                                                                                                                                                                                                                                  """Return current submit policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      submit policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return SUBMIT_POLICY.inverse[self.submitPolicy()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_mapping(
                                                                                                                                                                                                                                                                                                                  self, widget: widgets.QWidget, section: int, property_name: str | None = None
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  if property_name is None:
                                                                                                                                                                                                                                                                                                                      self.addMapping(widget, section)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      ba = core.QByteArray(property_name.encode())
                                                                                                                                                                                                                                                                                                                      self.addMapping(widget, section, ba)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_mapped_property_name(self, widget: widgets.QWidget) -> str:
                                                                                                                                                                                                                                                                                                                  return bytes(self.mappedPropertyName(widget).data()).decode()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_orientation() -> constants.OrientationStr

                                                                                                                                                                                                                                                                                                          Return current orientation.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/datawidgetmapper.py
                                                                                                                                                                                                                                                                                                          def get_orientation(self) -> constants.OrientationStr:
                                                                                                                                                                                                                                                                                                              """Return current orientation.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  orientation
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.ORIENTATION.inverse[self.orientation()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_submit_policy() -> SubmitPolicyStr

                                                                                                                                                                                                                                                                                                          Return current submit policy.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/datawidgetmapper.py
                                                                                                                                                                                                                                                                                                          def get_submit_policy(self) -> SubmitPolicyStr:
                                                                                                                                                                                                                                                                                                              """Return current submit policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  submit policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return SUBMIT_POLICY.inverse[self.submitPolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_orientation(orientation: constants.OrientationStr | constants.Orientation)

                                                                                                                                                                                                                                                                                                          Set the orientation of the data widget mapper.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          orientation OrientationStr | Orientation

                                                                                                                                                                                                                                                                                                          orientation for the data widget mapper

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/datawidgetmapper.py
                                                                                                                                                                                                                                                                                                          def set_orientation(
                                                                                                                                                                                                                                                                                                              self, orientation: constants.OrientationStr | constants.Orientation
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the orientation of the data widget mapper.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  orientation: orientation for the data widget mapper
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setOrientation(constants.ORIENTATION.get_enum_value(orientation))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_submit_policy(policy: SubmitPolicyStr | widgets.QDataWidgetMapper.SubmitPolicy)

                                                                                                                                                                                                                                                                                                          Set the submit policy of the mapper.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          policy SubmitPolicyStr | SubmitPolicy

                                                                                                                                                                                                                                                                                                          submit_policy for the data widget mapper

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/datawidgetmapper.py
                                                                                                                                                                                                                                                                                                          def set_submit_policy(
                                                                                                                                                                                                                                                                                                              self, policy: SubmitPolicyStr | widgets.QDataWidgetMapper.SubmitPolicy
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the submit policy of the mapper.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  policy: submit_policy for the data widget mapper
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setSubmitPolicy(SUBMIT_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          DateEdit

                                                                                                                                                                                                                                                                                                          Bases: DateTimeEditMixin, QDateEdit

                                                                                                                                                                                                                                                                                                          Widget for editing dates based on the QDateTimeEdit widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/dateedit.py
                                                                                                                                                                                                                                                                                                          class DateEdit(widgets.DateTimeEditMixin, widgets.QDateEdit):
                                                                                                                                                                                                                                                                                                              """Widget for editing dates based on the QDateTimeEdit widget."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(dt.datetime)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self, value: datatypes.DateType):
                                                                                                                                                                                                                                                                                                                  self.setDate(datatypes.to_date(value))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_range(self, lower: datatypes.DateType, upper: datatypes.DateType):
                                                                                                                                                                                                                                                                                                                  self.setToolTip(f"{lower} <= x <= {upper}")
                                                                                                                                                                                                                                                                                                                  self.setDateRange(datatypes.to_date(lower), datatypes.to_date(upper))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_value(self) -> dt.date:
                                                                                                                                                                                                                                                                                                                  return self.get_date()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def setup_example(cls):
                                                                                                                                                                                                                                                                                                                  widget = cls()
                                                                                                                                                                                                                                                                                                                  widget.set_value("01.03.1998")
                                                                                                                                                                                                                                                                                                                  return widget
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          DateTimeEditMixin

                                                                                                                                                                                                                                                                                                          Bases: AbstractSpinBoxMixin, _DateTimeEditBase

                                                                                                                                                                                                                                                                                                          Widget for editing dates and times.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/datetimeedit.py
                                                                                                                                                                                                                                                                                                          class DateTimeEditMixin(widgets.AbstractSpinBoxMixin, _DateTimeEditBase):
                                                                                                                                                                                                                                                                                                              """Widget for editing dates and times."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(dt.datetime)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.setCalendarPopup(True)
                                                                                                                                                                                                                                                                                                                  self.dateTimeChanged.connect(self.datetime_changed)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "timeSpec": constants.TIME_SPEC,
                                                                                                                                                                                                                                                                                                                      "currentSection": SECTIONS,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def datetime_changed(self, date):
                                                                                                                                                                                                                                                                                                                  dt = self.get_datetime()
                                                                                                                                                                                                                                                                                                                  self.value_changed.emit(dt)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_to_today(self):
                                                                                                                                                                                                                                                                                                                  self.setDateTime(core.DateTime.currentDateTime())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_section_text(
                                                                                                                                                                                                                                                                                                                  self, section: SectionStr | widgets.QDateTimeEdit.Section
                                                                                                                                                                                                                                                                                                              ) -> str:
                                                                                                                                                                                                                                                                                                                  return self.sectionText(SECTIONS.get_enum_value(section))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_current_section(self) -> SectionStr:
                                                                                                                                                                                                                                                                                                                  return SECTIONS.inverse[self.currentSection()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_current_section(self, section: SectionStr | widgets.QDateTimeEdit.Section):
                                                                                                                                                                                                                                                                                                                  self.setCurrentSection(SECTIONS.get_enum_value(section))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_displayed_sections(self) -> list[SectionStr]:
                                                                                                                                                                                                                                                                                                                  return SECTIONS.get_list(self.displayedSections())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_range(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  lower: datatypes.DateTimeType,
                                                                                                                                                                                                                                                                                                                  upper: datatypes.DateTimeType,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  lower = datatypes.to_datetime(lower)
                                                                                                                                                                                                                                                                                                                  upper = datatypes.to_datetime(upper)
                                                                                                                                                                                                                                                                                                                  self.setToolTip(f"{lower} <= x <= {upper}")
                                                                                                                                                                                                                                                                                                                  self.setDateTimeRange(lower, upper)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_format(self, fmt: str):
                                                                                                                                                                                                                                                                                                                  self.setDisplayFormat(fmt)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_value(self) -> dt.datetime:
                                                                                                                                                                                                                                                                                                                  return self.get_datetime()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self, value: datatypes.DateTimeType):
                                                                                                                                                                                                                                                                                                                  self.setDateTime(datatypes.to_datetime(value))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_datetime(self) -> dt.datetime:
                                                                                                                                                                                                                                                                                                                  return self.dateTime().toPython()  # type: ignore
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def min_datetime(self) -> dt.datetime:
                                                                                                                                                                                                                                                                                                                  return self.minimumDateTime().toPython()  # type: ignore
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def max_datetime(self) -> dt.datetime:
                                                                                                                                                                                                                                                                                                                  return self.maximumDateTime().toPython()  # type: ignore
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def min_date(self) -> dt.date:
                                                                                                                                                                                                                                                                                                                  return self.minimumDate().toPython()  # type: ignore
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def max_date(self) -> dt.date:
                                                                                                                                                                                                                                                                                                                  return self.maximumDate().toPython()  # type: ignore
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_date(self) -> dt.date:
                                                                                                                                                                                                                                                                                                                  return self.date().toPython()  # type: ignore
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def min_time(self) -> dt.time:
                                                                                                                                                                                                                                                                                                                  return self.minimumTime().toPython()  # type: ignore
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def max_time(self) -> dt.time:
                                                                                                                                                                                                                                                                                                                  return self.maximumTime().toPython()  # type: ignore
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_time(self) -> dt.time:
                                                                                                                                                                                                                                                                                                                  return self.time().toPython()  # type: ignore
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Dial

                                                                                                                                                                                                                                                                                                          Bases: AbstractSliderMixin, QDial

                                                                                                                                                                                                                                                                                                          Rounded range control (like a speedometer or potentiometer).

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/dial.py
                                                                                                                                                                                                                                                                                                          class Dial(widgets.AbstractSliderMixin, widgets.QDial):
                                                                                                                                                                                                                                                                                                              """Rounded range control (like a speedometer or potentiometer)."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(int)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.valueChanged.connect(self.on_value_change)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Dialog

                                                                                                                                                                                                                                                                                                          Bases: DialogMixin, QDialog

                                                                                                                                                                                                                                                                                                          The base class of dialog windows.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/dialog.py
                                                                                                                                                                                                                                                                                                          class Dialog(DialogMixin, widgets.QDialog):
                                                                                                                                                                                                                                                                                                              """The base class of dialog windows."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          DialogButtonBox

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QDialogButtonBox

                                                                                                                                                                                                                                                                                                          Widget presenting buttons in a layout that is appropriate to the widget style.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/dialogbuttonbox.py
                                                                                                                                                                                                                                                                                                          class DialogButtonBox(widgets.WidgetMixin, widgets.QDialogButtonBox):
                                                                                                                                                                                                                                                                                                              """Widget presenting buttons in a layout that is appropriate to the widget style."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              button_clicked = core.Signal(str)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.clicked.connect(self.on_click)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __len__(self) -> int:
                                                                                                                                                                                                                                                                                                                  return len(self.buttons())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(self, index: StandardButtonStr) -> widgets.QPushButton:
                                                                                                                                                                                                                                                                                                                  return self.button(STANDARD_BUTTON[index])
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __iter__(self) -> Iterator[widgets.QAbstractButton]:
                                                                                                                                                                                                                                                                                                                  return iter(self.buttons())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __contains__(self, index: StandardButtonStr):
                                                                                                                                                                                                                                                                                                                  return self.button(STANDARD_BUTTON[index]) is not None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "orientation": constants.ORIENTATION,
                                                                                                                                                                                                                                                                                                                      "standardButtons": STANDARD_BUTTON,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def create(cls, **kwargs) -> Self:
                                                                                                                                                                                                                                                                                                                  box = cls()
                                                                                                                                                                                                                                                                                                                  for k, v in kwargs.items():
                                                                                                                                                                                                                                                                                                                      box.add_default_button(k, callback=v)  # type: ignore
                                                                                                                                                                                                                                                                                                                  return box
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def on_click(self, button: core.QObject):
                                                                                                                                                                                                                                                                                                                  self.button_clicked.emit(button.objectName())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_horizontal(self):
                                                                                                                                                                                                                                                                                                                  self.setOrientation(constants.HORIZONTAL)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_vertical(self):
                                                                                                                                                                                                                                                                                                                  self.setOrientation(constants.VERTICAL)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_orientation(
                                                                                                                                                                                                                                                                                                                  self, orientation: constants.OrientationStr | constants.Orientation
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the orientation of the button box.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      orientation: orientation for the button box
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setOrientation(constants.ORIENTATION.get_enum_value(orientation))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_orientation(self) -> constants.OrientationStr:
                                                                                                                                                                                                                                                                                                                  """Return current orientation.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      orientation
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.ORIENTATION.inverse[self.orientation()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_default_buttons(
                                                                                                                                                                                                                                                                                                                  self, buttons: Sequence[StandardButtonStr]
                                                                                                                                                                                                                                                                                                              ) -> list[widgets.QPushButton]:
                                                                                                                                                                                                                                                                                                                  return [self.add_default_button(btn) for btn in buttons]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_default_button(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  button: StandardButtonStr | widgets.QDialogButtonBox.StandardButton,
                                                                                                                                                                                                                                                                                                                  callback: Callable | None = None,
                                                                                                                                                                                                                                                                                                              ) -> widgets.QPushButton:
                                                                                                                                                                                                                                                                                                                  """Add a default button.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      button: button to add
                                                                                                                                                                                                                                                                                                                      callback: function to call when button gets clicked
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      created button
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  btn = super().addButton(STANDARD_BUTTON.get_enum_value(button))
                                                                                                                                                                                                                                                                                                                  btn.setObjectName(STANDARD_BUTTON.get_str_value(button))
                                                                                                                                                                                                                                                                                                                  if callback:
                                                                                                                                                                                                                                                                                                                      btn.clicked.connect(callback)
                                                                                                                                                                                                                                                                                                                  return btn
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_button(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  button: widgets.QPushButton | str,
                                                                                                                                                                                                                                                                                                                  role: RoleStr | widgets.QDialogButtonBox.ButtonRole = "accept",
                                                                                                                                                                                                                                                                                                                  callback: Callable | None = None,
                                                                                                                                                                                                                                                                                                              ) -> widgets.QPushButton:
                                                                                                                                                                                                                                                                                                                  """Add a button.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      button: button to add
                                                                                                                                                                                                                                                                                                                      role: role of the button
                                                                                                                                                                                                                                                                                                                      callback: function to call when button gets clicked
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      created button
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if isinstance(button, str):
                                                                                                                                                                                                                                                                                                                      button = widgets.PushButton(button)
                                                                                                                                                                                                                                                                                                                  self.addButton(button, ROLES.get_enum_value(role))
                                                                                                                                                                                                                                                                                                                  if callback:
                                                                                                                                                                                                                                                                                                                      button.clicked.connect(callback)
                                                                                                                                                                                                                                                                                                                  return button
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          add_button(button: widgets.QPushButton | str, role: RoleStr | widgets.QDialogButtonBox.ButtonRole = 'accept', callback: Callable | None = None) -> widgets.QPushButton

                                                                                                                                                                                                                                                                                                          Add a button.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          button QPushButton | str

                                                                                                                                                                                                                                                                                                          button to add

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          role RoleStr | ButtonRole

                                                                                                                                                                                                                                                                                                          role of the button

                                                                                                                                                                                                                                                                                                          'accept'
                                                                                                                                                                                                                                                                                                          callback Callable | None

                                                                                                                                                                                                                                                                                                          function to call when button gets clicked

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/dialogbuttonbox.py
                                                                                                                                                                                                                                                                                                          def add_button(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              button: widgets.QPushButton | str,
                                                                                                                                                                                                                                                                                                              role: RoleStr | widgets.QDialogButtonBox.ButtonRole = "accept",
                                                                                                                                                                                                                                                                                                              callback: Callable | None = None,
                                                                                                                                                                                                                                                                                                          ) -> widgets.QPushButton:
                                                                                                                                                                                                                                                                                                              """Add a button.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  button: button to add
                                                                                                                                                                                                                                                                                                                  role: role of the button
                                                                                                                                                                                                                                                                                                                  callback: function to call when button gets clicked
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  created button
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if isinstance(button, str):
                                                                                                                                                                                                                                                                                                                  button = widgets.PushButton(button)
                                                                                                                                                                                                                                                                                                              self.addButton(button, ROLES.get_enum_value(role))
                                                                                                                                                                                                                                                                                                              if callback:
                                                                                                                                                                                                                                                                                                                  button.clicked.connect(callback)
                                                                                                                                                                                                                                                                                                              return button
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          add_default_button(button: StandardButtonStr | widgets.QDialogButtonBox.StandardButton, callback: Callable | None = None) -> widgets.QPushButton

                                                                                                                                                                                                                                                                                                          Add a default button.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          button StandardButtonStr | StandardButton

                                                                                                                                                                                                                                                                                                          button to add

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          callback Callable | None

                                                                                                                                                                                                                                                                                                          function to call when button gets clicked

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/dialogbuttonbox.py
                                                                                                                                                                                                                                                                                                          def add_default_button(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              button: StandardButtonStr | widgets.QDialogButtonBox.StandardButton,
                                                                                                                                                                                                                                                                                                              callback: Callable | None = None,
                                                                                                                                                                                                                                                                                                          ) -> widgets.QPushButton:
                                                                                                                                                                                                                                                                                                              """Add a default button.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  button: button to add
                                                                                                                                                                                                                                                                                                                  callback: function to call when button gets clicked
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  created button
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              btn = super().addButton(STANDARD_BUTTON.get_enum_value(button))
                                                                                                                                                                                                                                                                                                              btn.setObjectName(STANDARD_BUTTON.get_str_value(button))
                                                                                                                                                                                                                                                                                                              if callback:
                                                                                                                                                                                                                                                                                                                  btn.clicked.connect(callback)
                                                                                                                                                                                                                                                                                                              return btn
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_orientation() -> constants.OrientationStr

                                                                                                                                                                                                                                                                                                          Return current orientation.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/dialogbuttonbox.py
                                                                                                                                                                                                                                                                                                          def get_orientation(self) -> constants.OrientationStr:
                                                                                                                                                                                                                                                                                                              """Return current orientation.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  orientation
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.ORIENTATION.inverse[self.orientation()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_orientation(orientation: constants.OrientationStr | constants.Orientation)

                                                                                                                                                                                                                                                                                                          Set the orientation of the button box.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          orientation OrientationStr | Orientation

                                                                                                                                                                                                                                                                                                          orientation for the button box

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/dialogbuttonbox.py
                                                                                                                                                                                                                                                                                                          def set_orientation(
                                                                                                                                                                                                                                                                                                              self, orientation: constants.OrientationStr | constants.Orientation
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the orientation of the button box.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  orientation: orientation for the button box
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setOrientation(constants.ORIENTATION.get_enum_value(orientation))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          DockWidget

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QDockWidget

                                                                                                                                                                                                                                                                                                          Widget that can be docked inside a QMainWindow .

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/dockwidget.py
                                                                                                                                                                                                                                                                                                          class DockWidget(widgets.WidgetMixin, widgets.QDockWidget):
                                                                                                                                                                                                                                                                                                              """Widget that can be docked inside a QMainWindow ."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, allowed_areas="all", **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, allowed_areas=allowed_areas, **kwargs)
                                                                                                                                                                                                                                                                                                                  self._area: constants.DockWidgetAreasStr = "none"
                                                                                                                                                                                                                                                                                                                  self.dockLocationChanged.connect(self._on_location_change)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {"allowedAreas": constants.DOCK_WIDGET_AREAS}
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_widget(self, widget: widgets.QWidget):
                                                                                                                                                                                                                                                                                                                  self.setWidget(widget)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_allowed_areas(self, area: constants.DockWidgetAreasStr):
                                                                                                                                                                                                                                                                                                                  self.setAllowedAreas(constants.DOCK_WIDGET_AREAS[area])
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _on_location_change(self, area: constants.DockWidgetArea):
                                                                                                                                                                                                                                                                                                                  self._area = constants.DOCK_WIDGET_AREAS.inverse[area]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_current_area(self) -> constants.DockWidgetAreasStr:
                                                                                                                                                                                                                                                                                                                  return self._area
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def setup_title_bar(self):
                                                                                                                                                                                                                                                                                                                  title_bar = CustomTitleBar(parent=self)
                                                                                                                                                                                                                                                                                                                  self.setTitleBarWidget(title_bar)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def maximize(self):
                                                                                                                                                                                                                                                                                                                  if not self.isFloating():
                                                                                                                                                                                                                                                                                                                      self.setFloating(True)
                                                                                                                                                                                                                                                                                                                  if not self.isMaximized():
                                                                                                                                                                                                                                                                                                                      self.showMaximized()
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.showMinimized()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          DoubleSpinBox

                                                                                                                                                                                                                                                                                                          Bases: AbstractSpinBoxMixin, QDoubleSpinBox

                                                                                                                                                                                                                                                                                                          Spin box widget that takes doubles.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/doublespinbox.py
                                                                                                                                                                                                                                                                                                          class DoubleSpinBox(widgets.AbstractSpinBoxMixin, widgets.QDoubleSpinBox):
                                                                                                                                                                                                                                                                                                              """Spin box widget that takes doubles."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(float)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, maximum: float = float("inf"), **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, maximum=maximum, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.valueChanged.connect(self.value_changed)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def supports(cls, instance) -> bool:
                                                                                                                                                                                                                                                                                                                  return isinstance(instance, float)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_range(self, start: float | None, end: float | None):
                                                                                                                                                                                                                                                                                                                  self.set_minimum(start)
                                                                                                                                                                                                                                                                                                                  self.set_maximum(end)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              setRange = set_range  # noqa: N815
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_minimum(self, value: float | None):
                                                                                                                                                                                                                                                                                                                  if value is None:
                                                                                                                                                                                                                                                                                                                      value = -float("inf")
                                                                                                                                                                                                                                                                                                                  super().setMinimum(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              setMinimum = set_minimum  # noqa: N815
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_maximum(self, value: float | None):
                                                                                                                                                                                                                                                                                                                  if value is None:
                                                                                                                                                                                                                                                                                                                      value = float("inf")
                                                                                                                                                                                                                                                                                                                  super().setMaximum(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              setMaximum = set_maximum  # noqa: N815
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ErrorMessage

                                                                                                                                                                                                                                                                                                          Bases: DialogMixin, QErrorMessage

                                                                                                                                                                                                                                                                                                          Error message display dialog.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/errormessage.py
                                                                                                                                                                                                                                                                                                          class ErrorMessage(widgets.DialogMixin, widgets.QErrorMessage):
                                                                                                                                                                                                                                                                                                              """Error message display dialog."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          FileDialog

                                                                                                                                                                                                                                                                                                          Bases: DialogMixin, QFileDialog

                                                                                                                                                                                                                                                                                                          Dialog that allow users to select files or directories.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/filedialog.py
                                                                                                                                                                                                                                                                                                          class FileDialog(widgets.DialogMixin, widgets.QFileDialog):
                                                                                                                                                                                                                                                                                                              """Dialog that allow users to select files or directories."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  path: datatypes.PathType | None = None,
                                                                                                                                                                                                                                                                                                                  mode: AcceptModeStr = "open",
                                                                                                                                                                                                                                                                                                                  caption: str | None = None,
                                                                                                                                                                                                                                                                                                                  path_id: str | None = None,
                                                                                                                                                                                                                                                                                                                  extension_filter: dict | None = None,
                                                                                                                                                                                                                                                                                                                  file_mode: FileModeStr = "existing_files",
                                                                                                                                                                                                                                                                                                                  **kwargs,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  super().__init__(**kwargs)
                                                                                                                                                                                                                                                                                                                  if caption is not None:
                                                                                                                                                                                                                                                                                                                      self.set_title(caption)
                                                                                                                                                                                                                                                                                                                  self.path_id = path_id
                                                                                                                                                                                                                                                                                                                  if extension_filter:
                                                                                                                                                                                                                                                                                                                      self.set_extension_filter(extension_filter)
                                                                                                                                                                                                                                                                                                                  if path_id is not None and path is None:
                                                                                                                                                                                                                                                                                                                      settings = core.Settings()
                                                                                                                                                                                                                                                                                                                      path = settings.get(path_id, "")
                                                                                                                                                                                                                                                                                                                  if path is not None:
                                                                                                                                                                                                                                                                                                                      self.set_directory(path)
                                                                                                                                                                                                                                                                                                                  self.set_file_mode(file_mode)
                                                                                                                                                                                                                                                                                                                  self.set_accept_mode(mode)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "acceptMode": ACCEPT_MODE,
                                                                                                                                                                                                                                                                                                                      "fileMode": FILE_MODE,
                                                                                                                                                                                                                                                                                                                      "viewMode": VIEW_MODE,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_accept_mode(self, mode: AcceptModeStr | widgets.QFileDialog.AcceptMode):
                                                                                                                                                                                                                                                                                                                  """Set accept mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: accept mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setAcceptMode(ACCEPT_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_accept_mode(self) -> AcceptModeStr:
                                                                                                                                                                                                                                                                                                                  """Return accept mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      accept mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return ACCEPT_MODE.inverse[self.acceptMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_view_mode(self, mode: ViewModeStr | widgets.QFileDialog.ViewMode):
                                                                                                                                                                                                                                                                                                                  """Set view mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: view mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setViewMode(VIEW_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_view_mode(self) -> ViewModeStr:
                                                                                                                                                                                                                                                                                                                  """Return view mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      view mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return VIEW_MODE.inverse[self.viewMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_label_text(
                                                                                                                                                                                                                                                                                                                  self, label: LabelStr | widgets.QFileDialog.DialogLabel, text: str
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the label text for button label.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      label: button to set text for
                                                                                                                                                                                                                                                                                                                      text: text to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setLabelText(LABEL.get_enum_value(label), text)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_label_text(self, label: LabelStr | widgets.QFileDialog.DialogLabel) -> str:
                                                                                                                                                                                                                                                                                                                  """Return label text.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      label text
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return self.labelText(LABEL.get_enum_value(label))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_file_mode(self) -> FileModeStr:
                                                                                                                                                                                                                                                                                                                  """Return file mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      file mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return FILE_MODE.inverse[self.fileMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_file_mode(self, mode: FileModeStr | widgets.QFileDialog.FileMode):
                                                                                                                                                                                                                                                                                                                  """Set the file mode of the dialog.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setFileMode(FILE_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def selected_files(self) -> list[pathlib.Path]:
                                                                                                                                                                                                                                                                                                                  return [pathlib.Path(p) for p in self.selectedFiles()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def selected_file(self) -> pathlib.Path | None:
                                                                                                                                                                                                                                                                                                                  selected = self.selectedFiles()
                                                                                                                                                                                                                                                                                                                  return pathlib.Path(selected[0]) if selected else None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def choose_folder(self) -> list[pathlib.Path] | None:
                                                                                                                                                                                                                                                                                                                  self.set_file_mode("directory")
                                                                                                                                                                                                                                                                                                                  return self.choose()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def open_file(self) -> list[pathlib.Path] | None:
                                                                                                                                                                                                                                                                                                                  self.set_file_mode("existing_file")
                                                                                                                                                                                                                                                                                                                  return self.choose()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def choose(self) -> list[pathlib.Path] | None:
                                                                                                                                                                                                                                                                                                                  result = self.exec()
                                                                                                                                                                                                                                                                                                                  if result != self.DialogCode.Accepted:
                                                                                                                                                                                                                                                                                                                      return None
                                                                                                                                                                                                                                                                                                                  paths = self.selected_files()
                                                                                                                                                                                                                                                                                                                  if self.path_id:
                                                                                                                                                                                                                                                                                                                      settings = core.Settings()
                                                                                                                                                                                                                                                                                                                      folder_path = paths[0].parent
                                                                                                                                                                                                                                                                                                                      settings.setValue(self.path_id, str(folder_path))
                                                                                                                                                                                                                                                                                                                  return paths
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_extension_filter(self, extension_dict: dict[str, list[str]]):
                                                                                                                                                                                                                                                                                                                  """Set filter based on given dictionary.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  dict must contain "'name': ['.ext1', '.ext2']" as key-value pairs
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      extension_dict: filter dictionary
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  items = [
                                                                                                                                                                                                                                                                                                                      f"{k} ({' '.join(f'*{ext}' for ext in v)})" for k, v in extension_dict.items()
                                                                                                                                                                                                                                                                                                                  ]
                                                                                                                                                                                                                                                                                                                  filter_str = ";;".join(items)
                                                                                                                                                                                                                                                                                                                  self.setNameFilter(filter_str)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_directory(self) -> pathlib.Path:
                                                                                                                                                                                                                                                                                                                  """Return current directory.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  returns current directory level as a Pathlib object
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      Pathlib object
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return pathlib.Path(self.directory().absolutePath())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_directory(self, path: datatypes.PathType):
                                                                                                                                                                                                                                                                                                                  """Set start directory."""
                                                                                                                                                                                                                                                                                                                  path = os.fspath(path)
                                                                                                                                                                                                                                                                                                                  self.setDirectory(path)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_filter(self, *filters: core.dir.FilterStr):
                                                                                                                                                                                                                                                                                                                  flags = core.dir.FILTERS.merge_flags(filters)
                                                                                                                                                                                                                                                                                                                  self.setFilter(flags)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_filter(self) -> list[core.dir.FilterStr]:
                                                                                                                                                                                                                                                                                                                  return core.dir.FILTERS.get_list(self.filter())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_accept_mode() -> AcceptModeStr

                                                                                                                                                                                                                                                                                                          Return accept mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/filedialog.py
                                                                                                                                                                                                                                                                                                          def get_accept_mode(self) -> AcceptModeStr:
                                                                                                                                                                                                                                                                                                              """Return accept mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  accept mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return ACCEPT_MODE.inverse[self.acceptMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_directory() -> pathlib.Path

                                                                                                                                                                                                                                                                                                          Return current directory.

                                                                                                                                                                                                                                                                                                          returns current directory level as a Pathlib object

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/filedialog.py
                                                                                                                                                                                                                                                                                                          def get_directory(self) -> pathlib.Path:
                                                                                                                                                                                                                                                                                                              """Return current directory.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              returns current directory level as a Pathlib object
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  Pathlib object
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return pathlib.Path(self.directory().absolutePath())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_file_mode() -> FileModeStr

                                                                                                                                                                                                                                                                                                          Return file mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/filedialog.py
                                                                                                                                                                                                                                                                                                          def get_file_mode(self) -> FileModeStr:
                                                                                                                                                                                                                                                                                                              """Return file mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  file mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return FILE_MODE.inverse[self.fileMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_label_text(label: LabelStr | widgets.QFileDialog.DialogLabel) -> str

                                                                                                                                                                                                                                                                                                          Return label text.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/filedialog.py
                                                                                                                                                                                                                                                                                                          def get_label_text(self, label: LabelStr | widgets.QFileDialog.DialogLabel) -> str:
                                                                                                                                                                                                                                                                                                              """Return label text.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  label text
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return self.labelText(LABEL.get_enum_value(label))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_view_mode() -> ViewModeStr

                                                                                                                                                                                                                                                                                                          Return view mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/filedialog.py
                                                                                                                                                                                                                                                                                                          def get_view_mode(self) -> ViewModeStr:
                                                                                                                                                                                                                                                                                                              """Return view mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  view mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return VIEW_MODE.inverse[self.viewMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_accept_mode(mode: AcceptModeStr | widgets.QFileDialog.AcceptMode)

                                                                                                                                                                                                                                                                                                          Set accept mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode AcceptModeStr | AcceptMode

                                                                                                                                                                                                                                                                                                          accept mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/filedialog.py
                                                                                                                                                                                                                                                                                                          def set_accept_mode(self, mode: AcceptModeStr | widgets.QFileDialog.AcceptMode):
                                                                                                                                                                                                                                                                                                              """Set accept mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: accept mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setAcceptMode(ACCEPT_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_directory(path: datatypes.PathType)

                                                                                                                                                                                                                                                                                                          Set start directory.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/filedialog.py
                                                                                                                                                                                                                                                                                                          def set_directory(self, path: datatypes.PathType):
                                                                                                                                                                                                                                                                                                              """Set start directory."""
                                                                                                                                                                                                                                                                                                              path = os.fspath(path)
                                                                                                                                                                                                                                                                                                              self.setDirectory(path)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_extension_filter(extension_dict: dict[str, list[str]])

                                                                                                                                                                                                                                                                                                          Set filter based on given dictionary.

                                                                                                                                                                                                                                                                                                          dict must contain "'name': ['.ext1', '.ext2']" as key-value pairs

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          extension_dict dict[str, list[str]]

                                                                                                                                                                                                                                                                                                          filter dictionary

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/filedialog.py
                                                                                                                                                                                                                                                                                                          def set_extension_filter(self, extension_dict: dict[str, list[str]]):
                                                                                                                                                                                                                                                                                                              """Set filter based on given dictionary.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              dict must contain "'name': ['.ext1', '.ext2']" as key-value pairs
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  extension_dict: filter dictionary
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              items = [
                                                                                                                                                                                                                                                                                                                  f"{k} ({' '.join(f'*{ext}' for ext in v)})" for k, v in extension_dict.items()
                                                                                                                                                                                                                                                                                                              ]
                                                                                                                                                                                                                                                                                                              filter_str = ";;".join(items)
                                                                                                                                                                                                                                                                                                              self.setNameFilter(filter_str)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_file_mode(mode: FileModeStr | widgets.QFileDialog.FileMode)

                                                                                                                                                                                                                                                                                                          Set the file mode of the dialog.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode FileModeStr | FileMode

                                                                                                                                                                                                                                                                                                          mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/filedialog.py
                                                                                                                                                                                                                                                                                                          def set_file_mode(self, mode: FileModeStr | widgets.QFileDialog.FileMode):
                                                                                                                                                                                                                                                                                                              """Set the file mode of the dialog.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setFileMode(FILE_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_label_text(label: LabelStr | widgets.QFileDialog.DialogLabel, text: str)

                                                                                                                                                                                                                                                                                                          Set the label text for button label.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          label LabelStr | DialogLabel

                                                                                                                                                                                                                                                                                                          button to set text for

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          text str

                                                                                                                                                                                                                                                                                                          text to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/filedialog.py
                                                                                                                                                                                                                                                                                                          def set_label_text(
                                                                                                                                                                                                                                                                                                              self, label: LabelStr | widgets.QFileDialog.DialogLabel, text: str
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the label text for button label.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  label: button to set text for
                                                                                                                                                                                                                                                                                                                  text: text to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setLabelText(LABEL.get_enum_value(label), text)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_view_mode(mode: ViewModeStr | widgets.QFileDialog.ViewMode)

                                                                                                                                                                                                                                                                                                          Set view mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ViewModeStr | ViewMode

                                                                                                                                                                                                                                                                                                          view mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/filedialog.py
                                                                                                                                                                                                                                                                                                          def set_view_mode(self, mode: ViewModeStr | widgets.QFileDialog.ViewMode):
                                                                                                                                                                                                                                                                                                              """Set view mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: view mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setViewMode(VIEW_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          FileIconProvider

                                                                                                                                                                                                                                                                                                          Bases: AbstractFileIconProviderMixin, QFileIconProvider

                                                                                                                                                                                                                                                                                                          File icons for the QFileSystemModel class.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/fileiconprovider.py
                                                                                                                                                                                                                                                                                                          class FileIconProvider(gui.AbstractFileIconProviderMixin, QtWidgets.QFileIconProvider):
                                                                                                                                                                                                                                                                                                              """File icons for the QFileSystemModel class."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_icon(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  typ: gui.abstractfileiconprovider.IconTypeStr
                                                                                                                                                                                                                                                                                                                  | core.QFileInfo
                                                                                                                                                                                                                                                                                                                  | datatypes.PathType,
                                                                                                                                                                                                                                                                                                              ) -> gui.QIcon:
                                                                                                                                                                                                                                                                                                                  if isinstance(typ, os.PathLike | core.QFileInfo):
                                                                                                                                                                                                                                                                                                                      param = core.FileInfo(typ)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      param = gui.abstractfileiconprovider.ICON_TYPE[typ]
                                                                                                                                                                                                                                                                                                                  return self.icon(param)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def use_custom_directory_icons(self, state: bool = True):
                                                                                                                                                                                                                                                                                                                  opt = self.Option(0) if state else self.Option.DontUseCustomDirectoryIcons
                                                                                                                                                                                                                                                                                                                  self.setOptions(opt)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def uses_custom_directory_icons(self) -> bool:
                                                                                                                                                                                                                                                                                                                  return self.options() == self.Option(0)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          FocusFrame

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QFocusFrame

                                                                                                                                                                                                                                                                                                          Focus frame which can be outside of a widget's normal paintable area.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/focusframe.py
                                                                                                                                                                                                                                                                                                          class FocusFrame(widgets.WidgetMixin, widgets.QFocusFrame):
                                                                                                                                                                                                                                                                                                              """Focus frame which can be outside of a widget's normal paintable area."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          FontComboBox

                                                                                                                                                                                                                                                                                                          Bases: ComboBoxMixin, QFontComboBox

                                                                                                                                                                                                                                                                                                          Combobox that lets the user select a font family.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/fontcombobox.py
                                                                                                                                                                                                                                                                                                          class FontComboBox(widgets.ComboBoxMixin, widgets.QFontComboBox):
                                                                                                                                                                                                                                                                                                              """Combobox that lets the user select a font family."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(gui.QFont)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "fontFilters": FONT_FILTERS,
                                                                                                                                                                                                                                                                                                                      "writingSystem": gui.fontdatabase.WRITING_SYSTEM,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_font_filters(self, *filters: FontFilterStr):
                                                                                                                                                                                                                                                                                                                  """Set font filters.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      filters: font filters to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if not filters:
                                                                                                                                                                                                                                                                                                                      filters = ("all",)
                                                                                                                                                                                                                                                                                                                  flags = FONT_FILTERS.merge_flags(filters)
                                                                                                                                                                                                                                                                                                                  self.setFontFilters(flags)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_font_filters(self) -> list[FontFilterStr]:
                                                                                                                                                                                                                                                                                                                  """Return list of font filters.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      font filter list
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return FONT_FILTERS.get_list(self.fontFilters())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self, value: gui.QFont):
                                                                                                                                                                                                                                                                                                                  self.setCurrentFont(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_value(self) -> gui.QFont:
                                                                                                                                                                                                                                                                                                                  return gui.QFont(self.get_current_font())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_current_font(self) -> gui.Font:
                                                                                                                                                                                                                                                                                                                  return gui.Font(self.currentFont())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # without this, the user property would be currentText, which is not what we want.
                                                                                                                                                                                                                                                                                                              # PyQt6 doesnt like gui.Font here.
                                                                                                                                                                                                                                                                                                              value = core.Property(
                                                                                                                                                                                                                                                                                                                  gui.QFont,
                                                                                                                                                                                                                                                                                                                  get_value,
                                                                                                                                                                                                                                                                                                                  set_value,
                                                                                                                                                                                                                                                                                                                  user=True,
                                                                                                                                                                                                                                                                                                                  doc="Currently chosen font",
                                                                                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_font_filters() -> list[FontFilterStr]

                                                                                                                                                                                                                                                                                                          Return list of font filters.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/fontcombobox.py
                                                                                                                                                                                                                                                                                                          def get_font_filters(self) -> list[FontFilterStr]:
                                                                                                                                                                                                                                                                                                              """Return list of font filters.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  font filter list
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return FONT_FILTERS.get_list(self.fontFilters())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_font_filters(*filters: FontFilterStr)

                                                                                                                                                                                                                                                                                                          Set font filters.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          filters FontFilterStr

                                                                                                                                                                                                                                                                                                          font filters to use

                                                                                                                                                                                                                                                                                                          ()
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/fontcombobox.py
                                                                                                                                                                                                                                                                                                          def set_font_filters(self, *filters: FontFilterStr):
                                                                                                                                                                                                                                                                                                              """Set font filters.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  filters: font filters to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if not filters:
                                                                                                                                                                                                                                                                                                                  filters = ("all",)
                                                                                                                                                                                                                                                                                                              flags = FONT_FILTERS.merge_flags(filters)
                                                                                                                                                                                                                                                                                                              self.setFontFilters(flags)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          FontDialog

                                                                                                                                                                                                                                                                                                          Bases: DialogMixin, QFontDialog

                                                                                                                                                                                                                                                                                                          Dialog widget for selecting a font.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/fontdialog.py
                                                                                                                                                                                                                                                                                                          4
                                                                                                                                                                                                                                                                                                          5
                                                                                                                                                                                                                                                                                                          6
                                                                                                                                                                                                                                                                                                          7
                                                                                                                                                                                                                                                                                                          8
                                                                                                                                                                                                                                                                                                          class FontDialog(widgets.DialogMixin, widgets.QFontDialog):
                                                                                                                                                                                                                                                                                                              """Dialog widget for selecting a font."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_current_font(self) -> gui.Font:
                                                                                                                                                                                                                                                                                                                  return gui.Font(self.currentFont())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          FormLayout

                                                                                                                                                                                                                                                                                                          Bases: LayoutMixin, QFormLayout

                                                                                                                                                                                                                                                                                                          Manages forms of input widgets and their associated labels.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/formlayout.py
                                                                                                                                                                                                                                                                                                          class FormLayout(widgets.LayoutMixin, widgets.QFormLayout):
                                                                                                                                                                                                                                                                                                              """Manages forms of input widgets and their associated labels."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              ID = "form"
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.set_size_constraint("maximum")
                                                                                                                                                                                                                                                                                                                  self.setVerticalSpacing(8)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __setitem__(
                                                                                                                                                                                                                                                                                                                  self, index: int | tuple[int, ItemRoleStr], value: str | widgets.QWidget
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  match index:
                                                                                                                                                                                                                                                                                                                      case (int() as row, str() as role):
                                                                                                                                                                                                                                                                                                                          self.set_widget(value, row, cast("ItemRoleStr", role))  # validated there
                                                                                                                                                                                                                                                                                                                      case int() as row:
                                                                                                                                                                                                                                                                                                                          self.set_widget(value, row, "both")
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise TypeError(index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __delitem__(self, index: int):
                                                                                                                                                                                                                                                                                                                  self.removeRow(index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __iter__(self) -> Iterator[widgets.QWidget | widgets.QLayout]:
                                                                                                                                                                                                                                                                                                                  return iter(self[i] for i in range(self.count()) if self[i] is not None)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __len__(self) -> int:
                                                                                                                                                                                                                                                                                                                  """Needed for PySide2."""
                                                                                                                                                                                                                                                                                                                  return self.rowCount()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __add__(self, other: widgets.QWidget | widgets.QLayout | tuple):
                                                                                                                                                                                                                                                                                                                  self.add(other)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "fieldGrowthPolicy": FIELD_GROWTH_POLICY,
                                                                                                                                                                                                                                                                                                                      "formAlignment": constants.ALIGNMENTS,
                                                                                                                                                                                                                                                                                                                      "labelAlignment": constants.ALIGNMENTS,
                                                                                                                                                                                                                                                                                                                      "rowWrapPolicy": ROW_WRAP_POLICY,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_form_alignment(
                                                                                                                                                                                                                                                                                                                  self, alignment: constants.AlignmentStr | constants.AlignmentFlag
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the alignment of the form.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      alignment: alignment for the form
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setFormAlignment(constants.ALIGNMENTS.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_form_alignment(self) -> constants.AlignmentStr:
                                                                                                                                                                                                                                                                                                                  """Return current form alignment.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      form alignment
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.ALIGNMENTS.inverse[self.formAlignment()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_label_alignment(
                                                                                                                                                                                                                                                                                                                  self, alignment: constants.AlignmentStr | constants.AlignmentFlag
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the alignment of the label.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      alignment: alignment for the label
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setLabelAlignment(constants.ALIGNMENTS.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_label_alignment(self) -> constants.AlignmentStr:
                                                                                                                                                                                                                                                                                                                  """Return current label alignment.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      label alignment
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.ALIGNMENTS.inverse[self.labelAlignment()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_widget(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  widget: str | widgets.QWidget,
                                                                                                                                                                                                                                                                                                                  row: int,
                                                                                                                                                                                                                                                                                                                  role: ItemRoleStr | mod.ItemRole = "both",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  widget = widgets.Label(widget) if isinstance(widget, str) else widget
                                                                                                                                                                                                                                                                                                                  self.setWidget(row, ITEM_ROLE.get_enum_value(role), widget)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_widget(
                                                                                                                                                                                                                                                                                                                  self, row: int, role: ItemRoleStr | mod.ItemRole = "both"
                                                                                                                                                                                                                                                                                                              ) -> widgets.QLayout | widgets.QWidget | None:
                                                                                                                                                                                                                                                                                                                  item = self.itemAt(row, ITEM_ROLE.get_enum_value(role))
                                                                                                                                                                                                                                                                                                                  if item is None:
                                                                                                                                                                                                                                                                                                                      return None
                                                                                                                                                                                                                                                                                                                  return i if (i := item.widget()) is not None else item.layout()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_item_position(self, index: int) -> tuple[int, ItemRoleStr] | None:
                                                                                                                                                                                                                                                                                                                  row, role = self.getItemPosition(index)  # type: ignore
                                                                                                                                                                                                                                                                                                                  return None if row == -1 else (row, ITEM_ROLE.inverse[role])
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add(self, *items):
                                                                                                                                                                                                                                                                                                                  for i in items:
                                                                                                                                                                                                                                                                                                                      match i:
                                                                                                                                                                                                                                                                                                                          case widgets.QWidget() | widgets.QLayout():
                                                                                                                                                                                                                                                                                                                              self.addRow(i)
                                                                                                                                                                                                                                                                                                                          case tuple():
                                                                                                                                                                                                                                                                                                                              self.addRow(*i)
                                                                                                                                                                                                                                                                                                                          case _:
                                                                                                                                                                                                                                                                                                                              raise TypeError(i)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_row_wrap_policy(self, policy: RowWrapPolicyStr | mod.RowWrapPolicy):
                                                                                                                                                                                                                                                                                                                  """Set row wrap policy to use.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      policy: row wrap policy to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setRowWrapPolicy(ROW_WRAP_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_row_wrap_policy(self) -> RowWrapPolicyStr:
                                                                                                                                                                                                                                                                                                                  """Return current row wrap policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      row wrap policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return ROW_WRAP_POLICY.inverse[self.rowWrapPolicy()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_field_growth_policy(
                                                                                                                                                                                                                                                                                                                  self, policy: FieldGrowthPolicyStr | mod.FieldGrowthPolicy
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set field growth policy to use.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      policy: field growth policy to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setFieldGrowthPolicy(FIELD_GROWTH_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_field_growth_policy(self) -> FieldGrowthPolicyStr:
                                                                                                                                                                                                                                                                                                                  """Return current field growth policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      field growth policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return FIELD_GROWTH_POLICY.inverse[self.fieldGrowthPolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          __len__() -> int

                                                                                                                                                                                                                                                                                                          Needed for PySide2.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/formlayout.py
                                                                                                                                                                                                                                                                                                          def __len__(self) -> int:
                                                                                                                                                                                                                                                                                                              """Needed for PySide2."""
                                                                                                                                                                                                                                                                                                              return self.rowCount()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_field_growth_policy() -> FieldGrowthPolicyStr

                                                                                                                                                                                                                                                                                                          Return current field growth policy.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/formlayout.py
                                                                                                                                                                                                                                                                                                          def get_field_growth_policy(self) -> FieldGrowthPolicyStr:
                                                                                                                                                                                                                                                                                                              """Return current field growth policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  field growth policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return FIELD_GROWTH_POLICY.inverse[self.fieldGrowthPolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_form_alignment() -> constants.AlignmentStr

                                                                                                                                                                                                                                                                                                          Return current form alignment.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/formlayout.py
                                                                                                                                                                                                                                                                                                          def get_form_alignment(self) -> constants.AlignmentStr:
                                                                                                                                                                                                                                                                                                              """Return current form alignment.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  form alignment
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.ALIGNMENTS.inverse[self.formAlignment()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_label_alignment() -> constants.AlignmentStr

                                                                                                                                                                                                                                                                                                          Return current label alignment.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/formlayout.py
                                                                                                                                                                                                                                                                                                          def get_label_alignment(self) -> constants.AlignmentStr:
                                                                                                                                                                                                                                                                                                              """Return current label alignment.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  label alignment
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.ALIGNMENTS.inverse[self.labelAlignment()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_row_wrap_policy() -> RowWrapPolicyStr

                                                                                                                                                                                                                                                                                                          Return current row wrap policy.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/formlayout.py
                                                                                                                                                                                                                                                                                                          def get_row_wrap_policy(self) -> RowWrapPolicyStr:
                                                                                                                                                                                                                                                                                                              """Return current row wrap policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  row wrap policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return ROW_WRAP_POLICY.inverse[self.rowWrapPolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_field_growth_policy(policy: FieldGrowthPolicyStr | mod.FieldGrowthPolicy)

                                                                                                                                                                                                                                                                                                          Set field growth policy to use.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          policy FieldGrowthPolicyStr | FieldGrowthPolicy

                                                                                                                                                                                                                                                                                                          field growth policy to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/formlayout.py
                                                                                                                                                                                                                                                                                                          def set_field_growth_policy(
                                                                                                                                                                                                                                                                                                              self, policy: FieldGrowthPolicyStr | mod.FieldGrowthPolicy
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set field growth policy to use.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  policy: field growth policy to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setFieldGrowthPolicy(FIELD_GROWTH_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_form_alignment(alignment: constants.AlignmentStr | constants.AlignmentFlag)

                                                                                                                                                                                                                                                                                                          Set the alignment of the form.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          alignment AlignmentStr | AlignmentFlag

                                                                                                                                                                                                                                                                                                          alignment for the form

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/formlayout.py
                                                                                                                                                                                                                                                                                                          def set_form_alignment(
                                                                                                                                                                                                                                                                                                              self, alignment: constants.AlignmentStr | constants.AlignmentFlag
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the alignment of the form.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  alignment: alignment for the form
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setFormAlignment(constants.ALIGNMENTS.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_label_alignment(alignment: constants.AlignmentStr | constants.AlignmentFlag)

                                                                                                                                                                                                                                                                                                          Set the alignment of the label.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          alignment AlignmentStr | AlignmentFlag

                                                                                                                                                                                                                                                                                                          alignment for the label

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/formlayout.py
                                                                                                                                                                                                                                                                                                          def set_label_alignment(
                                                                                                                                                                                                                                                                                                              self, alignment: constants.AlignmentStr | constants.AlignmentFlag
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the alignment of the label.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  alignment: alignment for the label
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setLabelAlignment(constants.ALIGNMENTS.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_row_wrap_policy(policy: RowWrapPolicyStr | mod.RowWrapPolicy)

                                                                                                                                                                                                                                                                                                          Set row wrap policy to use.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          policy RowWrapPolicyStr | RowWrapPolicy

                                                                                                                                                                                                                                                                                                          row wrap policy to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/formlayout.py
                                                                                                                                                                                                                                                                                                          def set_row_wrap_policy(self, policy: RowWrapPolicyStr | mod.RowWrapPolicy):
                                                                                                                                                                                                                                                                                                              """Set row wrap policy to use.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  policy: row wrap policy to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setRowWrapPolicy(ROW_WRAP_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Frame

                                                                                                                                                                                                                                                                                                          Bases: FrameMixin, QFrame

                                                                                                                                                                                                                                                                                                          The base class of widgets that can have a frame.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/frame.py
                                                                                                                                                                                                                                                                                                          class Frame(FrameMixin, widgets.QFrame):
                                                                                                                                                                                                                                                                                                              """The base class of widgets that can have a frame."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          FrameMixin

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, _FrameBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/frame.py
                                                                                                                                                                                                                                                                                                          class FrameMixin(widgets.WidgetMixin, _FrameBase):
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {"frameShape": FRAME_SHAPE, "frameShadow": SHADOW}
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_frame_shadow(self, style: ShadowStr | widgets.QFrame.Shadow):
                                                                                                                                                                                                                                                                                                                  """Set frame shadow.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      style: frame style to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setFrameShadow(SHADOW.get_enum_value(style))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_frame_shadow(self) -> ShadowStr | None:
                                                                                                                                                                                                                                                                                                                  """Return current frame shadow.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      frame style
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if (frame_shadow := self.frameShadow()) == 0:
                                                                                                                                                                                                                                                                                                                      return None
                                                                                                                                                                                                                                                                                                                  return SHADOW.inverse[frame_shadow]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_frame_shape(self, shape: FrameShapeStr | widgets.QFrame.Shape):
                                                                                                                                                                                                                                                                                                                  """Set frame shape.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      shape: frame shape to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setFrameShape(FRAME_SHAPE.get_enum_value(shape))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_frame_shape(self) -> FrameShapeStr:
                                                                                                                                                                                                                                                                                                                  """Return current frame shape.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      frame shape
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return FRAME_SHAPE.inverse[self.frameShape()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_frame_rect(self, rect: datatypes.RectType):
                                                                                                                                                                                                                                                                                                                  self.setFrameRect(datatypes.to_rect(rect))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_frame_shadow() -> ShadowStr | None

                                                                                                                                                                                                                                                                                                          Return current frame shadow.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/frame.py
                                                                                                                                                                                                                                                                                                          def get_frame_shadow(self) -> ShadowStr | None:
                                                                                                                                                                                                                                                                                                              """Return current frame shadow.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  frame style
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if (frame_shadow := self.frameShadow()) == 0:
                                                                                                                                                                                                                                                                                                                  return None
                                                                                                                                                                                                                                                                                                              return SHADOW.inverse[frame_shadow]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_frame_shape() -> FrameShapeStr

                                                                                                                                                                                                                                                                                                          Return current frame shape.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/frame.py
                                                                                                                                                                                                                                                                                                          def get_frame_shape(self) -> FrameShapeStr:
                                                                                                                                                                                                                                                                                                              """Return current frame shape.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  frame shape
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return FRAME_SHAPE.inverse[self.frameShape()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_frame_shadow(style: ShadowStr | widgets.QFrame.Shadow)

                                                                                                                                                                                                                                                                                                          Set frame shadow.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          style ShadowStr | Shadow

                                                                                                                                                                                                                                                                                                          frame style to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/frame.py
                                                                                                                                                                                                                                                                                                          def set_frame_shadow(self, style: ShadowStr | widgets.QFrame.Shadow):
                                                                                                                                                                                                                                                                                                              """Set frame shadow.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  style: frame style to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setFrameShadow(SHADOW.get_enum_value(style))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_frame_shape(shape: FrameShapeStr | widgets.QFrame.Shape)

                                                                                                                                                                                                                                                                                                          Set frame shape.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          shape FrameShapeStr | Shape

                                                                                                                                                                                                                                                                                                          frame shape to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/frame.py
                                                                                                                                                                                                                                                                                                          def set_frame_shape(self, shape: FrameShapeStr | widgets.QFrame.Shape):
                                                                                                                                                                                                                                                                                                              """Set frame shape.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  shape: frame shape to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setFrameShape(FRAME_SHAPE.get_enum_value(shape))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Gesture

                                                                                                                                                                                                                                                                                                          Bases: GestureMixin, QGesture

                                                                                                                                                                                                                                                                                                          A gesture, containing properties that describe the corresponding user input.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/gesture.py
                                                                                                                                                                                                                                                                                                          class Gesture(GestureMixin, widgets.QGesture):
                                                                                                                                                                                                                                                                                                              """A gesture, containing properties that describe the corresponding user input."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GestureMixin

                                                                                                                                                                                                                                                                                                          Bases: ObjectMixin, _GestureBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/gesture.py
                                                                                                                                                                                                                                                                                                          class GestureMixin(core.ObjectMixin, _GestureBase):
                                                                                                                                                                                                                                                                                                              def get_state(self) -> constants.GestureStateStr:
                                                                                                                                                                                                                                                                                                                  """Return current state.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      state
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.GESTURE_STATE.inverse[self.state()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_gesture_type(self) -> constants.GestureTypeStr:
                                                                                                                                                                                                                                                                                                                  """Return current gesture type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      gesture type
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.GESTURE_TYPE.inverse[self.gestureType()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_hot_spot(self) -> core.PointF:
                                                                                                                                                                                                                                                                                                                  return core.PointF(self.hotSpot())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_gesture_cancel_policy(
                                                                                                                                                                                                                                                                                                                  self, policy: GestureCancelPolicyStr | widgets.QGesture.GestureCancelPolicy
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set gesture cancel policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      policy: gesture cancel policy to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setGestureCancelPolicy(GESTURE_CANCEL_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_gesture_cancel_policy(self) -> GestureCancelPolicyStr:
                                                                                                                                                                                                                                                                                                                  """Return current gesture cancel policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      gesture cancel policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return GESTURE_CANCEL_POLICY.inverse[self.gestureCancelPolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_gesture_cancel_policy() -> GestureCancelPolicyStr

                                                                                                                                                                                                                                                                                                          Return current gesture cancel policy.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/gesture.py
                                                                                                                                                                                                                                                                                                          def get_gesture_cancel_policy(self) -> GestureCancelPolicyStr:
                                                                                                                                                                                                                                                                                                              """Return current gesture cancel policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  gesture cancel policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return GESTURE_CANCEL_POLICY.inverse[self.gestureCancelPolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_gesture_type() -> constants.GestureTypeStr

                                                                                                                                                                                                                                                                                                          Return current gesture type.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/gesture.py
                                                                                                                                                                                                                                                                                                          def get_gesture_type(self) -> constants.GestureTypeStr:
                                                                                                                                                                                                                                                                                                              """Return current gesture type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  gesture type
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.GESTURE_TYPE.inverse[self.gestureType()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_state() -> constants.GestureStateStr

                                                                                                                                                                                                                                                                                                          Return current state.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/gesture.py
                                                                                                                                                                                                                                                                                                          def get_state(self) -> constants.GestureStateStr:
                                                                                                                                                                                                                                                                                                              """Return current state.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  state
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.GESTURE_STATE.inverse[self.state()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_gesture_cancel_policy(policy: GestureCancelPolicyStr | widgets.QGesture.GestureCancelPolicy)

                                                                                                                                                                                                                                                                                                          Set gesture cancel policy.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          policy GestureCancelPolicyStr | GestureCancelPolicy

                                                                                                                                                                                                                                                                                                          gesture cancel policy to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/gesture.py
                                                                                                                                                                                                                                                                                                          def set_gesture_cancel_policy(
                                                                                                                                                                                                                                                                                                              self, policy: GestureCancelPolicyStr | widgets.QGesture.GestureCancelPolicy
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set gesture cancel policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  policy: gesture cancel policy to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setGestureCancelPolicy(GESTURE_CANCEL_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GestureRecognizer

                                                                                                                                                                                                                                                                                                          Bases: GestureRecognizerMixin, QGestureRecognizer

                                                                                                                                                                                                                                                                                                          Provides the infrastructure for gesture recognition.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/gesturerecognizer.py
                                                                                                                                                                                                                                                                                                          class GestureRecognizer(GestureRecognizerMixin, widgets.QGestureRecognizer):
                                                                                                                                                                                                                                                                                                              """Provides the infrastructure for gesture recognition."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsAnchor

                                                                                                                                                                                                                                                                                                          Bases: ObjectMixin, QGraphicsAnchor

                                                                                                                                                                                                                                                                                                          Represents an anchor between two items in a QGraphicsAnchorLayout.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsanchor.py
                                                                                                                                                                                                                                                                                                          class GraphicsAnchor(core.ObjectMixin, widgets.QGraphicsAnchor):
                                                                                                                                                                                                                                                                                                              """Represents an anchor between two items in a QGraphicsAnchorLayout."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {"sizePolicy": widgets.sizepolicy.SIZE_POLICY}
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_size_policy(
                                                                                                                                                                                                                                                                                                                  self, policy: widgets.sizepolicy.SizePolicyStr | widgets.QSizePolicy.Policy
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the size policy of the anchor.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      policy: size policy to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setSizePolicy(widgets.sizepolicy.SIZE_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_size_policy(self) -> widgets.sizepolicy.SizePolicyStr:
                                                                                                                                                                                                                                                                                                                  """Return current size policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      size policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return widgets.sizepolicy.SIZE_POLICY.inverse[self.sizePolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_size_policy() -> widgets.sizepolicy.SizePolicyStr

                                                                                                                                                                                                                                                                                                          Return current size policy.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsanchor.py
                                                                                                                                                                                                                                                                                                          def get_size_policy(self) -> widgets.sizepolicy.SizePolicyStr:
                                                                                                                                                                                                                                                                                                              """Return current size policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  size policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return widgets.sizepolicy.SIZE_POLICY.inverse[self.sizePolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_size_policy(policy: widgets.sizepolicy.SizePolicyStr | widgets.QSizePolicy.Policy)

                                                                                                                                                                                                                                                                                                          Set the size policy of the anchor.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          policy SizePolicyStr | Policy

                                                                                                                                                                                                                                                                                                          size policy to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsanchor.py
                                                                                                                                                                                                                                                                                                          def set_size_policy(
                                                                                                                                                                                                                                                                                                              self, policy: widgets.sizepolicy.SizePolicyStr | widgets.QSizePolicy.Policy
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the size policy of the anchor.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  policy: size policy to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setSizePolicy(widgets.sizepolicy.SIZE_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsEffect

                                                                                                                                                                                                                                                                                                          Bases: GraphicsEffectMixin, QGraphicsEffect

                                                                                                                                                                                                                                                                                                          The base class for all graphics effects.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicseffect.py
                                                                                                                                                                                                                                                                                                          class GraphicsEffect(GraphicsEffectMixin, QtWidgets.QGraphicsEffect):
                                                                                                                                                                                                                                                                                                              """The base class for all graphics effects."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsEllipseItem

                                                                                                                                                                                                                                                                                                          Bases: AbstractGraphicsShapeItemMixin, QGraphicsEllipseItem

                                                                                                                                                                                                                                                                                                          Ellipse item that you can add to a QGraphicsScene.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsellipseitem.py
                                                                                                                                                                                                                                                                                                          class GraphicsEllipseItem(
                                                                                                                                                                                                                                                                                                              widgets.AbstractGraphicsShapeItemMixin, widgets.QGraphicsEllipseItem
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Ellipse item that you can add to a QGraphicsScene."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __repr__(self):
                                                                                                                                                                                                                                                                                                                  return get_repr(self, self.get_rect())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_rect(self) -> core.RectF:
                                                                                                                                                                                                                                                                                                                  return core.RectF(self.rect())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsGridLayout

                                                                                                                                                                                                                                                                                                          Bases: GraphicsLayoutMixin, QGraphicsGridLayout

                                                                                                                                                                                                                                                                                                          Grid layout for managing widgets in Graphics View.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsgridlayout.py
                                                                                                                                                                                                                                                                                                          class GraphicsGridLayout(widgets.GraphicsLayoutMixin, widgets.QGraphicsGridLayout):
                                                                                                                                                                                                                                                                                                              """Grid layout for managing widgets in Graphics View."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(
                                                                                                                                                                                                                                                                                                                  self, index: tuple[int | slice, int | slice] | int
                                                                                                                                                                                                                                                                                                              ) -> (
                                                                                                                                                                                                                                                                                                                  widgets.QGraphicsLayoutItem
                                                                                                                                                                                                                                                                                                                  | listdelegators.ListDelegator[widgets.QGraphicsLayoutItem]
                                                                                                                                                                                                                                                                                                                  | None
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  rowcount = self.rowCount()
                                                                                                                                                                                                                                                                                                                  colcount = self.columnCount()
                                                                                                                                                                                                                                                                                                                  match index:
                                                                                                                                                                                                                                                                                                                      case int() as row, int() as col:
                                                                                                                                                                                                                                                                                                                          if row >= rowcount or col >= colcount:
                                                                                                                                                                                                                                                                                                                              raise IndexError(index)
                                                                                                                                                                                                                                                                                                                          return self.itemAt(row, col)
                                                                                                                                                                                                                                                                                                                      case (int() | slice() as row, int() | slice() as col):
                                                                                                                                                                                                                                                                                                                          items = [
                                                                                                                                                                                                                                                                                                                              item
                                                                                                                                                                                                                                                                                                                              for i, j in helpers.iter_positions(row, col, rowcount, colcount)
                                                                                                                                                                                                                                                                                                                              if (item := self.itemAt(i, j)) is not None
                                                                                                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                                                                                                          return listdelegators.ListDelegator(list(set(items)))
                                                                                                                                                                                                                                                                                                                      case int() as row:
                                                                                                                                                                                                                                                                                                                          if row >= rowcount:
                                                                                                                                                                                                                                                                                                                              raise IndexError(index)
                                                                                                                                                                                                                                                                                                                          return self.itemAt(row)
                                                                                                                                                                                                                                                                                                                      case slice() as rowslice:
                                                                                                                                                                                                                                                                                                                          items = [
                                                                                                                                                                                                                                                                                                                              item
                                                                                                                                                                                                                                                                                                                              for i in range(*rowslice.indices(self.count()))
                                                                                                                                                                                                                                                                                                                              if (item := self.itemAt(i)) is not None
                                                                                                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                                                                                                          return listdelegators.ListDelegator(list(set(items)))
                                                                                                                                                                                                                                                                                                                      case str():
                                                                                                                                                                                                                                                                                                                          for i in range(self.count()):
                                                                                                                                                                                                                                                                                                                              item = self.itemAt(i)
                                                                                                                                                                                                                                                                                                                              if (
                                                                                                                                                                                                                                                                                                                                  isinstance(item, widgets.QGraphicsWidget)
                                                                                                                                                                                                                                                                                                                                  and item.objectName() == index
                                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                                  return item
                                                                                                                                                                                                                                                                                                                          return None
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise TypeError(index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __setitem__(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  idx: tuple[int | slice, int | slice],
                                                                                                                                                                                                                                                                                                                  value: widgets.QGraphicsLayoutItem,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  row, col = idx
                                                                                                                                                                                                                                                                                                                  rowspan = row.stop - row.start + 1 if isinstance(row, slice) else 1
                                                                                                                                                                                                                                                                                                                  colspan = col.stop - col.start + 1 if isinstance(col, slice) else 1
                                                                                                                                                                                                                                                                                                                  rowstart = row.start if isinstance(row, slice) else row
                                                                                                                                                                                                                                                                                                                  colstart = col.start if isinstance(col, slice) else col
                                                                                                                                                                                                                                                                                                                  self.add(value, rowstart, colstart, rowspan, colspan)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def serialize_fields(self):
                                                                                                                                                                                                                                                                                                                  items = []
                                                                                                                                                                                                                                                                                                                  positions = []
                                                                                                                                                                                                                                                                                                                  for row in range(self.rowCount()):
                                                                                                                                                                                                                                                                                                                      for col in range(self.columnCount()):
                                                                                                                                                                                                                                                                                                                          item = self.itemAt(row, col)
                                                                                                                                                                                                                                                                                                                          if item is not None:
                                                                                                                                                                                                                                                                                                                              items.append(item)
                                                                                                                                                                                                                                                                                                                              positions.append((row, col))
                                                                                                                                                                                                                                                                                                                  return dict(widgets=items, positions=positions)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getstate__(self):
                                                                                                                                                                                                                                                                                                                  return self.serialize_fields()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __reduce__(self):
                                                                                                                                                                                                                                                                                                                  return type(self), (), self.__getstate__()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __setstate__(self, state):
                                                                                                                                                                                                                                                                                                                  for item, pos in zip(state["widgets"], state["positions"]):
                                                                                                                                                                                                                                                                                                                      row, col = pos
                                                                                                                                                                                                                                                                                                                      self[row, col] = item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __iter__(self) -> Iterator[widgets.QGraphicsLayoutItem]:
                                                                                                                                                                                                                                                                                                                  return iter(i for n in range(self.count()) if (i := self.itemAt(n)) is not None)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __add__(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  other: (Iterable[widgets.QGraphicsLayoutItem] | widgets.QGraphicsLayoutItem),
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  if isinstance(other, Iterable):
                                                                                                                                                                                                                                                                                                                      for i, control in enumerate(other):
                                                                                                                                                                                                                                                                                                                          self[self.rowCount(), i] = control
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self[self.rowCount(), 0 : self.columnCount() - 1] = other
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  item: widgets.QGraphicsLayoutItem,
                                                                                                                                                                                                                                                                                                                  rowstart: int,
                                                                                                                                                                                                                                                                                                                  colstart: int,
                                                                                                                                                                                                                                                                                                                  rowspan: int = 1,
                                                                                                                                                                                                                                                                                                                  colspan: int = 1,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  self.addItem(item, rowstart, colstart, rowspan, colspan)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def append(self, item: widgets.QGraphicsLayoutItem):
                                                                                                                                                                                                                                                                                                                  self[self.rowCount(), 0 : self.columnCount() - 1] = item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_column_alignment(
                                                                                                                                                                                                                                                                                                                  self, column: int, alignment: constants.AlignmentStr | constants.AlignmentFlag
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  self.setColumnAlignment(column, constants.ALIGNMENTS.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_row_alignment(
                                                                                                                                                                                                                                                                                                                  self, row: int, alignment: constants.AlignmentStr | constants.AlignmentFlag
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  self.setRowAlignment(row, constants.ALIGNMENTS.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsItem

                                                                                                                                                                                                                                                                                                          Bases: GraphicsItemMixin, QGraphicsItem

                                                                                                                                                                                                                                                                                                          The base class for all graphical items in a QGraphicsScene.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsitem.py
                                                                                                                                                                                                                                                                                                          class GraphicsItem(GraphicsItemMixin, QtWidgets.QGraphicsItem):
                                                                                                                                                                                                                                                                                                              """The base class for all graphical items in a QGraphicsScene."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsItemGroup

                                                                                                                                                                                                                                                                                                          Bases: GraphicsItemMixin, QGraphicsItemGroup

                                                                                                                                                                                                                                                                                                          Container that treats a group of items as a single item.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsitemgroup.py
                                                                                                                                                                                                                                                                                                          class GraphicsItemGroup(widgets.GraphicsItemMixin, widgets.QGraphicsItemGroup):
                                                                                                                                                                                                                                                                                                              """Container that treats a group of items as a single item."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsItemMixin

                                                                                                                                                                                                                                                                                                          Bases: _GraphicsItemBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsitem.py
                                                                                                                                                                                                                                                                                                          class GraphicsItemMixin(_GraphicsItemBase):
                                                                                                                                                                                                                                                                                                              def __repr__(self):
                                                                                                                                                                                                                                                                                                                  return get_repr(self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __contains__(self, value: QtCore.QPointF) -> bool:
                                                                                                                                                                                                                                                                                                                  return self.contains(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(self, key: int):
                                                                                                                                                                                                                                                                                                                  return self.data(key)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __setitem__(self, key: int, value):
                                                                                                                                                                                                                                                                                                                  self.setData(key, value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_focus(
                                                                                                                                                                                                                                                                                                                  self, reason: constants.FocusReasonStr | constants.FocusReason = "other"
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  self.setFocus(constants.FOCUS_REASONS.get_enum_value(reason))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def colliding_items(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  mode: constants.ItemSelectionModeStr
                                                                                                                                                                                                                                                                                                                  | constants.ItemSelectionMode = "intersects_shape",
                                                                                                                                                                                                                                                                                                              ) -> listdelegators.ListDelegator[QtWidgets.QGraphicsItem]:
                                                                                                                                                                                                                                                                                                                  items = self.collidingItems(constants.ITEM_SELECTION_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                                  return listdelegators.ListDelegator(items)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def collides_with(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  item: gui.QPainterPath | QtWidgets.QGraphicsItem,
                                                                                                                                                                                                                                                                                                                  mode: constants.ItemSelectionModeStr
                                                                                                                                                                                                                                                                                                                  | constants.ItemSelectionMode = "intersects_shape",
                                                                                                                                                                                                                                                                                                              ) -> bool:
                                                                                                                                                                                                                                                                                                                  if isinstance(item, gui.QPainterPath):
                                                                                                                                                                                                                                                                                                                      return self.collidesWithPath(
                                                                                                                                                                                                                                                                                                                          item, constants.ITEM_SELECTION_MODE.get_enum_value(mode)
                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                                  return self.collidesWithItem(
                                                                                                                                                                                                                                                                                                                      item, constants.ITEM_SELECTION_MODE.get_enum_value(mode)
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_panel_modality(
                                                                                                                                                                                                                                                                                                                  self, modality: PanelModalityStr | QtWidgets.QGraphicsItem.PanelModality
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set panel modality.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      modality: panel modality
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setPanelModality(PANEL_MODALITY.get_enum_value(modality))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_panel_modality(self) -> PanelModalityStr:
                                                                                                                                                                                                                                                                                                                  """Get the current modality modes as a string.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      panel modality
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return PANEL_MODALITY.inverse[self.panelModality()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_cache_mode(self, mode: CacheModeStr | QtWidgets.QGraphicsItem.CacheMode):
                                                                                                                                                                                                                                                                                                                  """Set cache mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: cache mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setCacheMode(CACHE_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_cache_mode(self) -> CacheModeStr:
                                                                                                                                                                                                                                                                                                                  """Get the current mode modes as a string.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      cache mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return CACHE_MODE.inverse[self.cacheMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_shape(self) -> gui.PainterPath:
                                                                                                                                                                                                                                                                                                                  return gui.PainterPath(self.shape())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_scale(self, scale: tuple[float, float] | float):
                                                                                                                                                                                                                                                                                                                  if isinstance(scale, int | float):
                                                                                                                                                                                                                                                                                                                      self.setScale(scale)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.setTransform(gui.Transform.fromScale(scale[0], scale[1]), True)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_transform(self, transform: datatypes.TransformType, combine: bool = False):
                                                                                                                                                                                                                                                                                                                  if isinstance(transform, tuple):
                                                                                                                                                                                                                                                                                                                      transform = gui.Transform(*transform)
                                                                                                                                                                                                                                                                                                                  self.setTransform(transform, combine)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_cache_mode() -> CacheModeStr

                                                                                                                                                                                                                                                                                                          Get the current mode modes as a string.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsitem.py
                                                                                                                                                                                                                                                                                                          def get_cache_mode(self) -> CacheModeStr:
                                                                                                                                                                                                                                                                                                              """Get the current mode modes as a string.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  cache mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return CACHE_MODE.inverse[self.cacheMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_panel_modality() -> PanelModalityStr

                                                                                                                                                                                                                                                                                                          Get the current modality modes as a string.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsitem.py
                                                                                                                                                                                                                                                                                                          def get_panel_modality(self) -> PanelModalityStr:
                                                                                                                                                                                                                                                                                                              """Get the current modality modes as a string.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  panel modality
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return PANEL_MODALITY.inverse[self.panelModality()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_cache_mode(mode: CacheModeStr | QtWidgets.QGraphicsItem.CacheMode)

                                                                                                                                                                                                                                                                                                          Set cache mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode CacheModeStr | CacheMode

                                                                                                                                                                                                                                                                                                          cache mode

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsitem.py
                                                                                                                                                                                                                                                                                                          def set_cache_mode(self, mode: CacheModeStr | QtWidgets.QGraphicsItem.CacheMode):
                                                                                                                                                                                                                                                                                                              """Set cache mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: cache mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setCacheMode(CACHE_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_panel_modality(modality: PanelModalityStr | QtWidgets.QGraphicsItem.PanelModality)

                                                                                                                                                                                                                                                                                                          Set panel modality.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          modality PanelModalityStr | PanelModality

                                                                                                                                                                                                                                                                                                          panel modality

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsitem.py
                                                                                                                                                                                                                                                                                                          def set_panel_modality(
                                                                                                                                                                                                                                                                                                              self, modality: PanelModalityStr | QtWidgets.QGraphicsItem.PanelModality
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set panel modality.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  modality: panel modality
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setPanelModality(PANEL_MODALITY.get_enum_value(modality))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsLayout

                                                                                                                                                                                                                                                                                                          Bases: GraphicsLayoutMixin, QGraphicsLayout

                                                                                                                                                                                                                                                                                                          The base class for all layouts in Graphics View.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicslayout.py
                                                                                                                                                                                                                                                                                                          class GraphicsLayout(GraphicsLayoutMixin, widgets.QGraphicsLayout):
                                                                                                                                                                                                                                                                                                              """The base class for all layouts in Graphics View."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsLayoutItem

                                                                                                                                                                                                                                                                                                          Bases: GraphicsLayoutItemMixin, QGraphicsLayoutItem

                                                                                                                                                                                                                                                                                                          Can be inherited to allow your custom items to be managed by layouts.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicslayoutitem.py
                                                                                                                                                                                                                                                                                                          class GraphicsLayoutItem(GraphicsLayoutItemMixin, widgets.QGraphicsLayoutItem):
                                                                                                                                                                                                                                                                                                              """Can be inherited to allow your custom items to be managed by layouts."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsLayoutItemMixin

                                                                                                                                                                                                                                                                                                          Bases: _GraphicsLayoutItemBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicslayoutitem.py
                                                                                                                                                                                                                                                                                                          class GraphicsLayoutItemMixin(_GraphicsLayoutItemBase):
                                                                                                                                                                                                                                                                                                              def __repr__(self):
                                                                                                                                                                                                                                                                                                                  return get_repr(self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __bool__(self):
                                                                                                                                                                                                                                                                                                                  return not self.isEmpty()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @functools.singledispatchmethod
                                                                                                                                                                                                                                                                                                              def set_size_policy(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  horizontal: widgets.sizepolicy.SizePolicyStr,
                                                                                                                                                                                                                                                                                                                  vertical: widgets.sizepolicy.SizePolicyStr,
                                                                                                                                                                                                                                                                                                                  control_type: widgets.sizepolicy.ControlTypeStr = "default",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the size policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      horizontal: horizontal size policy
                                                                                                                                                                                                                                                                                                                      vertical: vertical size policy
                                                                                                                                                                                                                                                                                                                      control_type: control type associated with the widget
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  h_policy = widgets.sizepolicy.SIZE_POLICY[horizontal]
                                                                                                                                                                                                                                                                                                                  v_policy = widgets.sizepolicy.SIZE_POLICY[vertical]
                                                                                                                                                                                                                                                                                                                  c = widgets.sizepolicy.CONTROL_TYPE[control_type]
                                                                                                                                                                                                                                                                                                                  self.setSizePolicy(h_policy, v_policy, c)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @set_size_policy.register
                                                                                                                                                                                                                                                                                                              def _(self, policy: widgets.QSizePolicy):
                                                                                                                                                                                                                                                                                                                  self.setSizePolicy(policy)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_size_policy(self) -> widgets.SizePolicy:
                                                                                                                                                                                                                                                                                                                  qpol = self.sizePolicy()
                                                                                                                                                                                                                                                                                                                  return widgets.SizePolicy.clone(qpol)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_size_policy(horizontal: widgets.sizepolicy.SizePolicyStr, vertical: widgets.sizepolicy.SizePolicyStr, control_type: widgets.sizepolicy.ControlTypeStr = 'default')

                                                                                                                                                                                                                                                                                                          Set the size policy.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          horizontal SizePolicyStr

                                                                                                                                                                                                                                                                                                          horizontal size policy

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          vertical SizePolicyStr

                                                                                                                                                                                                                                                                                                          vertical size policy

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          control_type ControlTypeStr

                                                                                                                                                                                                                                                                                                          control type associated with the widget

                                                                                                                                                                                                                                                                                                          'default'
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicslayoutitem.py
                                                                                                                                                                                                                                                                                                          @functools.singledispatchmethod
                                                                                                                                                                                                                                                                                                          def set_size_policy(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              horizontal: widgets.sizepolicy.SizePolicyStr,
                                                                                                                                                                                                                                                                                                              vertical: widgets.sizepolicy.SizePolicyStr,
                                                                                                                                                                                                                                                                                                              control_type: widgets.sizepolicy.ControlTypeStr = "default",
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the size policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  horizontal: horizontal size policy
                                                                                                                                                                                                                                                                                                                  vertical: vertical size policy
                                                                                                                                                                                                                                                                                                                  control_type: control type associated with the widget
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              h_policy = widgets.sizepolicy.SIZE_POLICY[horizontal]
                                                                                                                                                                                                                                                                                                              v_policy = widgets.sizepolicy.SIZE_POLICY[vertical]
                                                                                                                                                                                                                                                                                                              c = widgets.sizepolicy.CONTROL_TYPE[control_type]
                                                                                                                                                                                                                                                                                                              self.setSizePolicy(h_policy, v_policy, c)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsLineItem

                                                                                                                                                                                                                                                                                                          Bases: GraphicsItemMixin, QGraphicsLineItem

                                                                                                                                                                                                                                                                                                          Line item that you can add to a QGraphicsScene.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicslineitem.py
                                                                                                                                                                                                                                                                                                          class GraphicsLineItem(widgets.GraphicsItemMixin, widgets.QGraphicsLineItem):
                                                                                                                                                                                                                                                                                                              """Line item that you can add to a QGraphicsScene."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __repr__(self):
                                                                                                                                                                                                                                                                                                                  return get_repr(self, self.get_line())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_line(self) -> core.LineF:
                                                                                                                                                                                                                                                                                                                  return core.LineF(self.line())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsLinearLayout

                                                                                                                                                                                                                                                                                                          Bases: GraphicsLayoutMixin, QGraphicsLinearLayout

                                                                                                                                                                                                                                                                                                          Horizontal or vertical layout for managing widgets in Graphics View.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicslinearlayout.py
                                                                                                                                                                                                                                                                                                          class GraphicsLinearLayout(widgets.GraphicsLayoutMixin, widgets.QGraphicsLinearLayout):
                                                                                                                                                                                                                                                                                                              """Horizontal or vertical layout for managing widgets in Graphics View."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  orientation: constants.OrientationStr | constants.Orientation = "horizontal",
                                                                                                                                                                                                                                                                                                                  parent: widgets.QGraphicsLayoutItem | None = None,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  ori = constants.ORIENTATION.get_enum_value(orientation)
                                                                                                                                                                                                                                                                                                                  super().__init__(ori, parent)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __add__(self, other):
                                                                                                                                                                                                                                                                                                                  self[self.count()] = other
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsObject

                                                                                                                                                                                                                                                                                                          Bases: GraphicsObjectMixin, QGraphicsObject

                                                                                                                                                                                                                                                                                                          Base class for all graphics items that require signals, slots and properties.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsobject.py
                                                                                                                                                                                                                                                                                                          class GraphicsObject(GraphicsObjectMixin, widgets.QGraphicsObject):
                                                                                                                                                                                                                                                                                                              """Base class for all graphics items that require signals, slots and properties."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsPathItem

                                                                                                                                                                                                                                                                                                          Bases: AbstractGraphicsShapeItemMixin, QGraphicsPathItem

                                                                                                                                                                                                                                                                                                          Path item that you can add to a QGraphicsScene.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicspathitem.py
                                                                                                                                                                                                                                                                                                          class GraphicsPathItem(widgets.AbstractGraphicsShapeItemMixin, widgets.QGraphicsPathItem):
                                                                                                                                                                                                                                                                                                              """Path item that you can add to a QGraphicsScene."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsPixmapItem

                                                                                                                                                                                                                                                                                                          Bases: GraphicsItemMixin, QGraphicsPixmapItem

                                                                                                                                                                                                                                                                                                          Pixmap item that you can add to a QGraphicsScene.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicspixmapitem.py
                                                                                                                                                                                                                                                                                                          class GraphicsPixmapItem(widgets.GraphicsItemMixin, widgets.QGraphicsPixmapItem):
                                                                                                                                                                                                                                                                                                              """Pixmap item that you can add to a QGraphicsScene."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_transformation_mode(
                                                                                                                                                                                                                                                                                                                  self, mode: constants.TransformationModeStr | constants.TransformationMode
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set transformation mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: transformation mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setTransformationMode(constants.TRANSFORMATION_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_transformation_mode(self) -> constants.TransformationModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current transformation mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      transformation mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.TRANSFORMATION_MODE.inverse[self.transformationMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_shape_mode(self, mode: ShapeModeStr | widgets.QGraphicsPixmapItem.ShapeMode):
                                                                                                                                                                                                                                                                                                                  """Set shape mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: shape mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setShapeMode(SHAPE_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_shape_mode(self) -> ShapeModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current shape mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      shape mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return SHAPE_MODE.inverse[self.shapeMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_pixmap(self) -> gui.Pixmap | None:
                                                                                                                                                                                                                                                                                                                  pix = self.pixmap()
                                                                                                                                                                                                                                                                                                                  return None if pix.isNull() else gui.Pixmap(pix)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_shape_mode() -> ShapeModeStr

                                                                                                                                                                                                                                                                                                          Return current shape mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicspixmapitem.py
                                                                                                                                                                                                                                                                                                          def get_shape_mode(self) -> ShapeModeStr:
                                                                                                                                                                                                                                                                                                              """Return current shape mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  shape mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return SHAPE_MODE.inverse[self.shapeMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_transformation_mode() -> constants.TransformationModeStr

                                                                                                                                                                                                                                                                                                          Return current transformation mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicspixmapitem.py
                                                                                                                                                                                                                                                                                                          def get_transformation_mode(self) -> constants.TransformationModeStr:
                                                                                                                                                                                                                                                                                                              """Return current transformation mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  transformation mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.TRANSFORMATION_MODE.inverse[self.transformationMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_shape_mode(mode: ShapeModeStr | widgets.QGraphicsPixmapItem.ShapeMode)

                                                                                                                                                                                                                                                                                                          Set shape mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ShapeModeStr | ShapeMode

                                                                                                                                                                                                                                                                                                          shape mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicspixmapitem.py
                                                                                                                                                                                                                                                                                                          def set_shape_mode(self, mode: ShapeModeStr | widgets.QGraphicsPixmapItem.ShapeMode):
                                                                                                                                                                                                                                                                                                              """Set shape mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: shape mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setShapeMode(SHAPE_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_transformation_mode(mode: constants.TransformationModeStr | constants.TransformationMode)

                                                                                                                                                                                                                                                                                                          Set transformation mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode TransformationModeStr | TransformationMode

                                                                                                                                                                                                                                                                                                          transformation mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicspixmapitem.py
                                                                                                                                                                                                                                                                                                          def set_transformation_mode(
                                                                                                                                                                                                                                                                                                              self, mode: constants.TransformationModeStr | constants.TransformationMode
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set transformation mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: transformation mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setTransformationMode(constants.TRANSFORMATION_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsPolygonItem

                                                                                                                                                                                                                                                                                                          Bases: AbstractGraphicsShapeItemMixin, QGraphicsPolygonItem

                                                                                                                                                                                                                                                                                                          Polygon item that you can add to a QGraphicsScene.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicspolygonitem.py
                                                                                                                                                                                                                                                                                                          class GraphicsPolygonItem(
                                                                                                                                                                                                                                                                                                              widgets.AbstractGraphicsShapeItemMixin, widgets.QGraphicsPolygonItem
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Polygon item that you can add to a QGraphicsScene."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_polygon(self) -> gui.PolygonF:
                                                                                                                                                                                                                                                                                                                  return gui.PolygonF(self.polygon())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_fill_rule(self, rule: constants.FillRuleStr | constants.FillRule):
                                                                                                                                                                                                                                                                                                                  self.setFillRule(constants.FILL_RULE.get_enum_value(rule))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_fill_rule(self) -> constants.FillRuleStr:
                                                                                                                                                                                                                                                                                                                  return constants.FILL_RULE.inverse[self.fillRule()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsProxyWidget

                                                                                                                                                                                                                                                                                                          Bases: GraphicsWidgetMixin, QGraphicsProxyWidget

                                                                                                                                                                                                                                                                                                          Proxy layer for embedding a QWidget in a QGraphicsScene.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsproxywidget.py
                                                                                                                                                                                                                                                                                                          class GraphicsProxyWidget(widgets.GraphicsWidgetMixin, widgets.QGraphicsProxyWidget):
                                                                                                                                                                                                                                                                                                              """Proxy layer for embedding a QWidget in a QGraphicsScene."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsRectItem

                                                                                                                                                                                                                                                                                                          Bases: AbstractGraphicsShapeItemMixin, QGraphicsRectItem

                                                                                                                                                                                                                                                                                                          Rectangle item that you can add to a QGraphicsScene.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsrectitem.py
                                                                                                                                                                                                                                                                                                          class GraphicsRectItem(widgets.AbstractGraphicsShapeItemMixin, widgets.QGraphicsRectItem):
                                                                                                                                                                                                                                                                                                              """Rectangle item that you can add to a QGraphicsScene."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __repr__(self):
                                                                                                                                                                                                                                                                                                                  return get_repr(self, self.get_rect())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_rect(self) -> core.RectF:
                                                                                                                                                                                                                                                                                                                  return core.RectF(self.rect())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def serialize_fields(self):
                                                                                                                                                                                                                                                                                                                  return dict(rect=self.get_rect())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getstate__(self):
                                                                                                                                                                                                                                                                                                                  return self.serialize_fields()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __setstate__(self, state):
                                                                                                                                                                                                                                                                                                                  self.setRect(state["rect"])
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __reduce__(self):
                                                                                                                                                                                                                                                                                                                  return type(self), (), self.__getstate__()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsRotation

                                                                                                                                                                                                                                                                                                          Bases: GraphicsTransformMixin, QGraphicsRotation

                                                                                                                                                                                                                                                                                                          Rotation transformation around a given axis.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsrotation.py
                                                                                                                                                                                                                                                                                                          class GraphicsRotation(widgets.GraphicsTransformMixin, widgets.QGraphicsRotation):
                                                                                                                                                                                                                                                                                                              """Rotation transformation around a given axis."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_axis(self, axis: constants.AxisStr | constants.Axis):
                                                                                                                                                                                                                                                                                                                  self.setAxis(constants.AXIS.get_enum_value(axis))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_origin(self, origin: datatypes.Vector3DType):
                                                                                                                                                                                                                                                                                                                  self.setOrigin(datatypes.to_vector3d(origin))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsScene

                                                                                                                                                                                                                                                                                                          Bases: ObjectMixin, QGraphicsScene

                                                                                                                                                                                                                                                                                                          Surface for managing a large number of 2D graphical items.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsscene.py
                                                                                                                                                                                                                                                                                                          class GraphicsScene(core.ObjectMixin, widgets.QGraphicsScene):
                                                                                                                                                                                                                                                                                                              """Surface for managing a large number of 2D graphical items."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              class GridType(enum.IntEnum):
                                                                                                                                                                                                                                                                                                                  """Grid type for background."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  NoGrid = 0
                                                                                                                                                                                                                                                                                                                  DotGrid = 1
                                                                                                                                                                                                                                                                                                                  LineGrid = 2
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, parent=None):
                                                                                                                                                                                                                                                                                                                  super().__init__(parent)
                                                                                                                                                                                                                                                                                                                  self._grid_mode = self.GridType.LineGrid
                                                                                                                                                                                                                                                                                                                  self._grid_size = 50
                                                                                                                                                                                                                                                                                                                  self._pen_width = 0.65
                                                                                                                                                                                                                                                                                                                  self._grid_color = self.get_palette().get_color("text")
                                                                                                                                                                                                                                                                                                                  self._bg_color = self.get_palette().get_color("window")
                                                                                                                                                                                                                                                                                                                  # self.setBackgroundBrush(self._bg_color)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __repr__(self):
                                                                                                                                                                                                                                                                                                                  cls_name = str(self.__class__.__name__)
                                                                                                                                                                                                                                                                                                                  return f'<{cls_name}("{self.viewer()}") object at {hex(id(self))}>'
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(self, index: int) -> widgets.QGraphicsItem:
                                                                                                                                                                                                                                                                                                                  return self.items()[index]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {"itemIndexMethod": ITEM_INDEX_METHOD}
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_palette(self) -> gui.Palette:
                                                                                                                                                                                                                                                                                                                  return gui.Palette(self.palette())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_font(self) -> gui.Font:
                                                                                                                                                                                                                                                                                                                  return gui.Font(self.font())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_background_brush(self) -> gui.Brush:
                                                                                                                                                                                                                                                                                                                  return gui.Brush(self.backgroundBrush())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_foreground_brush(self) -> gui.Brush:
                                                                                                                                                                                                                                                                                                                  return gui.Brush(self.foregroundBrush())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add(self, item) -> widgets.QGraphicsItem:  # noqa: PLR0911
                                                                                                                                                                                                                                                                                                                  match item:
                                                                                                                                                                                                                                                                                                                      case widgets.QGraphicsItem():
                                                                                                                                                                                                                                                                                                                          self.addItem(item)
                                                                                                                                                                                                                                                                                                                          return item
                                                                                                                                                                                                                                                                                                                      case gui.QPixmap():
                                                                                                                                                                                                                                                                                                                          return self.add_pixmap(item)
                                                                                                                                                                                                                                                                                                                      case gui.QPainterPath():
                                                                                                                                                                                                                                                                                                                          return self.add_path(item)
                                                                                                                                                                                                                                                                                                                      case gui.QPolygonF():
                                                                                                                                                                                                                                                                                                                          return self.add_polygon(item)
                                                                                                                                                                                                                                                                                                                      case core.QRectF():
                                                                                                                                                                                                                                                                                                                          return self.add_rect(item)
                                                                                                                                                                                                                                                                                                                      case core.QLine():
                                                                                                                                                                                                                                                                                                                          return self.add_line(item)
                                                                                                                                                                                                                                                                                                                      case str():
                                                                                                                                                                                                                                                                                                                          return self.add_text(item)
                                                                                                                                                                                                                                                                                                                      case widgets.QWidget():
                                                                                                                                                                                                                                                                                                                          return self.add_widget(item)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise TypeError(item)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_pixmap(self, pixmap: gui.QPixmap) -> widgets.GraphicsPixmapItem:
                                                                                                                                                                                                                                                                                                                  g_item = widgets.GraphicsPixmapItem(pixmap)
                                                                                                                                                                                                                                                                                                                  self.addItem(g_item)
                                                                                                                                                                                                                                                                                                                  return g_item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_polygon(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  polygon: gui.QPolygonF | gui.QPolygon,
                                                                                                                                                                                                                                                                                                                  pen: gui.QPen | None = None,
                                                                                                                                                                                                                                                                                                                  brush: gui.QBrush | None = None,
                                                                                                                                                                                                                                                                                                              ) -> widgets.GraphicsPolygonItem:
                                                                                                                                                                                                                                                                                                                  if isinstance(polygon, gui.QPolygon):
                                                                                                                                                                                                                                                                                                                      polygon = gui.PolygonF(polygon)
                                                                                                                                                                                                                                                                                                                  g_item = widgets.GraphicsPolygonItem(polygon)
                                                                                                                                                                                                                                                                                                                  if brush is not None:
                                                                                                                                                                                                                                                                                                                      g_item.setBrush(brush)
                                                                                                                                                                                                                                                                                                                  if pen is not None:
                                                                                                                                                                                                                                                                                                                      g_item.setPen(pen)
                                                                                                                                                                                                                                                                                                                  self.addItem(g_item)
                                                                                                                                                                                                                                                                                                                  return g_item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_path(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  path: gui.QPainterPath,
                                                                                                                                                                                                                                                                                                                  pen: gui.QPen | None = None,
                                                                                                                                                                                                                                                                                                                  brush: gui.QBrush | None = None,
                                                                                                                                                                                                                                                                                                              ) -> widgets.GraphicsPathItem:
                                                                                                                                                                                                                                                                                                                  g_item = widgets.GraphicsPathItem(path)
                                                                                                                                                                                                                                                                                                                  if brush is not None:
                                                                                                                                                                                                                                                                                                                      g_item.setBrush(brush)
                                                                                                                                                                                                                                                                                                                  if pen is not None:
                                                                                                                                                                                                                                                                                                                      g_item.setPen(pen)
                                                                                                                                                                                                                                                                                                                  self.addItem(g_item)
                                                                                                                                                                                                                                                                                                                  return g_item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_rect(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  rect: datatypes.RectType | datatypes.RectFType,
                                                                                                                                                                                                                                                                                                                  pen: gui.QPen | None = None,
                                                                                                                                                                                                                                                                                                                  brush: gui.QBrush | None = None,
                                                                                                                                                                                                                                                                                                              ) -> widgets.GraphicsRectItem:
                                                                                                                                                                                                                                                                                                                  g_item = widgets.GraphicsRectItem(datatypes.to_rectf(rect))
                                                                                                                                                                                                                                                                                                                  if brush is not None:
                                                                                                                                                                                                                                                                                                                      g_item.setBrush(brush)
                                                                                                                                                                                                                                                                                                                  if pen is not None:
                                                                                                                                                                                                                                                                                                                      g_item.setPen(pen)
                                                                                                                                                                                                                                                                                                                  self.addItem(g_item)
                                                                                                                                                                                                                                                                                                                  return g_item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_line(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  line: datatypes.LineFType,
                                                                                                                                                                                                                                                                                                                  pen: gui.QPen | None = None,
                                                                                                                                                                                                                                                                                                              ) -> widgets.GraphicsLineItem:
                                                                                                                                                                                                                                                                                                                  g_item = widgets.GraphicsLineItem(datatypes.to_linef(line))
                                                                                                                                                                                                                                                                                                                  if pen is not None:
                                                                                                                                                                                                                                                                                                                      g_item.setPen(pen)
                                                                                                                                                                                                                                                                                                                  self.addItem(g_item)
                                                                                                                                                                                                                                                                                                                  return g_item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_ellipse(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  ellipse: datatypes.RectType | datatypes.RectFType,
                                                                                                                                                                                                                                                                                                                  pen: gui.QPen | None = None,
                                                                                                                                                                                                                                                                                                                  brush: gui.QBrush | None = None,
                                                                                                                                                                                                                                                                                                              ) -> widgets.GraphicsEllipseItem:
                                                                                                                                                                                                                                                                                                                  g_item = widgets.GraphicsEllipseItem(datatypes.to_rectf(ellipse))
                                                                                                                                                                                                                                                                                                                  if brush is not None:
                                                                                                                                                                                                                                                                                                                      g_item.setBrush(brush)
                                                                                                                                                                                                                                                                                                                  if pen is not None:
                                                                                                                                                                                                                                                                                                                      g_item.setPen(pen)
                                                                                                                                                                                                                                                                                                                  self.addItem(g_item)
                                                                                                                                                                                                                                                                                                                  return g_item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_text(
                                                                                                                                                                                                                                                                                                                  self, text: str, font: gui.QFont | None = None
                                                                                                                                                                                                                                                                                                              ) -> widgets.GraphicsTextItem:
                                                                                                                                                                                                                                                                                                                  g_item = widgets.GraphicsTextItem(text)
                                                                                                                                                                                                                                                                                                                  if font is not None:
                                                                                                                                                                                                                                                                                                                      g_item.setFont(font)
                                                                                                                                                                                                                                                                                                                  self.addItem(g_item)
                                                                                                                                                                                                                                                                                                                  return g_item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_simple_text(
                                                                                                                                                                                                                                                                                                                  self, text: str, font: gui.QFont | None = None
                                                                                                                                                                                                                                                                                                              ) -> widgets.GraphicsSimpleTextItem:
                                                                                                                                                                                                                                                                                                                  g_item = widgets.GraphicsSimpleTextItem(text)
                                                                                                                                                                                                                                                                                                                  if font is not None:
                                                                                                                                                                                                                                                                                                                      g_item.setFont(font)
                                                                                                                                                                                                                                                                                                                  self.addItem(g_item)
                                                                                                                                                                                                                                                                                                                  return g_item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_widget(self, widget: widgets.QWidget) -> widgets.GraphicsProxyWidget:
                                                                                                                                                                                                                                                                                                                  g_item = widgets.GraphicsProxyWidget()
                                                                                                                                                                                                                                                                                                                  g_item.setWidget(widget)
                                                                                                                                                                                                                                                                                                                  self.addItem(g_item)
                                                                                                                                                                                                                                                                                                                  return g_item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def colliding_items(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  item: widgets.QGraphicsItem,
                                                                                                                                                                                                                                                                                                                  mode: (
                                                                                                                                                                                                                                                                                                                      constants.ItemSelectionModeStr | constants.ItemSelectionMode
                                                                                                                                                                                                                                                                                                                  ) = "intersects_shape",
                                                                                                                                                                                                                                                                                                              ) -> listdelegators.ListDelegator[widgets.QGraphicsItem]:
                                                                                                                                                                                                                                                                                                                  items = self.collidingItems(item, constants.ITEM_SELECTION_MODE[mode])
                                                                                                                                                                                                                                                                                                                  return listdelegators.ListDelegator(items)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_item_group(self, *items: widgets.QGraphicsItem) -> widgets.GraphicsItemGroup:
                                                                                                                                                                                                                                                                                                                  group = widgets.GraphicsItemGroup()
                                                                                                                                                                                                                                                                                                                  for item in items:
                                                                                                                                                                                                                                                                                                                      group.addToGroup(item)
                                                                                                                                                                                                                                                                                                                  return group
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _draw_grid(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  painter: gui.QPainter,
                                                                                                                                                                                                                                                                                                                  rect: core.QRectF,
                                                                                                                                                                                                                                                                                                                  pen: gui.QPen,
                                                                                                                                                                                                                                                                                                                  grid_size: int,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  left = int(rect.left())
                                                                                                                                                                                                                                                                                                                  right = int(rect.right())
                                                                                                                                                                                                                                                                                                                  top = int(rect.top())
                                                                                                                                                                                                                                                                                                                  bottom = int(rect.bottom())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  first_left = left - (left % grid_size)
                                                                                                                                                                                                                                                                                                                  first_top = top - (top % grid_size)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  lines = [
                                                                                                                                                                                                                                                                                                                      core.QLineF(x, top, x, bottom) for x in range(first_left, right, grid_size)
                                                                                                                                                                                                                                                                                                                  ]
                                                                                                                                                                                                                                                                                                                  lines.extend([
                                                                                                                                                                                                                                                                                                                      core.QLineF(left, y, right, y) for y in range(first_top, bottom, grid_size)
                                                                                                                                                                                                                                                                                                                  ])
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  painter.setPen(pen)
                                                                                                                                                                                                                                                                                                                  painter.drawLines(lines)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _draw_dots(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  painter: gui.QPainter,
                                                                                                                                                                                                                                                                                                                  rect: core.QRectF,
                                                                                                                                                                                                                                                                                                                  pen: gui.QPen,
                                                                                                                                                                                                                                                                                                                  grid_size: int,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  if (zoom := self._get_viewer_zoom()) < 0:
                                                                                                                                                                                                                                                                                                                      grid_size *= int(abs(zoom) / 0.3 + 1)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  left = int(rect.left())
                                                                                                                                                                                                                                                                                                                  right = int(rect.right())
                                                                                                                                                                                                                                                                                                                  top = int(rect.top())
                                                                                                                                                                                                                                                                                                                  bottom = int(rect.bottom())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  first_left = left - (left % grid_size)
                                                                                                                                                                                                                                                                                                                  first_top = top - (top % grid_size)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  pen.setWidthF(grid_size / 10)
                                                                                                                                                                                                                                                                                                                  painter.setPen(pen)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  [
                                                                                                                                                                                                                                                                                                                      painter.drawPoint(int(x), int(y))
                                                                                                                                                                                                                                                                                                                      for x in range(first_left, right, grid_size)
                                                                                                                                                                                                                                                                                                                      for y in range(first_top, bottom, grid_size)
                                                                                                                                                                                                                                                                                                                  ]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def drawBackground(self, painter: gui.QPainter, rect: core.QRectF):
                                                                                                                                                                                                                                                                                                                  super().drawBackground(painter, rect)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  painter.save()
                                                                                                                                                                                                                                                                                                                  painter.setRenderHint(gui.QPainter.RenderHint.Antialiasing, False)
                                                                                                                                                                                                                                                                                                                  painter.setBrush(self.backgroundBrush())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  if self._grid_mode == self.GridType.DotGrid:
                                                                                                                                                                                                                                                                                                                      pen = gui.QPen(self.get_grid_color(), self._pen_width)
                                                                                                                                                                                                                                                                                                                      self._draw_dots(painter, rect, pen, self._grid_size)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  elif self._grid_mode == self.GridType.LineGrid:
                                                                                                                                                                                                                                                                                                                      zoom = self._get_viewer_zoom()
                                                                                                                                                                                                                                                                                                                      if zoom > -0.5:  # noqa: PLR2004
                                                                                                                                                                                                                                                                                                                          pen = gui.QPen(self.get_grid_color(), self._pen_width)
                                                                                                                                                                                                                                                                                                                          self._draw_grid(painter, rect, pen, self._grid_size)
                                                                                                                                                                                                                                                                                                                      color = self._bg_color.darker(150)
                                                                                                                                                                                                                                                                                                                      if zoom < 0:
                                                                                                                                                                                                                                                                                                                          color = color.darker(100 - int(zoom * 110))
                                                                                                                                                                                                                                                                                                                      pen = gui.QPen(color, self._pen_width)
                                                                                                                                                                                                                                                                                                                      self._draw_grid(painter, rect, pen, self._grid_size * 8)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  painter.restore()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_viewer_zoom(self):
                                                                                                                                                                                                                                                                                                                  viewer = self.viewer()
                                                                                                                                                                                                                                                                                                                  if viewer is None:
                                                                                                                                                                                                                                                                                                                      return 1.0
                                                                                                                                                                                                                                                                                                                  transform = viewer.transform()
                                                                                                                                                                                                                                                                                                                  cur_scale = (transform.m11(), transform.m22())
                                                                                                                                                                                                                                                                                                                  return float(f"{cur_scale[0] - 1.0:0.2f}")
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # def mousePressEvent(self, event):
                                                                                                                                                                                                                                                                                                              #     selected = self.viewer().selectedItems()
                                                                                                                                                                                                                                                                                                              #     if viewer := self.viewer():
                                                                                                                                                                                                                                                                                                              #         viewer.sceneMousePressEvent(event)
                                                                                                                                                                                                                                                                                                              #     super().mousePressEvent(event)
                                                                                                                                                                                                                                                                                                              #     keep_selection = any(
                                                                                                                                                                                                                                                                                                              #         [
                                                                                                                                                                                                                                                                                                              #             event.button() == core.Qt.MiddleButton,
                                                                                                                                                                                                                                                                                                              #             event.button() == core.Qt.RightButton,
                                                                                                                                                                                                                                                                                                              #             event.modifiers() == core.Qt.AltModifier,
                                                                                                                                                                                                                                                                                                              #         ]
                                                                                                                                                                                                                                                                                                              #     )
                                                                                                                                                                                                                                                                                                              #     if keep_selection:
                                                                                                                                                                                                                                                                                                              #         for node in selected:
                                                                                                                                                                                                                                                                                                              #             node.setSelected(True)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # def mouseMoveEvent(self, event):
                                                                                                                                                                                                                                                                                                              #     if viewer := self.viewer():
                                                                                                                                                                                                                                                                                                              #         viewer.sceneMouseMoveEvent(event)
                                                                                                                                                                                                                                                                                                              #     super().mouseMoveEvent(event)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # def mouseReleaseEvent(self, event):
                                                                                                                                                                                                                                                                                                              #     if viewer := self.viewer():
                                                                                                                                                                                                                                                                                                              #         viewer.sceneMouseReleaseEvent(event)
                                                                                                                                                                                                                                                                                                              #     super().mouseReleaseEvent(event)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def viewer(self):
                                                                                                                                                                                                                                                                                                                  return self.views()[0] if self.views() else None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_grid_mode(self) -> GridType:
                                                                                                                                                                                                                                                                                                                  return self._grid_mode
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_grid_mode(self, mode: GridType | None = None):
                                                                                                                                                                                                                                                                                                                  # alternative?
                                                                                                                                                                                                                                                                                                                  # brush = gui.Brush()
                                                                                                                                                                                                                                                                                                                  # brush.set_style("cross")
                                                                                                                                                                                                                                                                                                                  # scene.setBackgroundBrush(brush)
                                                                                                                                                                                                                                                                                                                  if mode is None:
                                                                                                                                                                                                                                                                                                                      mode = self.GridType.NoGrid
                                                                                                                                                                                                                                                                                                                  self._grid_mode = mode
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_grid_color(self) -> gui.Color:
                                                                                                                                                                                                                                                                                                                  return self._grid_color
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_grid_color(self, color: datatypes.ColorType):
                                                                                                                                                                                                                                                                                                                  self._grid_color = colors.get_color(color)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_background_color(self) -> gui.Color:
                                                                                                                                                                                                                                                                                                                  return self._bg_color
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_background_color(self, color: datatypes.ColorType):
                                                                                                                                                                                                                                                                                                                  self._bg_color = colors.get_color(color)
                                                                                                                                                                                                                                                                                                                  self.setBackgroundBrush(self._bg_color)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_item_index_method(
                                                                                                                                                                                                                                                                                                                  self, method: ItemIndexMethodStr | widgets.QGraphicsScene.ItemIndexMethod
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set item index method.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      method: item index method to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setItemIndexMethod(ITEM_INDEX_METHOD.get_enum_value(method))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_item_index_method(self) -> ItemIndexMethodStr:
                                                                                                                                                                                                                                                                                                                  """Return item index method.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      item index method
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return ITEM_INDEX_METHOD.inverse[self.itemIndexMethod()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              bg_color = core.Property(
                                                                                                                                                                                                                                                                                                                  gui.QColor,
                                                                                                                                                                                                                                                                                                                  get_background_color,
                                                                                                                                                                                                                                                                                                                  set_background_color,
                                                                                                                                                                                                                                                                                                                  doc="Color for the scene background",
                                                                                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                                                                                              grid_color = core.Property(
                                                                                                                                                                                                                                                                                                                  gui.QColor,
                                                                                                                                                                                                                                                                                                                  get_grid_color,
                                                                                                                                                                                                                                                                                                                  set_grid_color,
                                                                                                                                                                                                                                                                                                                  doc="Color for the grid",
                                                                                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                                                                                              grid_mode = core.Property(
                                                                                                                                                                                                                                                                                                                  int,
                                                                                                                                                                                                                                                                                                                  get_grid_mode,
                                                                                                                                                                                                                                                                                                                  set_grid_mode,
                                                                                                                                                                                                                                                                                                                  doc="Grid mode",
                                                                                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GridType

                                                                                                                                                                                                                                                                                                          Bases: IntEnum

                                                                                                                                                                                                                                                                                                          Grid type for background.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsscene.py
                                                                                                                                                                                                                                                                                                          class GridType(enum.IntEnum):
                                                                                                                                                                                                                                                                                                              """Grid type for background."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              NoGrid = 0
                                                                                                                                                                                                                                                                                                              DotGrid = 1
                                                                                                                                                                                                                                                                                                              LineGrid = 2
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_item_index_method() -> ItemIndexMethodStr

                                                                                                                                                                                                                                                                                                          Return item index method.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsscene.py
                                                                                                                                                                                                                                                                                                          def get_item_index_method(self) -> ItemIndexMethodStr:
                                                                                                                                                                                                                                                                                                              """Return item index method.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  item index method
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return ITEM_INDEX_METHOD.inverse[self.itemIndexMethod()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_item_index_method(method: ItemIndexMethodStr | widgets.QGraphicsScene.ItemIndexMethod)

                                                                                                                                                                                                                                                                                                          Set item index method.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          method ItemIndexMethodStr | ItemIndexMethod

                                                                                                                                                                                                                                                                                                          item index method to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsscene.py
                                                                                                                                                                                                                                                                                                          def set_item_index_method(
                                                                                                                                                                                                                                                                                                              self, method: ItemIndexMethodStr | widgets.QGraphicsScene.ItemIndexMethod
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set item index method.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  method: item index method to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setItemIndexMethod(ITEM_INDEX_METHOD.get_enum_value(method))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsSimpleTextItem

                                                                                                                                                                                                                                                                                                          Bases: AbstractGraphicsShapeItemMixin, QGraphicsSimpleTextItem

                                                                                                                                                                                                                                                                                                          Simple text path item that you can add to a QGraphicsScene.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicssimpletextitem.py
                                                                                                                                                                                                                                                                                                          class GraphicsSimpleTextItem(
                                                                                                                                                                                                                                                                                                              widgets.AbstractGraphicsShapeItemMixin, widgets.QGraphicsSimpleTextItem
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Simple text path item that you can add to a QGraphicsScene."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __repr__(self):
                                                                                                                                                                                                                                                                                                                  return get_repr(self, self.text())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsTextItem

                                                                                                                                                                                                                                                                                                          Bases: GraphicsObjectMixin, QGraphicsTextItem

                                                                                                                                                                                                                                                                                                          Text item that you can add to a QGraphicsScene to display formatted text.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicstextitem.py
                                                                                                                                                                                                                                                                                                          5
                                                                                                                                                                                                                                                                                                          6
                                                                                                                                                                                                                                                                                                          7
                                                                                                                                                                                                                                                                                                          8
                                                                                                                                                                                                                                                                                                          9
                                                                                                                                                                                                                                                                                                          class GraphicsTextItem(widgets.GraphicsObjectMixin, widgets.QGraphicsTextItem):
                                                                                                                                                                                                                                                                                                              """Text item that you can add to a QGraphicsScene to display formatted text."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __repr__(self):
                                                                                                                                                                                                                                                                                                                  return get_repr(self, self.toPlainText())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsTransform

                                                                                                                                                                                                                                                                                                          Bases: GraphicsTransformMixin, QGraphicsTransform

                                                                                                                                                                                                                                                                                                          Abstract base class for building advanced transformations on QGraphicsItems.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicstransform.py
                                                                                                                                                                                                                                                                                                          class GraphicsTransform(GraphicsTransformMixin, QtWidgets.QGraphicsTransform):
                                                                                                                                                                                                                                                                                                              """Abstract base class for building advanced transformations on QGraphicsItems."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsView

                                                                                                                                                                                                                                                                                                          Bases: GraphicsViewMixin, QGraphicsView

                                                                                                                                                                                                                                                                                                          Widget for displaying the contents of a QGraphicsScene.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          class GraphicsView(GraphicsViewMixin, widgets.QGraphicsView):
                                                                                                                                                                                                                                                                                                              """Widget for displaying the contents of a QGraphicsScene."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsViewMixin

                                                                                                                                                                                                                                                                                                          Bases: AbstractScrollAreaMixin, _GraphicsViewBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          class GraphicsViewMixin(widgets.AbstractScrollAreaMixin, _GraphicsViewBase):
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  if not args or not isinstance(args[0], widgets.QGraphicsScene):
                                                                                                                                                                                                                                                                                                                      self.setScene(widgets.GraphicsScene())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "alignment": constants.ALIGNMENTS,
                                                                                                                                                                                                                                                                                                                      "resizeAnchor": VIEWPORT_ANCHOR,
                                                                                                                                                                                                                                                                                                                      "transformationAnchor": VIEWPORT_ANCHOR,
                                                                                                                                                                                                                                                                                                                      "cacheMode": CACHE_MODES,
                                                                                                                                                                                                                                                                                                                      "dragMode": DRAG_MODE,
                                                                                                                                                                                                                                                                                                                      "viewportUpdateMode": VIEWPORT_UPDATE_MODE,
                                                                                                                                                                                                                                                                                                                      "rubberBandSelectionMode": constants.ITEM_SELECTION_MODE,
                                                                                                                                                                                                                                                                                                                      "renderHints": gui.painter.RENDER_HINTS,
                                                                                                                                                                                                                                                                                                                      "optimizationFlags": OPTIMIZATION_FLAGS,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def enable_mousewheel_zoom(self, state: bool = True):
                                                                                                                                                                                                                                                                                                                  if state:
                                                                                                                                                                                                                                                                                                                      self.viewport().installEventFilter(self)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.viewport().removeEventFilter(self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(self, index: int) -> widgets.QGraphicsItem:
                                                                                                                                                                                                                                                                                                                  return self.items()[index]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def eventFilter(self, source, event) -> bool:
                                                                                                                                                                                                                                                                                                                  if source is not self.viewport() or event.type() != event.Type.Wheel:
                                                                                                                                                                                                                                                                                                                      return super().eventFilter(source, event)
                                                                                                                                                                                                                                                                                                                  # Zoom Factor
                                                                                                                                                                                                                                                                                                                  zoom_in_factor = 1.25
                                                                                                                                                                                                                                                                                                                  zoom_out_factor = 1 / zoom_in_factor
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  # Set Anchors
                                                                                                                                                                                                                                                                                                                  self.setTransformationAnchor(self.ViewportAnchor.NoAnchor)
                                                                                                                                                                                                                                                                                                                  self.setResizeAnchor(self.ViewportAnchor.NoAnchor)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  # Save the scene pos
                                                                                                                                                                                                                                                                                                                  old_pos = self.mapToScene(event.position().toPoint())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  # Zoom
                                                                                                                                                                                                                                                                                                                  zoom_factor = zoom_in_factor if event.angleDelta().y() > 0 else zoom_out_factor
                                                                                                                                                                                                                                                                                                                  self.scale(zoom_factor, zoom_factor)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  # # Get the new position
                                                                                                                                                                                                                                                                                                                  new_pos = self.mapToScene(event.position().toPoint())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  # Move scene to old position
                                                                                                                                                                                                                                                                                                                  delta = new_pos - old_pos
                                                                                                                                                                                                                                                                                                                  self.translate(delta.x(), delta.y())
                                                                                                                                                                                                                                                                                                                  return True
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_zoom(self) -> float:
                                                                                                                                                                                                                                                                                                                  """Return the viewer zoom level.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      float: zoom level.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  transform = self.transform()
                                                                                                                                                                                                                                                                                                                  cur_scale = (transform.m11(), transform.m22())
                                                                                                                                                                                                                                                                                                                  return float(f"{cur_scale[0] - 1.0:0.2f}")
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_item(self, *args):
                                                                                                                                                                                                                                                                                                                  return self.scene().addItem(*args)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def remove_item(self, *args):
                                                                                                                                                                                                                                                                                                                  return self.scene().removeItem(*args)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_view_rect(self) -> core.QRectF:
                                                                                                                                                                                                                                                                                                                  """Return the boundaries of the view in scene coordinates."""
                                                                                                                                                                                                                                                                                                                  r = core.QRectF(self.rect())
                                                                                                                                                                                                                                                                                                                  return self.viewportTransform().inverted()[0].mapRect(r)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_pixel_size(self):
                                                                                                                                                                                                                                                                                                                  """Return vector with length and width of one view pixel in scene coordinates."""
                                                                                                                                                                                                                                                                                                                  p0 = core.PointF(0, 0)
                                                                                                                                                                                                                                                                                                                  p1 = core.PointF(1, 1)
                                                                                                                                                                                                                                                                                                                  tr = self.transform().inverted()[0]
                                                                                                                                                                                                                                                                                                                  p01 = tr.map(p0)
                                                                                                                                                                                                                                                                                                                  p11 = tr.map(p1)
                                                                                                                                                                                                                                                                                                                  return core.PointF(p11 - p01)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_background_brush(self) -> gui.Brush:
                                                                                                                                                                                                                                                                                                                  return gui.Brush(self.backgroundBrush())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_foreground_brush(self) -> gui.Brush:
                                                                                                                                                                                                                                                                                                                  return gui.Brush(self.foregroundBrush())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def invalidate_scene(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  rect: core.QRectF,
                                                                                                                                                                                                                                                                                                                  layer: widgets.graphicsscene.SceneLayerStr
                                                                                                                                                                                                                                                                                                                  | widgets.QGraphicsScene.SceneLayer = "all",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  self.invalidateScene(
                                                                                                                                                                                                                                                                                                                      rect, widgets.graphicsscene.SCENE_LAYER.get_enum_value(layer)
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_transformation_anchor(self, mode: ViewportAnchorStr | mod.ViewportAnchor):
                                                                                                                                                                                                                                                                                                                  """Set how the view should position the scene during transformations.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: transformation anchor to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setTransformationAnchor(VIEWPORT_ANCHOR.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_transformation_anchor(self) -> ViewportAnchorStr:
                                                                                                                                                                                                                                                                                                                  """Return current transformation anchor.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      viewport anchor
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return VIEWPORT_ANCHOR.inverse[self.transformationAnchor()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_transform(self, transform: datatypes.TransformType, combine: bool = False):
                                                                                                                                                                                                                                                                                                                  self.setTransform(datatypes.to_transform(transform), combine)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_resize_anchor(self, mode: ViewportAnchorStr | mod.ViewportAnchor):
                                                                                                                                                                                                                                                                                                                  """Set how the view should position the scene during resizes.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: resize anchor to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setResizeAnchor(VIEWPORT_ANCHOR.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_resize_anchor(self) -> ViewportAnchorStr:
                                                                                                                                                                                                                                                                                                                  """Return current resize anchor.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      resize anchor
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return VIEWPORT_ANCHOR.inverse[self.resizeAnchor()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_viewport_update_mode(
                                                                                                                                                                                                                                                                                                                  self, mode: ViewportUpdateModeStr | mod.ViewportUpdateMode
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set how the viewport should update its contents.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: viewport update mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setViewportUpdateMode(VIEWPORT_UPDATE_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_viewport_update_mode(self) -> ViewportUpdateModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current viewport update mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      viewport update mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return VIEWPORT_UPDATE_MODE.inverse[self.viewportUpdateMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_drag_mode(self, mode: DragModeStr | mod.DragMode):
                                                                                                                                                                                                                                                                                                                  """Set the behavior for dragging the mouse while the left mouse button is pressed.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: drag mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setDragMode(DRAG_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_drag_mode(self) -> DragModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current drag mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      drag mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return DRAG_MODE.inverse[self.dragMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_rubberband_selection_mode(
                                                                                                                                                                                                                                                                                                                  self, mode: constants.ItemSelectionModeStr | constants.ItemSelectionMode
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the behavior for selecting items with a rubber band selection rectangle.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: rubberband selection mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setRubberBandSelectionMode(
                                                                                                                                                                                                                                                                                                                      constants.ITEM_SELECTION_MODE.get_enum_value(mode)
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_rubberband_selection_mode(self) -> constants.ItemSelectionModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current rubberband selection mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      rubberband selection mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.ITEM_SELECTION_MODE.inverse[self.rubberBandSelectionMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_cache_mode(self, mode: CacheModeStr | mod.CacheModeFlag):
                                                                                                                                                                                                                                                                                                                  """Set the cache mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: cache mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setCacheMode(CACHE_MODES.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_cache_mode(self) -> CacheModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current cache mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      cache mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return CACHE_MODES.inverse[self.cacheMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_optimization_flags(self, *items: OptimizationFlagStr):
                                                                                                                                                                                                                                                                                                                  flags = OPTIMIZATION_FLAGS.merge_flags(items)
                                                                                                                                                                                                                                                                                                                  self.setOptimizationFlags(flags)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_optimization_flags(self) -> list[OptimizationFlagStr]:
                                                                                                                                                                                                                                                                                                                  return OPTIMIZATION_FLAGS.get_list(self.optimizationFlags())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_cache_mode() -> CacheModeStr

                                                                                                                                                                                                                                                                                                          Return current cache mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          def get_cache_mode(self) -> CacheModeStr:
                                                                                                                                                                                                                                                                                                              """Return current cache mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  cache mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return CACHE_MODES.inverse[self.cacheMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_drag_mode() -> DragModeStr

                                                                                                                                                                                                                                                                                                          Return current drag mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          def get_drag_mode(self) -> DragModeStr:
                                                                                                                                                                                                                                                                                                              """Return current drag mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  drag mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return DRAG_MODE.inverse[self.dragMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_pixel_size()

                                                                                                                                                                                                                                                                                                          Return vector with length and width of one view pixel in scene coordinates.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          def get_pixel_size(self):
                                                                                                                                                                                                                                                                                                              """Return vector with length and width of one view pixel in scene coordinates."""
                                                                                                                                                                                                                                                                                                              p0 = core.PointF(0, 0)
                                                                                                                                                                                                                                                                                                              p1 = core.PointF(1, 1)
                                                                                                                                                                                                                                                                                                              tr = self.transform().inverted()[0]
                                                                                                                                                                                                                                                                                                              p01 = tr.map(p0)
                                                                                                                                                                                                                                                                                                              p11 = tr.map(p1)
                                                                                                                                                                                                                                                                                                              return core.PointF(p11 - p01)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_resize_anchor() -> ViewportAnchorStr

                                                                                                                                                                                                                                                                                                          Return current resize anchor.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          def get_resize_anchor(self) -> ViewportAnchorStr:
                                                                                                                                                                                                                                                                                                              """Return current resize anchor.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  resize anchor
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return VIEWPORT_ANCHOR.inverse[self.resizeAnchor()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_rubberband_selection_mode() -> constants.ItemSelectionModeStr

                                                                                                                                                                                                                                                                                                          Return current rubberband selection mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          def get_rubberband_selection_mode(self) -> constants.ItemSelectionModeStr:
                                                                                                                                                                                                                                                                                                              """Return current rubberband selection mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  rubberband selection mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.ITEM_SELECTION_MODE.inverse[self.rubberBandSelectionMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_transformation_anchor() -> ViewportAnchorStr

                                                                                                                                                                                                                                                                                                          Return current transformation anchor.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          def get_transformation_anchor(self) -> ViewportAnchorStr:
                                                                                                                                                                                                                                                                                                              """Return current transformation anchor.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  viewport anchor
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return VIEWPORT_ANCHOR.inverse[self.transformationAnchor()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_view_rect() -> core.QRectF

                                                                                                                                                                                                                                                                                                          Return the boundaries of the view in scene coordinates.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          def get_view_rect(self) -> core.QRectF:
                                                                                                                                                                                                                                                                                                              """Return the boundaries of the view in scene coordinates."""
                                                                                                                                                                                                                                                                                                              r = core.QRectF(self.rect())
                                                                                                                                                                                                                                                                                                              return self.viewportTransform().inverted()[0].mapRect(r)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_viewport_update_mode() -> ViewportUpdateModeStr

                                                                                                                                                                                                                                                                                                          Return current viewport update mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          def get_viewport_update_mode(self) -> ViewportUpdateModeStr:
                                                                                                                                                                                                                                                                                                              """Return current viewport update mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  viewport update mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return VIEWPORT_UPDATE_MODE.inverse[self.viewportUpdateMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_zoom() -> float

                                                                                                                                                                                                                                                                                                          Return the viewer zoom level.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          def get_zoom(self) -> float:
                                                                                                                                                                                                                                                                                                              """Return the viewer zoom level.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  float: zoom level.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              transform = self.transform()
                                                                                                                                                                                                                                                                                                              cur_scale = (transform.m11(), transform.m22())
                                                                                                                                                                                                                                                                                                              return float(f"{cur_scale[0] - 1.0:0.2f}")
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_cache_mode(mode: CacheModeStr | mod.CacheModeFlag)

                                                                                                                                                                                                                                                                                                          Set the cache mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode CacheModeStr | CacheModeFlag

                                                                                                                                                                                                                                                                                                          cache mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          def set_cache_mode(self, mode: CacheModeStr | mod.CacheModeFlag):
                                                                                                                                                                                                                                                                                                              """Set the cache mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: cache mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setCacheMode(CACHE_MODES.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_drag_mode(mode: DragModeStr | mod.DragMode)

                                                                                                                                                                                                                                                                                                          Set the behavior for dragging the mouse while the left mouse button is pressed.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode DragModeStr | DragMode

                                                                                                                                                                                                                                                                                                          drag mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          def set_drag_mode(self, mode: DragModeStr | mod.DragMode):
                                                                                                                                                                                                                                                                                                              """Set the behavior for dragging the mouse while the left mouse button is pressed.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: drag mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setDragMode(DRAG_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_resize_anchor(mode: ViewportAnchorStr | mod.ViewportAnchor)

                                                                                                                                                                                                                                                                                                          Set how the view should position the scene during resizes.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ViewportAnchorStr | ViewportAnchor

                                                                                                                                                                                                                                                                                                          resize anchor to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          def set_resize_anchor(self, mode: ViewportAnchorStr | mod.ViewportAnchor):
                                                                                                                                                                                                                                                                                                              """Set how the view should position the scene during resizes.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: resize anchor to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setResizeAnchor(VIEWPORT_ANCHOR.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_rubberband_selection_mode(mode: constants.ItemSelectionModeStr | constants.ItemSelectionMode)

                                                                                                                                                                                                                                                                                                          Set the behavior for selecting items with a rubber band selection rectangle.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ItemSelectionModeStr | ItemSelectionMode

                                                                                                                                                                                                                                                                                                          rubberband selection mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          def set_rubberband_selection_mode(
                                                                                                                                                                                                                                                                                                              self, mode: constants.ItemSelectionModeStr | constants.ItemSelectionMode
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the behavior for selecting items with a rubber band selection rectangle.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: rubberband selection mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setRubberBandSelectionMode(
                                                                                                                                                                                                                                                                                                                  constants.ITEM_SELECTION_MODE.get_enum_value(mode)
                                                                                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_transformation_anchor(mode: ViewportAnchorStr | mod.ViewportAnchor)

                                                                                                                                                                                                                                                                                                          Set how the view should position the scene during transformations.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ViewportAnchorStr | ViewportAnchor

                                                                                                                                                                                                                                                                                                          transformation anchor to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          def set_transformation_anchor(self, mode: ViewportAnchorStr | mod.ViewportAnchor):
                                                                                                                                                                                                                                                                                                              """Set how the view should position the scene during transformations.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: transformation anchor to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setTransformationAnchor(VIEWPORT_ANCHOR.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_viewport_update_mode(mode: ViewportUpdateModeStr | mod.ViewportUpdateMode)

                                                                                                                                                                                                                                                                                                          Set how the viewport should update its contents.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ViewportUpdateModeStr | ViewportUpdateMode

                                                                                                                                                                                                                                                                                                          viewport update mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicsview.py
                                                                                                                                                                                                                                                                                                          def set_viewport_update_mode(
                                                                                                                                                                                                                                                                                                              self, mode: ViewportUpdateModeStr | mod.ViewportUpdateMode
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set how the viewport should update its contents.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: viewport update mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setViewportUpdateMode(VIEWPORT_UPDATE_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsWidget

                                                                                                                                                                                                                                                                                                          Bases: GraphicsWidgetMixin, QGraphicsWidget

                                                                                                                                                                                                                                                                                                          The base class for all widget items in a QGraphicsScene.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicswidget.py
                                                                                                                                                                                                                                                                                                          class GraphicsWidget(GraphicsWidgetMixin, widgets.QGraphicsWidget):
                                                                                                                                                                                                                                                                                                              """The base class for all widget items in a QGraphicsScene."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GraphicsWidgetMixin

                                                                                                                                                                                                                                                                                                          Bases: GraphicsObjectMixin, GraphicsLayoutItemMixin, _GraphicsWidgetBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicswidget.py
                                                                                                                                                                                                                                                                                                          class GraphicsWidgetMixin(
                                                                                                                                                                                                                                                                                                              widgets.GraphicsObjectMixin, widgets.GraphicsLayoutItemMixin, _GraphicsWidgetBase
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              @property
                                                                                                                                                                                                                                                                                                              def box(self):
                                                                                                                                                                                                                                                                                                                  return self.layout()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @box.setter
                                                                                                                                                                                                                                                                                                              def box(self, layout):
                                                                                                                                                                                                                                                                                                                  self.set_layout(layout)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_layout(
                                                                                                                                                                                                                                                                                                                  self, layout: LayoutStr | widgets.QGraphicsLayout
                                                                                                                                                                                                                                                                                                              ) -> widgets.QGraphicsLayout:
                                                                                                                                                                                                                                                                                                                  match layout:
                                                                                                                                                                                                                                                                                                                      case widgets.QGraphicsLayout():
                                                                                                                                                                                                                                                                                                                          layout = layout
                                                                                                                                                                                                                                                                                                                      case "grid":
                                                                                                                                                                                                                                                                                                                          layout = widgets.GraphicsGridLayout()
                                                                                                                                                                                                                                                                                                                      case "anchor":
                                                                                                                                                                                                                                                                                                                          layout = widgets.GraphicsAnchorLayout()
                                                                                                                                                                                                                                                                                                                      case "horizontal" | "vertical":
                                                                                                                                                                                                                                                                                                                          layout = widgets.GraphicsLinearLayout(layout)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          msg = f"Invalid Layout {layout}"
                                                                                                                                                                                                                                                                                                                          raise ValueError(msg)
                                                                                                                                                                                                                                                                                                                  self.setLayout(layout)
                                                                                                                                                                                                                                                                                                                  return layout
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_focus_policy(self, policy: constants.FocusPolicyStr | constants.FocusPolicy):
                                                                                                                                                                                                                                                                                                                  """Set the way the widget accepts keyboard focus.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      policy: Focus policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setFocusPolicy(constants.FOCUS_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_focus_policy(self) -> constants.FocusPolicyStr:
                                                                                                                                                                                                                                                                                                                  """Return way the widget accepts keyboard focus.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      str: Focus policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.FOCUS_POLICY.inverse[self.focusPolicy()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def window_frame_section_at(
                                                                                                                                                                                                                                                                                                                  self, point: datatypes.PointType
                                                                                                                                                                                                                                                                                                              ) -> constants.WindowFrameSectionStr:
                                                                                                                                                                                                                                                                                                                  """Return the window frame section at given position.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      str: Window frame section
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  section = self.windowFrameSectionAt(datatypes.to_point(point))
                                                                                                                                                                                                                                                                                                                  return constants.WINDOW_FRAME_SECTION.inverse[section]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_font(self) -> gui.Font:
                                                                                                                                                                                                                                                                                                                  return gui.Font(self.font())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_palette(self) -> gui.Palette:
                                                                                                                                                                                                                                                                                                                  return gui.Palette(self.palette())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_focus_policy() -> constants.FocusPolicyStr

                                                                                                                                                                                                                                                                                                          Return way the widget accepts keyboard focus.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicswidget.py
                                                                                                                                                                                                                                                                                                          def get_focus_policy(self) -> constants.FocusPolicyStr:
                                                                                                                                                                                                                                                                                                              """Return way the widget accepts keyboard focus.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  str: Focus policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.FOCUS_POLICY.inverse[self.focusPolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_focus_policy(policy: constants.FocusPolicyStr | constants.FocusPolicy)

                                                                                                                                                                                                                                                                                                          Set the way the widget accepts keyboard focus.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          policy FocusPolicyStr | FocusPolicy

                                                                                                                                                                                                                                                                                                          Focus policy

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicswidget.py
                                                                                                                                                                                                                                                                                                          def set_focus_policy(self, policy: constants.FocusPolicyStr | constants.FocusPolicy):
                                                                                                                                                                                                                                                                                                              """Set the way the widget accepts keyboard focus.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  policy: Focus policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setFocusPolicy(constants.FOCUS_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          window_frame_section_at(point: datatypes.PointType) -> constants.WindowFrameSectionStr

                                                                                                                                                                                                                                                                                                          Return the window frame section at given position.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/graphicswidget.py
                                                                                                                                                                                                                                                                                                          def window_frame_section_at(
                                                                                                                                                                                                                                                                                                              self, point: datatypes.PointType
                                                                                                                                                                                                                                                                                                          ) -> constants.WindowFrameSectionStr:
                                                                                                                                                                                                                                                                                                              """Return the window frame section at given position.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  str: Window frame section
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              section = self.windowFrameSectionAt(datatypes.to_point(point))
                                                                                                                                                                                                                                                                                                              return constants.WINDOW_FRAME_SECTION.inverse[section]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GridLayout

                                                                                                                                                                                                                                                                                                          Bases: LayoutMixin, QGridLayout

                                                                                                                                                                                                                                                                                                          Lays out widgets in a grid.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/gridlayout.py
                                                                                                                                                                                                                                                                                                          class GridLayout(widgets.LayoutMixin, widgets.QGridLayout):
                                                                                                                                                                                                                                                                                                              """Lays out widgets in a grid."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              ID = "grid"
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(
                                                                                                                                                                                                                                                                                                                  self, index: tuple[int | slice, int | slice] | int | str
                                                                                                                                                                                                                                                                                                              ) -> (
                                                                                                                                                                                                                                                                                                                  widgets.QWidget
                                                                                                                                                                                                                                                                                                                  | widgets.QLayout
                                                                                                                                                                                                                                                                                                                  | listdelegators.ListDelegator[widgets.QWidget | widgets.QLayout]
                                                                                                                                                                                                                                                                                                                  | None
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  rowcount = self.rowCount()
                                                                                                                                                                                                                                                                                                                  colcount = self.columnCount()
                                                                                                                                                                                                                                                                                                                  match index:
                                                                                                                                                                                                                                                                                                                      case int() as row, int() as col:
                                                                                                                                                                                                                                                                                                                          if row < 0:
                                                                                                                                                                                                                                                                                                                              row = rowcount + row
                                                                                                                                                                                                                                                                                                                          if col < 0:
                                                                                                                                                                                                                                                                                                                              col = colcount + col
                                                                                                                                                                                                                                                                                                                          if row >= rowcount or row < 0 or col >= colcount or col < 0:
                                                                                                                                                                                                                                                                                                                              raise IndexError(index)
                                                                                                                                                                                                                                                                                                                          if (item := self.itemAtPosition(row, col)) is None:
                                                                                                                                                                                                                                                                                                                              raise IndexError(index)
                                                                                                                                                                                                                                                                                                                          return i if (i := item.widget()) is not None else item.layout()
                                                                                                                                                                                                                                                                                                                      case (int() | slice() as row, int() | slice() as col):
                                                                                                                                                                                                                                                                                                                          items = [
                                                                                                                                                                                                                                                                                                                              item
                                                                                                                                                                                                                                                                                                                              for i, j in helpers.iter_positions(row, col, rowcount, colcount)
                                                                                                                                                                                                                                                                                                                              if (item := self.itemAtPosition(i, j)) is not None
                                                                                                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                                                                                                          items = [
                                                                                                                                                                                                                                                                                                                              w if (w := i.widget()) is not None else i.layout() for i in items
                                                                                                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                                                                                                          return listdelegators.ListDelegator(list(set(items)))
                                                                                                                                                                                                                                                                                                                      case int() as row:
                                                                                                                                                                                                                                                                                                                          if row < 0:
                                                                                                                                                                                                                                                                                                                              row = rowcount + row
                                                                                                                                                                                                                                                                                                                          if row >= rowcount or row < 0:
                                                                                                                                                                                                                                                                                                                              raise IndexError(index)
                                                                                                                                                                                                                                                                                                                          if (item := self.itemAt(row)) is None:
                                                                                                                                                                                                                                                                                                                              raise IndexError(index)
                                                                                                                                                                                                                                                                                                                          return i if (i := item.widget()) is not None else item.layout()
                                                                                                                                                                                                                                                                                                                      case slice() as rowslice:
                                                                                                                                                                                                                                                                                                                          items = [
                                                                                                                                                                                                                                                                                                                              item
                                                                                                                                                                                                                                                                                                                              for i in range(*rowslice.indices(self.count()))
                                                                                                                                                                                                                                                                                                                              if (item := self.itemAt(i)) is not None
                                                                                                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                                                                                                          items = [
                                                                                                                                                                                                                                                                                                                              w if (w := i.widget()) is not None else i.layout() for i in items
                                                                                                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                                                                                                          return listdelegators.ListDelegator(list(set(items)))
                                                                                                                                                                                                                                                                                                                      case str():
                                                                                                                                                                                                                                                                                                                          return self.find_child(widgets.QWidget | widgets.QLayout, index)  # ty: ignore[invalid-argument-type]  # unions work at runtime
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise TypeError(index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __setitem__(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  idx: tuple[int | slice, int | slice],
                                                                                                                                                                                                                                                                                                                  value: widgets.QWidget | widgets.QLayout | widgets.QLayoutItem,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  row, col = idx
                                                                                                                                                                                                                                                                                                                  rowspan = row.stop - row.start + 1 if isinstance(row, slice) else 1
                                                                                                                                                                                                                                                                                                                  colspan = col.stop - col.start + 1 if isinstance(col, slice) else 1
                                                                                                                                                                                                                                                                                                                  rowstart = row.start if isinstance(row, slice) else row
                                                                                                                                                                                                                                                                                                                  colstart = col.start if isinstance(col, slice) else col
                                                                                                                                                                                                                                                                                                                  self.add(value, rowstart, colstart, rowspan, colspan)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # def __setstate__(self, state):
                                                                                                                                                                                                                                                                                                              #     for item, pos in zip(state["widgets"], state["positions"]):
                                                                                                                                                                                                                                                                                                              #         x, y, w, h = pos
                                                                                                                                                                                                                                                                                                              #         self[x : x + w - 1, y : y + h - 1] = item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # def __reduce__(self):
                                                                                                                                                                                                                                                                                                              #     return type(self), (), self.__getstate__()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __iter__(self) -> Iterator[widgets.QWidget | widgets.QLayout | None]:
                                                                                                                                                                                                                                                                                                                  return iter(
                                                                                                                                                                                                                                                                                                                      w if (w := item.widget()) is not None else item.layout()
                                                                                                                                                                                                                                                                                                                      for i in range(self.count())
                                                                                                                                                                                                                                                                                                                      if (item := self.itemAt(i)) is not None
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __add__(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  other: (tuple | list | widgets.QWidget | widgets.QLayout | widgets.QLayoutItem),
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  if isinstance(other, tuple | list):
                                                                                                                                                                                                                                                                                                                      row = self.rowCount()
                                                                                                                                                                                                                                                                                                                      for i, control in enumerate(other):
                                                                                                                                                                                                                                                                                                                          self[row, i] = control
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self[self.rowCount(), 0 : self.columnCount() - 1] = other
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __iadd__(self, item, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  self.__add__(item, *args, **kwargs)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  item: widgets.QWidget | widgets.QLayout | widgets.QLayoutItem,
                                                                                                                                                                                                                                                                                                                  rowstart: int,
                                                                                                                                                                                                                                                                                                                  colstart: int,
                                                                                                                                                                                                                                                                                                                  rowspan: int = 1,
                                                                                                                                                                                                                                                                                                                  colspan: int = 1,
                                                                                                                                                                                                                                                                                                                  alignment: constants.AlignmentStr | constants.AlignmentFlag | None = None,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  if alignment is None:
                                                                                                                                                                                                                                                                                                                      alignment = "none"
                                                                                                                                                                                                                                                                                                                  flag = constants.ALIGNMENTS.get_enum_value(alignment)
                                                                                                                                                                                                                                                                                                                  match item:
                                                                                                                                                                                                                                                                                                                      case widgets.QWidget():
                                                                                                                                                                                                                                                                                                                          self.addWidget(item, rowstart, colstart, rowspan, colspan, flag)
                                                                                                                                                                                                                                                                                                                      case widgets.QLayout():
                                                                                                                                                                                                                                                                                                                          self.addLayout(item, rowstart, colstart, rowspan, colspan, flag)
                                                                                                                                                                                                                                                                                                                      case widgets.QLayoutItem():
                                                                                                                                                                                                                                                                                                                          self.addItem(item, rowstart, colstart, rowspan, colspan, flag)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def append(self, item: widgets.QWidget | widgets.QLayout | widgets.QLayoutItem):
                                                                                                                                                                                                                                                                                                                  self[self.rowCount(), 0 : self.columnCount() - 1] = item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_origin_corner(self, corner: constants.CornerStr | constants.Corner):
                                                                                                                                                                                                                                                                                                                  """Set the origin corner.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      corner: origin corner
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setOriginCorner(constants.CORNER.get_enum_value(corner))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_origin_corner(self) -> constants.CornerStr:
                                                                                                                                                                                                                                                                                                                  """Return current origin corner.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      origin corner
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.CORNER.inverse[self.originCorner()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_origin_corner() -> constants.CornerStr

                                                                                                                                                                                                                                                                                                          Return current origin corner.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/gridlayout.py
                                                                                                                                                                                                                                                                                                          def get_origin_corner(self) -> constants.CornerStr:
                                                                                                                                                                                                                                                                                                              """Return current origin corner.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  origin corner
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.CORNER.inverse[self.originCorner()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_origin_corner(corner: constants.CornerStr | constants.Corner)

                                                                                                                                                                                                                                                                                                          Set the origin corner.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          corner CornerStr | Corner

                                                                                                                                                                                                                                                                                                          origin corner

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/gridlayout.py
                                                                                                                                                                                                                                                                                                          def set_origin_corner(self, corner: constants.CornerStr | constants.Corner):
                                                                                                                                                                                                                                                                                                              """Set the origin corner.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  corner: origin corner
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setOriginCorner(constants.CORNER.get_enum_value(corner))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          GroupBox

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QGroupBox

                                                                                                                                                                                                                                                                                                          Group box frame with a title.

                                                                                                                                                                                                                                                                                                          A group box provides a frame, a title on top, a keyboard shortcut, and displays various other widgets inside itself. The keyboard shortcut moves keyboard focus to one of the group box's child widgets.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/groupbox.py
                                                                                                                                                                                                                                                                                                          class GroupBox(widgets.WidgetMixin, widgets.QGroupBox):
                                                                                                                                                                                                                                                                                                              """Group box frame with a title.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              A group box provides a frame, a title on top, a keyboard shortcut,
                                                                                                                                                                                                                                                                                                              and displays various other widgets inside itself.
                                                                                                                                                                                                                                                                                                              The keyboard shortcut moves keyboard focus to one of the group box's child widgets.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __repr__(self):
                                                                                                                                                                                                                                                                                                                  return get_repr(self, self.title())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_title(self, title: str):
                                                                                                                                                                                                                                                                                                                  self.setTitle(title)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_alignment(
                                                                                                                                                                                                                                                                                                                  self, alignment: constants.HorizontalAlignmentStr | constants.AlignmentFlag
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the title alignment of the groupbox.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      alignment: title alignment for the groupbox
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setAlignment(constants.H_ALIGNMENT.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_alignment(self) -> constants.HorizontalAlignmentStr:
                                                                                                                                                                                                                                                                                                                  """Return current title alignment.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      title alignment
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.H_ALIGNMENT.inverse[self.alignment()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_enabled(self, state):
                                                                                                                                                                                                                                                                                                                  if (layout := self.layout()) is None:
                                                                                                                                                                                                                                                                                                                      return
                                                                                                                                                                                                                                                                                                                  for i in range(layout.count()):
                                                                                                                                                                                                                                                                                                                      if (item := layout.itemAt(i)) is not None and (
                                                                                                                                                                                                                                                                                                                          w := item.widget()
                                                                                                                                                                                                                                                                                                                      ) is not None:
                                                                                                                                                                                                                                                                                                                          w.setEnabled(state)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_alignment() -> constants.HorizontalAlignmentStr

                                                                                                                                                                                                                                                                                                          Return current title alignment.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/groupbox.py
                                                                                                                                                                                                                                                                                                          def get_alignment(self) -> constants.HorizontalAlignmentStr:
                                                                                                                                                                                                                                                                                                              """Return current title alignment.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  title alignment
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.H_ALIGNMENT.inverse[self.alignment()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_alignment(alignment: constants.HorizontalAlignmentStr | constants.AlignmentFlag)

                                                                                                                                                                                                                                                                                                          Set the title alignment of the groupbox.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          alignment HorizontalAlignmentStr | AlignmentFlag

                                                                                                                                                                                                                                                                                                          title alignment for the groupbox

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/groupbox.py
                                                                                                                                                                                                                                                                                                          def set_alignment(
                                                                                                                                                                                                                                                                                                              self, alignment: constants.HorizontalAlignmentStr | constants.AlignmentFlag
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the title alignment of the groupbox.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  alignment: title alignment for the groupbox
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setAlignment(constants.H_ALIGNMENT.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          HBoxLayout

                                                                                                                                                                                                                                                                                                          Bases: BoxLayoutMixin, QHBoxLayout

                                                                                                                                                                                                                                                                                                          Lines up widgets horizontally.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/hboxlayout.py
                                                                                                                                                                                                                                                                                                          4
                                                                                                                                                                                                                                                                                                          5
                                                                                                                                                                                                                                                                                                          6
                                                                                                                                                                                                                                                                                                          7
                                                                                                                                                                                                                                                                                                          class HBoxLayout(widgets.boxlayout.BoxLayoutMixin, widgets.QHBoxLayout):
                                                                                                                                                                                                                                                                                                              """Lines up widgets horizontally."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              ID = "horizontal"
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          HeaderView

                                                                                                                                                                                                                                                                                                          Bases: HeaderViewMixin, QHeaderView

                                                                                                                                                                                                                                                                                                          Header row or header column for item views.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/headerview.py
                                                                                                                                                                                                                                                                                                          class HeaderView(HeaderViewMixin, widgets.QHeaderView):
                                                                                                                                                                                                                                                                                                              """Header row or header column for item views."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          InputDialog

                                                                                                                                                                                                                                                                                                          Bases: DialogMixin, QInputDialog

                                                                                                                                                                                                                                                                                                          Simple convenience dialog to get a single value from the user.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/inputdialog.py
                                                                                                                                                                                                                                                                                                          class InputDialog(widgets.DialogMixin, widgets.QInputDialog):
                                                                                                                                                                                                                                                                                                              """Simple convenience dialog to get a single value from the user."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "textEchoMode": widgets.lineedit.ECHO_MODE,
                                                                                                                                                                                                                                                                                                                      "inputMode": INPUT_MODE,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def get_int(
                                                                                                                                                                                                                                                                                                                  cls,
                                                                                                                                                                                                                                                                                                                  title: str = "",
                                                                                                                                                                                                                                                                                                                  label: str = "",
                                                                                                                                                                                                                                                                                                                  icon: datatypes.IconType = None,
                                                                                                                                                                                                                                                                                                              ) -> int | None:
                                                                                                                                                                                                                                                                                                                  par = widgets.Dialog()
                                                                                                                                                                                                                                                                                                                  par.set_icon(icon)
                                                                                                                                                                                                                                                                                                                  v = cls.getInt(par, title, label, value=0)
                                                                                                                                                                                                                                                                                                                  return v[0] if v[1] else None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def get_float(
                                                                                                                                                                                                                                                                                                                  cls,
                                                                                                                                                                                                                                                                                                                  title: str = "",
                                                                                                                                                                                                                                                                                                                  label: str = "",
                                                                                                                                                                                                                                                                                                                  icon: datatypes.IconType = None,
                                                                                                                                                                                                                                                                                                              ) -> float | None:
                                                                                                                                                                                                                                                                                                                  par = widgets.Dialog()
                                                                                                                                                                                                                                                                                                                  par.set_icon(icon)
                                                                                                                                                                                                                                                                                                                  v = cls.getDouble(par, title, label, value=0.0)
                                                                                                                                                                                                                                                                                                                  return v[0] if v[1] else None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def get_text(
                                                                                                                                                                                                                                                                                                                  cls,
                                                                                                                                                                                                                                                                                                                  title: str = "",
                                                                                                                                                                                                                                                                                                                  label: str = "",
                                                                                                                                                                                                                                                                                                                  icon: datatypes.IconType = None,
                                                                                                                                                                                                                                                                                                                  value: str = "",
                                                                                                                                                                                                                                                                                                                  echo_mode: widgets.lineedit.EchoModeStr | widgets.QLineEdit.EchoMode = "normal",
                                                                                                                                                                                                                                                                                                              ) -> str | None:
                                                                                                                                                                                                                                                                                                                  par = widgets.Dialog()
                                                                                                                                                                                                                                                                                                                  par.set_icon(icon)
                                                                                                                                                                                                                                                                                                                  v = cls.getText(
                                                                                                                                                                                                                                                                                                                      par, title, label, widgets.lineedit.ECHO_MODE.get_enum_value(echo_mode), value
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  return v[0] if v[1] else None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def get_item(
                                                                                                                                                                                                                                                                                                                  cls,
                                                                                                                                                                                                                                                                                                                  items: list[str],
                                                                                                                                                                                                                                                                                                                  title: str = "",
                                                                                                                                                                                                                                                                                                                  label: str = "",
                                                                                                                                                                                                                                                                                                                  icon: datatypes.IconType = None,
                                                                                                                                                                                                                                                                                                                  editable: bool = False,
                                                                                                                                                                                                                                                                                                              ) -> str | None:
                                                                                                                                                                                                                                                                                                                  par = widgets.Dialog()
                                                                                                                                                                                                                                                                                                                  par.set_icon(icon)
                                                                                                                                                                                                                                                                                                                  v = cls.getItem(par, title, label, items, editable=editable, current=0)
                                                                                                                                                                                                                                                                                                                  return v[0] if v[1] else None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_text_echo_mode(
                                                                                                                                                                                                                                                                                                                  self, mode: widgets.lineedit.EchoModeStr | widgets.QLineEdit.EchoMode
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set text echo mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: echo mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setTextEchoMode(widgets.lineedit.ECHO_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_text_echo_mode(self) -> widgets.lineedit.EchoModeStr:
                                                                                                                                                                                                                                                                                                                  """Return text echo mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      echo mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return widgets.lineedit.ECHO_MODE.inverse[self.textEchoMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_input_mode(self, mode: InputModeStr | mod.InputMode):
                                                                                                                                                                                                                                                                                                                  """Set input mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: input mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setInputMode(INPUT_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_input_mode(self) -> InputModeStr:
                                                                                                                                                                                                                                                                                                                  """Return input mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      input mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return INPUT_MODE.inverse[self.inputMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_input_mode() -> InputModeStr

                                                                                                                                                                                                                                                                                                          Return input mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/inputdialog.py
                                                                                                                                                                                                                                                                                                          def get_input_mode(self) -> InputModeStr:
                                                                                                                                                                                                                                                                                                              """Return input mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  input mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return INPUT_MODE.inverse[self.inputMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_text_echo_mode() -> widgets.lineedit.EchoModeStr

                                                                                                                                                                                                                                                                                                          Return text echo mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/inputdialog.py
                                                                                                                                                                                                                                                                                                          def get_text_echo_mode(self) -> widgets.lineedit.EchoModeStr:
                                                                                                                                                                                                                                                                                                              """Return text echo mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  echo mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return widgets.lineedit.ECHO_MODE.inverse[self.textEchoMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_input_mode(mode: InputModeStr | mod.InputMode)

                                                                                                                                                                                                                                                                                                          Set input mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode InputModeStr | InputMode

                                                                                                                                                                                                                                                                                                          input mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/inputdialog.py
                                                                                                                                                                                                                                                                                                          def set_input_mode(self, mode: InputModeStr | mod.InputMode):
                                                                                                                                                                                                                                                                                                              """Set input mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: input mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setInputMode(INPUT_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_text_echo_mode(mode: widgets.lineedit.EchoModeStr | widgets.QLineEdit.EchoMode)

                                                                                                                                                                                                                                                                                                          Set text echo mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode EchoModeStr | EchoMode

                                                                                                                                                                                                                                                                                                          echo mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/inputdialog.py
                                                                                                                                                                                                                                                                                                          def set_text_echo_mode(
                                                                                                                                                                                                                                                                                                              self, mode: widgets.lineedit.EchoModeStr | widgets.QLineEdit.EchoMode
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set text echo mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: echo mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setTextEchoMode(widgets.lineedit.ECHO_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ItemDelegate

                                                                                                                                                                                                                                                                                                          Bases: AbstractItemDelegateMixin, QItemDelegate

                                                                                                                                                                                                                                                                                                          Display and editing facilities for data items from a model.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/itemdelegate.py
                                                                                                                                                                                                                                                                                                          class ItemDelegate(widgets.AbstractItemDelegateMixin, widgets.QItemDelegate):
                                                                                                                                                                                                                                                                                                              """Display and editing facilities for data items from a model."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ItemEditorCreatorBase

                                                                                                                                                                                                                                                                                                          Bases: QItemEditorCreatorBase

                                                                                                                                                                                                                                                                                                          Abstract base class for implementing new item editor creators.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/itemeditorcreatorbase.py
                                                                                                                                                                                                                                                                                                          class ItemEditorCreatorBase(QtWidgets.QItemEditorCreatorBase):
                                                                                                                                                                                                                                                                                                              """Abstract base class for implementing new item editor creators."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ItemEditorFactory

                                                                                                                                                                                                                                                                                                          Bases: QItemEditorFactory

                                                                                                                                                                                                                                                                                                          Widgets for editing item data in views and delegates.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/itemeditorfactory.py
                                                                                                                                                                                                                                                                                                          class ItemEditorFactory(widgets.QItemEditorFactory):
                                                                                                                                                                                                                                                                                                              """Widgets for editing item data in views and delegates."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              creators: ClassVar = []
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def register_default_editor(
                                                                                                                                                                                                                                                                                                                  cls,
                                                                                                                                                                                                                                                                                                                  editor_cls: type[widgets.QWidget],
                                                                                                                                                                                                                                                                                                                  typ: int | type | None = None,
                                                                                                                                                                                                                                                                                                                  property_name: str = "",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  factory = cls.defaultFactory()
                                                                                                                                                                                                                                                                                                                  assert factory
                                                                                                                                                                                                                                                                                                                  creator = get_creator_class(editor_cls, property_name)()
                                                                                                                                                                                                                                                                                                                  cls.creators.append(creator)
                                                                                                                                                                                                                                                                                                                  match typ:
                                                                                                                                                                                                                                                                                                                      case None:
                                                                                                                                                                                                                                                                                                                          typ = editor_cls.staticMetaObject.userProperty().userType()  # ty: ignore[missing-attribute]  # not in stubs
                                                                                                                                                                                                                                                                                                                      case type() if typ in TYPES:
                                                                                                                                                                                                                                                                                                                          typ = TYPES[typ].value
                                                                                                                                                                                                                                                                                                                      case int():
                                                                                                                                                                                                                                                                                                                          pass
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise TypeError(typ)
                                                                                                                                                                                                                                                                                                                  factory.registerEditor(typ, creator)
                                                                                                                                                                                                                                                                                                                  cls.setDefaultFactory(factory)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def register_editor(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  editor_cls: type[widgets.QWidget],
                                                                                                                                                                                                                                                                                                                  typ: int | type | None = None,
                                                                                                                                                                                                                                                                                                                  property_name: str = "",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  creator = get_creator_class(editor_cls, property_name)()
                                                                                                                                                                                                                                                                                                                  self.creators.append(creator)
                                                                                                                                                                                                                                                                                                                  match typ:
                                                                                                                                                                                                                                                                                                                      case None:
                                                                                                                                                                                                                                                                                                                          typ = editor_cls.staticMetaObject.userProperty().userType()  # ty: ignore[missing-attribute]  # not in stubs
                                                                                                                                                                                                                                                                                                                      case type() if typ in TYPES:
                                                                                                                                                                                                                                                                                                                          typ = TYPES[typ].value
                                                                                                                                                                                                                                                                                                                      case int():
                                                                                                                                                                                                                                                                                                                          pass
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise TypeError(typ)
                                                                                                                                                                                                                                                                                                                  self.registerEditor(typ, creator)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def create_extended(cls) -> Self:
                                                                                                                                                                                                                                                                                                                  factory = cls()
                                                                                                                                                                                                                                                                                                                  factory.register_editor(widgets.CheckBox, bool, "")
                                                                                                                                                                                                                                                                                                                  factory.register_editor(widgets.SpinBox, int, "value")
                                                                                                                                                                                                                                                                                                                  factory.register_editor(widgets.LineEdit, str, "text")
                                                                                                                                                                                                                                                                                                                  factory.register_editor(widgets.DoubleSpinBox, float, "value")
                                                                                                                                                                                                                                                                                                                  factory.register_editor(widgets.DateEdit, QtCore.QDate, "date")
                                                                                                                                                                                                                                                                                                                  factory.register_editor(widgets.TimeEdit, QtCore.QTime, "time")
                                                                                                                                                                                                                                                                                                                  factory.register_editor(widgets.DateTimeEdit, QtCore.QDateTime, "dateTime")
                                                                                                                                                                                                                                                                                                                  factory.register_editor(custom_widgets.PointEdit, QtCore.QPoint, "value")
                                                                                                                                                                                                                                                                                                                  factory.register_editor(custom_widgets.SizeEdit, QtCore.QSize, "value")
                                                                                                                                                                                                                                                                                                                  factory.register_editor(custom_widgets.RectEdit, QtCore.QRect, "value")
                                                                                                                                                                                                                                                                                                                  # factory.register_editor(custom_widgets.EnumFlagWidget, 66231, "value")
                                                                                                                                                                                                                                                                                                                  # factory.register_editor(custom_widgets.EnumComboBox, 20001, "value")
                                                                                                                                                                                                                                                                                                                  factory.register_editor(custom_widgets.RegionEdit, QtGui.QRegion, "value")
                                                                                                                                                                                                                                                                                                                  factory.register_editor(
                                                                                                                                                                                                                                                                                                                      custom_widgets.SizePolicyEdit, widgets.QSizePolicy, "value"
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  factory.register_editor(
                                                                                                                                                                                                                                                                                                                      widgets.KeySequenceEdit, QtGui.QKeySequence, "keySequence"
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  factory.register_editor(
                                                                                                                                                                                                                                                                                                                      custom_widgets.ColorComboBox, QtGui.QColor, "current_color"
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  factory.register_editor(widgets.FontComboBox, QtGui.QFont, "currentFont")
                                                                                                                                                                                                                                                                                                                  factory.register_editor(widgets.LineEdit, QtCore.QUrl, "text")
                                                                                                                                                                                                                                                                                                                  factory.register_editor(widgets.LineEdit, QtCore.QRegularExpression, "text")
                                                                                                                                                                                                                                                                                                                  return factory
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          KeySequenceEdit

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QKeySequenceEdit

                                                                                                                                                                                                                                                                                                          Allows to input a QKeySequence.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/keysequenceedit.py
                                                                                                                                                                                                                                                                                                          class KeySequenceEdit(widgets.WidgetMixin, widgets.QKeySequenceEdit):
                                                                                                                                                                                                                                                                                                              """Allows to input a QKeySequence."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(gui.QKeySequence)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.keySequenceChanged.connect(self._on_value_change)
                                                                                                                                                                                                                                                                                                                  self.setClearButtonEnabled(True)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __repr__(self):
                                                                                                                                                                                                                                                                                                                  return get_repr(self, self.get_value())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _on_value_change(self, val):
                                                                                                                                                                                                                                                                                                                  self.value_changed.emit(val)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self, value: str | gui.QKeySequence):
                                                                                                                                                                                                                                                                                                                  if isinstance(value, str):
                                                                                                                                                                                                                                                                                                                      value = gui.KeySequence.fromString(value)
                                                                                                                                                                                                                                                                                                                  self.setKeySequence(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_value(self) -> gui.QKeySequence:
                                                                                                                                                                                                                                                                                                                  return self.keySequence()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def is_valid(self) -> bool:
                                                                                                                                                                                                                                                                                                                  return True
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_finishing_key_combinations(self) -> list[core.KeyCombination]:
                                                                                                                                                                                                                                                                                                                  return [core.KeyCombination(i) for i in self.finishingKeyCombinations()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_key_combinations(self) -> list[core.KeyCombination]:
                                                                                                                                                                                                                                                                                                                  # QKeySequence is iterable at runtime (not in the stubs)
                                                                                                                                                                                                                                                                                                                  keys = self.keySequence()
                                                                                                                                                                                                                                                                                                                  return [core.KeyCombination(i) for i in keys]  # ty: ignore[not-iterable]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          LCDNumber

                                                                                                                                                                                                                                                                                                          Bases: FrameMixin, QLCDNumber

                                                                                                                                                                                                                                                                                                          Displays a number with LCD-like digits.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/lcdnumber.py
                                                                                                                                                                                                                                                                                                          class LCDNumber(widgets.FrameMixin, widgets.QLCDNumber):
                                                                                                                                                                                                                                                                                                              """Displays a number with LCD-like digits."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(float)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {"segmentStyle": SEGMENT_STYLE, "mode": MODE}
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_mode(self, mode: ModeStr | widgets.QLCDNumber.Mode):
                                                                                                                                                                                                                                                                                                                  """Set the lcd mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: lcd mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setMode(MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_mode(self) -> ModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current lcd mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      lcd mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return MODE.inverse[self.mode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_segment_style(self, style: SegmentStyleStr | widgets.QLCDNumber.SegmentStyle):
                                                                                                                                                                                                                                                                                                                  """Set the segment style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      style: segment style to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setSegmentStyle(SEGMENT_STYLE.get_enum_value(style))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_segment_style(self) -> SegmentStyleStr:
                                                                                                                                                                                                                                                                                                                  """Return current segment style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      segment style
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return SEGMENT_STYLE.inverse[self.segmentStyle()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self, value: float | str):
                                                                                                                                                                                                                                                                                                                  if value != self.value():
                                                                                                                                                                                                                                                                                                                      self.value_changed.emit(float(value))
                                                                                                                                                                                                                                                                                                                  self.display(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_value(self) -> float:
                                                                                                                                                                                                                                                                                                                  return self.value()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_mode() -> ModeStr

                                                                                                                                                                                                                                                                                                          Return current lcd mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/lcdnumber.py
                                                                                                                                                                                                                                                                                                          def get_mode(self) -> ModeStr:
                                                                                                                                                                                                                                                                                                              """Return current lcd mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  lcd mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return MODE.inverse[self.mode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_segment_style() -> SegmentStyleStr

                                                                                                                                                                                                                                                                                                          Return current segment style.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/lcdnumber.py
                                                                                                                                                                                                                                                                                                          def get_segment_style(self) -> SegmentStyleStr:
                                                                                                                                                                                                                                                                                                              """Return current segment style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  segment style
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return SEGMENT_STYLE.inverse[self.segmentStyle()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_mode(mode: ModeStr | widgets.QLCDNumber.Mode)

                                                                                                                                                                                                                                                                                                          Set the lcd mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ModeStr | Mode

                                                                                                                                                                                                                                                                                                          lcd mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/lcdnumber.py
                                                                                                                                                                                                                                                                                                          def set_mode(self, mode: ModeStr | widgets.QLCDNumber.Mode):
                                                                                                                                                                                                                                                                                                              """Set the lcd mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: lcd mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setMode(MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_segment_style(style: SegmentStyleStr | widgets.QLCDNumber.SegmentStyle)

                                                                                                                                                                                                                                                                                                          Set the segment style.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          style SegmentStyleStr | SegmentStyle

                                                                                                                                                                                                                                                                                                          segment style to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/lcdnumber.py
                                                                                                                                                                                                                                                                                                          def set_segment_style(self, style: SegmentStyleStr | widgets.QLCDNumber.SegmentStyle):
                                                                                                                                                                                                                                                                                                              """Set the segment style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  style: segment style to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setSegmentStyle(SEGMENT_STYLE.get_enum_value(style))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Label

                                                                                                                                                                                                                                                                                                          Bases: FrameMixin, QLabel

                                                                                                                                                                                                                                                                                                          Text or image display.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/label.py
                                                                                                                                                                                                                                                                                                          class Label(widgets.FrameMixin, widgets.QLabel):
                                                                                                                                                                                                                                                                                                              """Text or image display."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              elision_changed = core.Signal(bool)
                                                                                                                                                                                                                                                                                                              clicked = core.Signal()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  self._elide_mode = constants.TextElideMode.ElideNone
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.openExternalLinks()
                                                                                                                                                                                                                                                                                                                  self._is_elided = False
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def mouseReleaseEvent(self, ev: gui.QMouseEvent):
                                                                                                                                                                                                                                                                                                                  if ev.button() == constants.MouseButton.LeftButton:
                                                                                                                                                                                                                                                                                                                      self.clicked.emit()
                                                                                                                                                                                                                                                                                                                  return super().mouseReleaseEvent(ev)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_elide_mode(self, mode: constants.TextElideModeStr):
                                                                                                                                                                                                                                                                                                                  self._elide_mode = constants.TEXT_ELIDE_MODE[mode]
                                                                                                                                                                                                                                                                                                                  self.update()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_elide_mode(self) -> constants.TextElideModeStr:
                                                                                                                                                                                                                                                                                                                  return constants.TEXT_ELIDE_MODE.inverse[self._elide_mode]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {"textFormat": constants.TEXT_FORMAT, "alignment": constants.ALIGNMENTS}
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __repr__(self):
                                                                                                                                                                                                                                                                                                                  return get_repr(self, self.text())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # # adapted from https://forum.qt.io/topic/24530/solved-shortening-a-label/3
                                                                                                                                                                                                                                                                                                              # def minimumSizeHint(self):
                                                                                                                                                                                                                                                                                                              #     if self._elide_mode != constants.TextElideMode.ElideNone:
                                                                                                                                                                                                                                                                                                              #         # TODO: tweak sizeHint
                                                                                                                                                                                                                                                                                                              #         # -> text should expand if user increases window size,
                                                                                                                                                                                                                                                                                                              #         #    but don't automatically adapt window size to label width on UI update!
                                                                                                                                                                                                                                                                                                              #         #    (somehow calculate minimumSizeHint + sizeHint with font metrics???)
                                                                                                                                                                                                                                                                                                              #         fm = self.fontMetrics()
                                                                                                                                                                                                                                                                                                              #         size = core.QSize(fm.width("..."), fm.height())
                                                                                                                                                                                                                                                                                                              #         return size
                                                                                                                                                                                                                                                                                                              #     else:
                                                                                                                                                                                                                                                                                                              #         size = self.minimumSizeHint()
                                                                                                                                                                                                                                                                                                              #         return core.QSize(size.width() + 13, size.height())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # # adapted from https://www.mimec.org/blog/status-bar-and-elided-label
                                                                                                                                                                                                                                                                                                              # def paintEvent(self, event):
                                                                                                                                                                                                                                                                                                              #     with gui.Painter(self) as painter:
                                                                                                                                                                                                                                                                                                              #         self.drawFrame(painter)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              #         rect = self.contentsRect()
                                                                                                                                                                                                                                                                                                              #         rect.adjust(self.margin(), self.margin(), -self.margin(), -self.margin())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              #         elided_text = painter.fontMetrics().elidedText(
                                                                                                                                                                                                                                                                                                              #             self.text(), self._elide_mode, rect.width()
                                                                                                                                                                                                                                                                                                              #         )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              #         style_option = widgets.QStyleOption()
                                                                                                                                                                                                                                                                                                              #         style_option.initFrom(self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              #         self.style().drawItemText(
                                                                                                                                                                                                                                                                                                              #             painter,
                                                                                                                                                                                                                                                                                                              #             rect,
                                                                                                                                                                                                                                                                                                              #             self.alignment(),
                                                                                                                                                                                                                                                                                                              #             style_option.palette,
                                                                                                                                                                                                                                                                                                              #             self.isEnabled(),
                                                                                                                                                                                                                                                                                                              #             elided_text,
                                                                                                                                                                                                                                                                                                              #             self.foregroundRole(),
                                                                                                                                                                                                                                                                                                              #         )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def paintEvent(self, event):
                                                                                                                                                                                                                                                                                                                  if self._elide_mode == constants.TextElideMode.ElideNone:
                                                                                                                                                                                                                                                                                                                      super().paintEvent(event)
                                                                                                                                                                                                                                                                                                                      return
                                                                                                                                                                                                                                                                                                                  did_elide = False
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  with gui.Painter(self) as painter:
                                                                                                                                                                                                                                                                                                                      font_metrics = painter.fontMetrics()
                                                                                                                                                                                                                                                                                                                      text_lines = self.text().split("\n")
                                                                                                                                                                                                                                                                                                                      text_width = font_metrics.horizontalAdvance(self.text())
                                                                                                                                                                                                                                                                                                                      line_spacing = font_metrics.lineSpacing()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                      # layout phase
                                                                                                                                                                                                                                                                                                                      text_layout = gui.TextLayout(self.text(), painter.font())
                                                                                                                                                                                                                                                                                                                      current_y = 0
                                                                                                                                                                                                                                                                                                                      with text_layout.process_layout():
                                                                                                                                                                                                                                                                                                                          for line in text_lines:
                                                                                                                                                                                                                                                                                                                              text_width = font_metrics.horizontalAdvance(line)
                                                                                                                                                                                                                                                                                                                              # if self.height() >= next_line_y + line_spacing:
                                                                                                                                                                                                                                                                                                                              #     line.draw(painter, core.PointF(0, y))
                                                                                                                                                                                                                                                                                                                              #     y = next_line_y
                                                                                                                                                                                                                                                                                                                              # else:
                                                                                                                                                                                                                                                                                                                              #     last_line = self._text[line.textStart() :]
                                                                                                                                                                                                                                                                                                                              #     elided_line = metrics.elided_text(
                                                                                                                                                                                                                                                                                                                              #         last_line, "right", self.width()
                                                                                                                                                                                                                                                                                                                              #     )
                                                                                                                                                                                                                                                                                                                              #     painter.drawText(0, y + metrics.ascent(), elided_line)
                                                                                                                                                                                                                                                                                                                              #     line = layout.createLine()
                                                                                                                                                                                                                                                                                                                              #     did_elide = line.isValid()
                                                                                                                                                                                                                                                                                                                              #     break
                                                                                                                                                                                                                                                                                                                              if text_width >= self.width():
                                                                                                                                                                                                                                                                                                                                  elided_line = font_metrics.elidedText(
                                                                                                                                                                                                                                                                                                                                      line, self._elide_mode, self.width()
                                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                                  painter.drawText(
                                                                                                                                                                                                                                                                                                                                      core.QRect(0, current_y, self.width(), self.height()),
                                                                                                                                                                                                                                                                                                                                      int(self.alignment()),
                                                                                                                                                                                                                                                                                                                                      elided_line,
                                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                                  did_elide = True
                                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                                  painter.drawText(
                                                                                                                                                                                                                                                                                                                                      core.QRect(0, current_y, self.width(), self.height()),
                                                                                                                                                                                                                                                                                                                                      int(self.alignment()),
                                                                                                                                                                                                                                                                                                                                      line,
                                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                              current_y += line_spacing
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                      if did_elide != self._is_elided:
                                                                                                                                                                                                                                                                                                                          self._is_elided = did_elide
                                                                                                                                                                                                                                                                                                                          self.elision_changed.emit(did_elide)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def allow_links(self) -> Label:
                                                                                                                                                                                                                                                                                                                  # self.setText("<a href=\"http://example.com/\">Click Here!</a>")
                                                                                                                                                                                                                                                                                                                  self.setTextFormat(constants.TextFormat.RichText)
                                                                                                                                                                                                                                                                                                                  self.setTextInteractionFlags(constants.TextInteractionFlag.TextBrowserInteraction)
                                                                                                                                                                                                                                                                                                                  self.setOpenExternalLinks(True)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_alignment(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  horizontal: constants.HorizontalAlignmentStr | None = None,
                                                                                                                                                                                                                                                                                                                  vertical: constants.VerticalAlignmentStr | None = None,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the alignment of the label's contents."""
                                                                                                                                                                                                                                                                                                                  match horizontal, vertical:
                                                                                                                                                                                                                                                                                                                      case None, None:
                                                                                                                                                                                                                                                                                                                          return self
                                                                                                                                                                                                                                                                                                                      case None, _:
                                                                                                                                                                                                                                                                                                                          flag = constants.V_ALIGNMENT[vertical]
                                                                                                                                                                                                                                                                                                                      case _, None:
                                                                                                                                                                                                                                                                                                                          flag = constants.H_ALIGNMENT[horizontal]
                                                                                                                                                                                                                                                                                                                      case _, _:
                                                                                                                                                                                                                                                                                                                          flag = constants.V_ALIGNMENT[vertical] | constants.H_ALIGNMENT[horizontal]
                                                                                                                                                                                                                                                                                                                  self.setAlignment(flag)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_horizontal_alignment(self) -> constants.HorizontalAlignmentStr:
                                                                                                                                                                                                                                                                                                                  align = self.alignment()
                                                                                                                                                                                                                                                                                                                  if align & constants.ALIGN_RIGHT:
                                                                                                                                                                                                                                                                                                                      return "right"
                                                                                                                                                                                                                                                                                                                  if align & constants.ALIGN_H_CENTER:
                                                                                                                                                                                                                                                                                                                      return "center"
                                                                                                                                                                                                                                                                                                                  if align & constants.ALIGN_JUSTIFY:
                                                                                                                                                                                                                                                                                                                      return "justify"
                                                                                                                                                                                                                                                                                                                  return "left"
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_vertical_alignment(self) -> constants.VerticalAlignmentStr:
                                                                                                                                                                                                                                                                                                                  align = self.alignment()
                                                                                                                                                                                                                                                                                                                  if align & constants.ALIGN_TOP:
                                                                                                                                                                                                                                                                                                                      return "top"
                                                                                                                                                                                                                                                                                                                  if align & constants.ALIGN_BOTTOM:
                                                                                                                                                                                                                                                                                                                      return "bottom"
                                                                                                                                                                                                                                                                                                                  if align & constants.ALIGN_BASELINE:
                                                                                                                                                                                                                                                                                                                      return "baseline"
                                                                                                                                                                                                                                                                                                                  return "center"
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_indent(self, indent: int) -> Label:
                                                                                                                                                                                                                                                                                                                  """Set the label's text indent in pixels."""
                                                                                                                                                                                                                                                                                                                  self.setIndent(indent)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_text_format(
                                                                                                                                                                                                                                                                                                                  self, text_format: constants.TextFormatStr | constants.TextFormat
                                                                                                                                                                                                                                                                                                              ) -> Label:
                                                                                                                                                                                                                                                                                                                  """Set the text format.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      text_format: text format to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setTextFormat(constants.TEXT_FORMAT.get_enum_value(text_format))
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_text_format(self) -> constants.TextFormatStr:
                                                                                                                                                                                                                                                                                                                  """Return current text format.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      text format
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.TEXT_FORMAT.inverse[self.textFormat()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_text_interaction(self, *types: constants.TextInteractionStr) -> Label:
                                                                                                                                                                                                                                                                                                                  """Set the text interaction mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      types: text interaction mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  flags = constants.TEXT_INTERACTION.merge_flags(types)
                                                                                                                                                                                                                                                                                                                  self.setTextInteractionFlags(flags)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_text_interaction(self) -> list[constants.TextInteractionStr]:
                                                                                                                                                                                                                                                                                                                  """Return current text interaction mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      list of text interaction modes
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.TEXT_INTERACTION.get_list(self.textInteractionFlags())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_text(self, text: str) -> Label:
                                                                                                                                                                                                                                                                                                                  """Set the label's text."""
                                                                                                                                                                                                                                                                                                                  self.setText(text)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_bold(self, bold: bool = True) -> Label:
                                                                                                                                                                                                                                                                                                                  font = self.font()
                                                                                                                                                                                                                                                                                                                  font.setBold(bold)
                                                                                                                                                                                                                                                                                                                  self.setFont(font)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_italic(self, italic: bool = True) -> Label:
                                                                                                                                                                                                                                                                                                                  font = self.font()
                                                                                                                                                                                                                                                                                                                  font.setItalic(italic)
                                                                                                                                                                                                                                                                                                                  self.setFont(font)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_point_size(self, size: int) -> Label:
                                                                                                                                                                                                                                                                                                                  font = self.font()
                                                                                                                                                                                                                                                                                                                  font.setPointSize(size)
                                                                                                                                                                                                                                                                                                                  self.setFont(font)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_weight(self, weight: gui.font.WeightStr | gui.QFont.Weight) -> Label:
                                                                                                                                                                                                                                                                                                                  """Set the font weight.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      weight: font weight
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  font = self.font()
                                                                                                                                                                                                                                                                                                                  font.setWeight(gui.font.WEIGHT.get_enum_value(weight))
                                                                                                                                                                                                                                                                                                                  self.setFont(font)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_color(self, color: datatypes.ColorType) -> Label:
                                                                                                                                                                                                                                                                                                                  with self.edit_stylesheet() as ss:
                                                                                                                                                                                                                                                                                                                      if color is None:
                                                                                                                                                                                                                                                                                                                          ss.color.setValue("")
                                                                                                                                                                                                                                                                                                                      else:
                                                                                                                                                                                                                                                                                                                          color = colors.get_color(color)
                                                                                                                                                                                                                                                                                                                          ss.color.setValue(color.name())
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_image(self, path: datatypes.PathType, width: int = 300) -> Label:
                                                                                                                                                                                                                                                                                                                  self.setScaledContents(True)
                                                                                                                                                                                                                                                                                                                  self.set_alignment(horizontal="center")
                                                                                                                                                                                                                                                                                                                  self.setText(
                                                                                                                                                                                                                                                                                                                      "<html><head/><body><p>"
                                                                                                                                                                                                                                                                                                                      f"<img src={os.fspath(path)!r} width={str(width)!r}/>"
                                                                                                                                                                                                                                                                                                                      "</p></body></html>"
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def image_from_path(
                                                                                                                                                                                                                                                                                                                  cls, path: datatypes.PathType, parent: widgets.QWidget | None = None
                                                                                                                                                                                                                                                                                                              ) -> Self:
                                                                                                                                                                                                                                                                                                                  pixmap = gui.Pixmap.from_file(path)
                                                                                                                                                                                                                                                                                                                  label = cls(parent=parent)
                                                                                                                                                                                                                                                                                                                  label.setPixmap(pixmap)
                                                                                                                                                                                                                                                                                                                  label.resize(pixmap.width(), pixmap.height())
                                                                                                                                                                                                                                                                                                                  return label
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              elideMode = core.Property(  # noqa: N815
                                                                                                                                                                                                                                                                                                                  str,
                                                                                                                                                                                                                                                                                                                  get_elide_mode,
                                                                                                                                                                                                                                                                                                                  set_elide_mode,
                                                                                                                                                                                                                                                                                                                  doc="Text Elide style",
                                                                                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_text_format() -> constants.TextFormatStr

                                                                                                                                                                                                                                                                                                          Return current text format.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/label.py
                                                                                                                                                                                                                                                                                                          def get_text_format(self) -> constants.TextFormatStr:
                                                                                                                                                                                                                                                                                                              """Return current text format.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  text format
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.TEXT_FORMAT.inverse[self.textFormat()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_text_interaction() -> list[constants.TextInteractionStr]

                                                                                                                                                                                                                                                                                                          Return current text interaction mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/label.py
                                                                                                                                                                                                                                                                                                          def get_text_interaction(self) -> list[constants.TextInteractionStr]:
                                                                                                                                                                                                                                                                                                              """Return current text interaction mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  list of text interaction modes
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.TEXT_INTERACTION.get_list(self.textInteractionFlags())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_alignment(horizontal: constants.HorizontalAlignmentStr | None = None, vertical: constants.VerticalAlignmentStr | None = None)

                                                                                                                                                                                                                                                                                                          Set the alignment of the label's contents.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/label.py
                                                                                                                                                                                                                                                                                                          def set_alignment(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              horizontal: constants.HorizontalAlignmentStr | None = None,
                                                                                                                                                                                                                                                                                                              vertical: constants.VerticalAlignmentStr | None = None,
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the alignment of the label's contents."""
                                                                                                                                                                                                                                                                                                              match horizontal, vertical:
                                                                                                                                                                                                                                                                                                                  case None, None:
                                                                                                                                                                                                                                                                                                                      return self
                                                                                                                                                                                                                                                                                                                  case None, _:
                                                                                                                                                                                                                                                                                                                      flag = constants.V_ALIGNMENT[vertical]
                                                                                                                                                                                                                                                                                                                  case _, None:
                                                                                                                                                                                                                                                                                                                      flag = constants.H_ALIGNMENT[horizontal]
                                                                                                                                                                                                                                                                                                                  case _, _:
                                                                                                                                                                                                                                                                                                                      flag = constants.V_ALIGNMENT[vertical] | constants.H_ALIGNMENT[horizontal]
                                                                                                                                                                                                                                                                                                              self.setAlignment(flag)
                                                                                                                                                                                                                                                                                                              return self
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_indent(indent: int) -> Label

                                                                                                                                                                                                                                                                                                          Set the label's text indent in pixels.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/label.py
                                                                                                                                                                                                                                                                                                          def set_indent(self, indent: int) -> Label:
                                                                                                                                                                                                                                                                                                              """Set the label's text indent in pixels."""
                                                                                                                                                                                                                                                                                                              self.setIndent(indent)
                                                                                                                                                                                                                                                                                                              return self
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_text(text: str) -> Label

                                                                                                                                                                                                                                                                                                          Set the label's text.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/label.py
                                                                                                                                                                                                                                                                                                          def set_text(self, text: str) -> Label:
                                                                                                                                                                                                                                                                                                              """Set the label's text."""
                                                                                                                                                                                                                                                                                                              self.setText(text)
                                                                                                                                                                                                                                                                                                              return self
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_text_format(text_format: constants.TextFormatStr | constants.TextFormat) -> Label

                                                                                                                                                                                                                                                                                                          Set the text format.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          text_format TextFormatStr | TextFormat

                                                                                                                                                                                                                                                                                                          text format to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/label.py
                                                                                                                                                                                                                                                                                                          def set_text_format(
                                                                                                                                                                                                                                                                                                              self, text_format: constants.TextFormatStr | constants.TextFormat
                                                                                                                                                                                                                                                                                                          ) -> Label:
                                                                                                                                                                                                                                                                                                              """Set the text format.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  text_format: text format to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setTextFormat(constants.TEXT_FORMAT.get_enum_value(text_format))
                                                                                                                                                                                                                                                                                                              return self
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_text_interaction(*types: constants.TextInteractionStr) -> Label

                                                                                                                                                                                                                                                                                                          Set the text interaction mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          types TextInteractionStr

                                                                                                                                                                                                                                                                                                          text interaction mode to use

                                                                                                                                                                                                                                                                                                          ()
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/label.py
                                                                                                                                                                                                                                                                                                          def set_text_interaction(self, *types: constants.TextInteractionStr) -> Label:
                                                                                                                                                                                                                                                                                                              """Set the text interaction mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  types: text interaction mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              flags = constants.TEXT_INTERACTION.merge_flags(types)
                                                                                                                                                                                                                                                                                                              self.setTextInteractionFlags(flags)
                                                                                                                                                                                                                                                                                                              return self
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_weight(weight: gui.font.WeightStr | gui.QFont.Weight) -> Label

                                                                                                                                                                                                                                                                                                          Set the font weight.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          weight WeightStr | Weight

                                                                                                                                                                                                                                                                                                          font weight

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/label.py
                                                                                                                                                                                                                                                                                                          def set_weight(self, weight: gui.font.WeightStr | gui.QFont.Weight) -> Label:
                                                                                                                                                                                                                                                                                                              """Set the font weight.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  weight: font weight
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              font = self.font()
                                                                                                                                                                                                                                                                                                              font.setWeight(gui.font.WEIGHT.get_enum_value(weight))
                                                                                                                                                                                                                                                                                                              self.setFont(font)
                                                                                                                                                                                                                                                                                                              return self
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Layout

                                                                                                                                                                                                                                                                                                          Bases: LayoutMixin, QLayout

                                                                                                                                                                                                                                                                                                          The base class of geometry managers.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/layout.py
                                                                                                                                                                                                                                                                                                          class Layout(LayoutMixin, widgets.QLayout):
                                                                                                                                                                                                                                                                                                              """The base class of geometry managers."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          LayoutItem

                                                                                                                                                                                                                                                                                                          Bases: LayoutItemMixin, QLayoutItem

                                                                                                                                                                                                                                                                                                          Abstract item that a QLayout manipulates.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/layoutitem.py
                                                                                                                                                                                                                                                                                                          class LayoutItem(LayoutItemMixin, widgets.QLayoutItem):
                                                                                                                                                                                                                                                                                                              """Abstract item that a QLayout manipulates."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          LayoutItemMixin

                                                                                                                                                                                                                                                                                                          Bases: _LayoutItemBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/layoutitem.py
                                                                                                                                                                                                                                                                                                          class LayoutItemMixin(_LayoutItemBase):
                                                                                                                                                                                                                                                                                                              def __bool__(self):
                                                                                                                                                                                                                                                                                                                  return not self.isEmpty()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_alignment(self, alignment: constants.AlignmentStr):
                                                                                                                                                                                                                                                                                                                  """Set the alignment of the layout.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      alignment: alignment for the layout
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setAlignment(constants.ALIGNMENTS.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_alignment(self) -> constants.AlignmentStr:
                                                                                                                                                                                                                                                                                                                  """Return current alignment.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      alignment
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.ALIGNMENTS.inverse[self.alignment()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_item(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                              ) -> widgets.QWidget | widgets.QLayout | widgets.QSpacerItem | None:
                                                                                                                                                                                                                                                                                                                  if content := self.widget():
                                                                                                                                                                                                                                                                                                                      return content
                                                                                                                                                                                                                                                                                                                  if content := self.layout():
                                                                                                                                                                                                                                                                                                                      return content
                                                                                                                                                                                                                                                                                                                  return content if (content := self.spacerItem()) else None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_control_types(self) -> list[widgets.sizepolicy.ControlTypeStr]:
                                                                                                                                                                                                                                                                                                                  return widgets.sizepolicy.CONTROL_TYPE.get_list(self.controlTypes())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_expanding_directions(self) -> list[constants.OrientationStr]:
                                                                                                                                                                                                                                                                                                                  return constants.ORIENTATION.get_list(self.expandingDirections())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_alignment() -> constants.AlignmentStr

                                                                                                                                                                                                                                                                                                          Return current alignment.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/layoutitem.py
                                                                                                                                                                                                                                                                                                          def get_alignment(self) -> constants.AlignmentStr:
                                                                                                                                                                                                                                                                                                              """Return current alignment.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  alignment
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.ALIGNMENTS.inverse[self.alignment()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_alignment(alignment: constants.AlignmentStr)

                                                                                                                                                                                                                                                                                                          Set the alignment of the layout.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          alignment AlignmentStr

                                                                                                                                                                                                                                                                                                          alignment for the layout

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/layoutitem.py
                                                                                                                                                                                                                                                                                                          def set_alignment(self, alignment: constants.AlignmentStr):
                                                                                                                                                                                                                                                                                                              """Set the alignment of the layout.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  alignment: alignment for the layout
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setAlignment(constants.ALIGNMENTS.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          LayoutMixin

                                                                                                                                                                                                                                                                                                          Bases: ObjectMixin, LayoutItemMixin, _LayoutBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/layout.py
                                                                                                                                                                                                                                                                                                          class LayoutMixin(core.ObjectMixin, widgets.LayoutItemMixin, _LayoutBase):
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, margin=None, **kwargs):
                                                                                                                                                                                                                                                                                                                  self._next_container = None
                                                                                                                                                                                                                                                                                                                  self._stack = []
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  if margin is not None:
                                                                                                                                                                                                                                                                                                                      self.set_margin(margin)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def __getitem__(
                                                                                                                                                                                                                                                                                                                  self, index: slice
                                                                                                                                                                                                                                                                                                              ) -> listdelegators.ListDelegator[widgets.QWidget | widgets.QLayout]: ...
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def __getitem__(self, index: int | str) -> widgets.QWidget | widgets.QLayout: ...
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(
                                                                                                                                                                                                                                                                                                                  self, index: str | int | slice
                                                                                                                                                                                                                                                                                                              ) -> (
                                                                                                                                                                                                                                                                                                                  widgets.QWidget
                                                                                                                                                                                                                                                                                                                  | widgets.QLayout
                                                                                                                                                                                                                                                                                                                  | listdelegators.ListDelegator[widgets.QWidget | widgets.QLayout]
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  match index:
                                                                                                                                                                                                                                                                                                                      case int():
                                                                                                                                                                                                                                                                                                                          if index < 0:
                                                                                                                                                                                                                                                                                                                              index += self.count()
                                                                                                                                                                                                                                                                                                                          if index < 0 or index >= self.count():
                                                                                                                                                                                                                                                                                                                              raise IndexError(index)
                                                                                                                                                                                                                                                                                                                          if (item := self.itemAt(index)) is None:
                                                                                                                                                                                                                                                                                                                              raise IndexError(index)
                                                                                                                                                                                                                                                                                                                          widget = item.widget()
                                                                                                                                                                                                                                                                                                                          # None for spacer items, typed without it for convenience
                                                                                                                                                                                                                                                                                                                          return widget if widget is not None else item.layout()  # ty: ignore[invalid-explicit-return]
                                                                                                                                                                                                                                                                                                                      case str():
                                                                                                                                                                                                                                                                                                                          if (item := self.find_child(typ=core.QObject, name=index)) is not None:
                                                                                                                                                                                                                                                                                                                              return cast("widgets.QWidget | widgets.QLayout", item)
                                                                                                                                                                                                                                                                                                                          raise KeyError(index)
                                                                                                                                                                                                                                                                                                                      case slice():
                                                                                                                                                                                                                                                                                                                          rng = range(*index.indices(self.count()))
                                                                                                                                                                                                                                                                                                                          children = [self[i] for i in rng]
                                                                                                                                                                                                                                                                                                                          return listdelegators.ListDelegator(children, parent=self)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise TypeError(index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __setitem__(self, key, value):
                                                                                                                                                                                                                                                                                                                  if self._container != self:
                                                                                                                                                                                                                                                                                                                      self._container.__setitem__(key, value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __delitem__(self, item: int | widgets.QLayoutItem):
                                                                                                                                                                                                                                                                                                                  layout_item = self.itemAt(item) if isinstance(item, int) else item
                                                                                                                                                                                                                                                                                                                  if layout_item is None:
                                                                                                                                                                                                                                                                                                                      raise IndexError(item)
                                                                                                                                                                                                                                                                                                                  w = layout_item.widget()
                                                                                                                                                                                                                                                                                                                  child = w if w is not None else layout_item.layout()
                                                                                                                                                                                                                                                                                                                  self.removeItem(layout_item)
                                                                                                                                                                                                                                                                                                                  if child is not None:
                                                                                                                                                                                                                                                                                                                      child.deleteLater()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __len__(self) -> int:
                                                                                                                                                                                                                                                                                                                  return self.count()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __iter__(self) -> Iterator[widgets.QWidget | widgets.QLayout | None]:
                                                                                                                                                                                                                                                                                                                  return iter(self[i] for i in range(self.count()))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __contains__(self, item: widgets.QWidget | widgets.QLayoutItem):
                                                                                                                                                                                                                                                                                                                  return self.indexOf(item) >= 0
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __iadd__(self, item, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  self.add(item, *args, **kwargs)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {"sizeConstraint": SIZE_CONSTRAINT}
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add(self, item, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  match item:
                                                                                                                                                                                                                                                                                                                      case widgets.QWidget():
                                                                                                                                                                                                                                                                                                                          self._container.addWidget(item, *args, **kwargs)
                                                                                                                                                                                                                                                                                                                      case widgets.QLayout():
                                                                                                                                                                                                                                                                                                                          self._container.addLayout(item, *args, **kwargs)
                                                                                                                                                                                                                                                                                                                      case widgets.QLayoutItem():
                                                                                                                                                                                                                                                                                                                          self._container.addItem(item, *args, **kwargs)
                                                                                                                                                                                                                                                                                                                      case list():
                                                                                                                                                                                                                                                                                                                          for i in item:
                                                                                                                                                                                                                                                                                                                              self._container.add(i, *args, **kwargs)
                                                                                                                                                                                                                                                                                                                  return item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __enter__(self):
                                                                                                                                                                                                                                                                                                                  def enter(item):
                                                                                                                                                                                                                                                                                                                      if item._next_container is not None:
                                                                                                                                                                                                                                                                                                                          enter(item._next_container)
                                                                                                                                                                                                                                                                                                                          item._stack.append(item._next_container)
                                                                                                                                                                                                                                                                                                                          item._next_container = None
                                                                                                                                                                                                                                                                                                                      return item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  return enter(self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __exit__(self, *_):
                                                                                                                                                                                                                                                                                                                  def exit(item):  # noqa: A001
                                                                                                                                                                                                                                                                                                                      if item._stack:
                                                                                                                                                                                                                                                                                                                          item = item._stack.pop()
                                                                                                                                                                                                                                                                                                                          exit(item)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  exit(self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @property
                                                                                                                                                                                                                                                                                                              def _container(self):
                                                                                                                                                                                                                                                                                                                  return self._stack[-1] if self._stack else self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_widget(self, widget: widgets.QWidget):
                                                                                                                                                                                                                                                                                                                  self.addWidget(widget)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_sub_layout(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  layout: str,
                                                                                                                                                                                                                                                                                                                  orientation: constants.OrientationStr | None = None,
                                                                                                                                                                                                                                                                                                                  stretch: int | None = None,
                                                                                                                                                                                                                                                                                                                  **kwargs,
                                                                                                                                                                                                                                                                                                              ) -> Self:
                                                                                                                                                                                                                                                                                                                  from prettyqt import custom_widgets
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  # dynamic dispatch on the layout name, the classes have different signatures
                                                                                                                                                                                                                                                                                                                  ctx_layouts: dict[str, Any] = dict(
                                                                                                                                                                                                                                                                                                                      horizontal=widgets.HBoxLayout,
                                                                                                                                                                                                                                                                                                                      vertical=widgets.VBoxLayout,
                                                                                                                                                                                                                                                                                                                      grid=widgets.GridLayout,
                                                                                                                                                                                                                                                                                                                      form=widgets.FormLayout,
                                                                                                                                                                                                                                                                                                                      stacked=widgets.StackedLayout,
                                                                                                                                                                                                                                                                                                                      flow=custom_widgets.FlowLayout,
                                                                                                                                                                                                                                                                                                                      splitter=widgets.Splitter,
                                                                                                                                                                                                                                                                                                                      scroll=widgets.ScrollArea,
                                                                                                                                                                                                                                                                                                                      frame=widgets.GroupBox,
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  kls = ctx_layouts[layout]
                                                                                                                                                                                                                                                                                                                  match self._container:
                                                                                                                                                                                                                                                                                                                      case widgets.QWidget() if layout == "scroll":
                                                                                                                                                                                                                                                                                                                          scroller = kls(parent=self._container)
                                                                                                                                                                                                                                                                                                                          scroller.setWidgetResizable(True)
                                                                                                                                                                                                                                                                                                                          widget = widgets.Widget()
                                                                                                                                                                                                                                                                                                                          scroller.set_widget(widget)
                                                                                                                                                                                                                                                                                                                          new = widget.set_layout(orientation or "vertical", **kwargs)
                                                                                                                                                                                                                                                                                                                      case widgets.QLayout() if layout == "scroll":
                                                                                                                                                                                                                                                                                                                          scroller = kls(parent=self._container)
                                                                                                                                                                                                                                                                                                                          scroller.setWidgetResizable(True)
                                                                                                                                                                                                                                                                                                                          widget = widgets.Widget()
                                                                                                                                                                                                                                                                                                                          scroller.set_widget(widget)
                                                                                                                                                                                                                                                                                                                          new = widget.set_layout(orientation or "vertical", **kwargs)
                                                                                                                                                                                                                                                                                                                          self._container.add(new)
                                                                                                                                                                                                                                                                                                                      case widgets.QWidget() if layout == "splitter":
                                                                                                                                                                                                                                                                                                                          new = kls(orientation=orientation, parent=self._container, **kwargs)
                                                                                                                                                                                                                                                                                                                      case widgets.QLayout() if layout == "splitter":
                                                                                                                                                                                                                                                                                                                          new = kls(orientation=orientation, **kwargs)
                                                                                                                                                                                                                                                                                                                          self._container.add(new)
                                                                                                                                                                                                                                                                                                                      case widgets.QWidget() if layout == "frame":
                                                                                                                                                                                                                                                                                                                          frame = kls(parent=self._container, **kwargs)
                                                                                                                                                                                                                                                                                                                          widget = widgets.Widget()
                                                                                                                                                                                                                                                                                                                          new = widget.set_layout(orientation or "horizontal")
                                                                                                                                                                                                                                                                                                                          frame.set_layout(new)
                                                                                                                                                                                                                                                                                                                      case widgets.QLayout() if layout == "frame":
                                                                                                                                                                                                                                                                                                                          frame = kls(**kwargs)
                                                                                                                                                                                                                                                                                                                          widget = widgets.Widget()
                                                                                                                                                                                                                                                                                                                          new = widget.set_layout(orientation or "horizontal")
                                                                                                                                                                                                                                                                                                                          frame.set_layout(new)
                                                                                                                                                                                                                                                                                                                          self._container.add(new)
                                                                                                                                                                                                                                                                                                                      case widgets.QMainWindow():
                                                                                                                                                                                                                                                                                                                          widget = widgets.Widget(parent=self._container)
                                                                                                                                                                                                                                                                                                                          self._container.setCentralWidget(widget)
                                                                                                                                                                                                                                                                                                                          new = kls(widget, **kwargs)
                                                                                                                                                                                                                                                                                                                      case widgets.QScrollArea():
                                                                                                                                                                                                                                                                                                                          widget = widgets.Widget(parent=self._container)
                                                                                                                                                                                                                                                                                                                          self._container.setWidget(widget)
                                                                                                                                                                                                                                                                                                                          self._container.setWidgetResizable(True)
                                                                                                                                                                                                                                                                                                                          new = widget.set_layout("vertical", **kwargs)
                                                                                                                                                                                                                                                                                                                      case widgets.QSplitter():
                                                                                                                                                                                                                                                                                                                          widget = widgets.Widget(parent=self._container)
                                                                                                                                                                                                                                                                                                                          self._container.addWidget(widget)
                                                                                                                                                                                                                                                                                                                          new = kls(widget, **kwargs)
                                                                                                                                                                                                                                                                                                                      case None | widgets.QWidget():
                                                                                                                                                                                                                                                                                                                          new = kls(self._container, **kwargs)
                                                                                                                                                                                                                                                                                                                      case widgets.QLayout():
                                                                                                                                                                                                                                                                                                                          new = kls(**kwargs)
                                                                                                                                                                                                                                                                                                                          if stretch:
                                                                                                                                                                                                                                                                                                                              self._container.add(new, stretch)
                                                                                                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                                                                                                              self._container.add(new)
                                                                                                                                                                                                                                                                                                                  new._stack = []
                                                                                                                                                                                                                                                                                                                  new._next_container = None
                                                                                                                                                                                                                                                                                                                  self._next_container = new
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def item_at(self, pos_or_index: int | core.Point) -> widgets.QLayoutItem | None:
                                                                                                                                                                                                                                                                                                                  match pos_or_index:
                                                                                                                                                                                                                                                                                                                      case int():
                                                                                                                                                                                                                                                                                                                          return super().itemAt(pos_or_index)
                                                                                                                                                                                                                                                                                                                      case core.QPoint():
                                                                                                                                                                                                                                                                                                                          for i in range(self.count()):
                                                                                                                                                                                                                                                                                                                              item = self.itemAt(i)
                                                                                                                                                                                                                                                                                                                              if item is not None and item.geometry().contains(pos_or_index):
                                                                                                                                                                                                                                                                                                                                  return item
                                                                                                                                                                                                                                                                                                                          return None
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise ValueError(pos_or_index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def clear(self):
                                                                                                                                                                                                                                                                                                                  for i in reversed(range(self.count())):
                                                                                                                                                                                                                                                                                                                      self.takeAt(i)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # def takeAt(self, index: int):
                                                                                                                                                                                                                                                                                                              #     if index < 0:
                                                                                                                                                                                                                                                                                                              #         index = self.count() + index
                                                                                                                                                                                                                                                                                                              #     return super().takeAt(index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_items(self):
                                                                                                                                                                                                                                                                                                                  return [self.itemAt(i) for i in range(self.count())]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_children(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                              ) -> listdelegators.ListDelegator[widgets.QWidget | widgets.QLayout]:
                                                                                                                                                                                                                                                                                                                  return listdelegators.ListDelegator(self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_margin(self, margin: datatypes.MarginsType | None):
                                                                                                                                                                                                                                                                                                                  match margin:
                                                                                                                                                                                                                                                                                                                      case None:
                                                                                                                                                                                                                                                                                                                          self.unsetContentsMargins()
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          margin = datatypes.to_margins(margin)
                                                                                                                                                                                                                                                                                                                          self.setContentsMargins(margin)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_spacing(self, pixels: int):
                                                                                                                                                                                                                                                                                                                  self.setSpacing(pixels)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_size_constraint(
                                                                                                                                                                                                                                                                                                                  self, mode: SizeConstraintStr | widgets.QLayout.SizeConstraint
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the size mode of the layout.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: size mode for the layout
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setSizeConstraint(SIZE_CONSTRAINT.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_size_constraint(self) -> SizeConstraintStr:
                                                                                                                                                                                                                                                                                                                  """Return current size mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      size mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return SIZE_CONSTRAINT.inverse[self.sizeConstraint()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_alignment(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  alignment: constants.AlignmentStr | constants.AlignmentFlag,
                                                                                                                                                                                                                                                                                                                  item: widgets.QWidget | widgets.QLayout | None = None,
                                                                                                                                                                                                                                                                                                              ) -> bool:
                                                                                                                                                                                                                                                                                                                  """Set the alignment for widget / layout to alignment.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns true if w is found in this layout (not including child layouts).
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      alignment: alignment for the layout
                                                                                                                                                                                                                                                                                                                      item: set alignment for specific child only
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if item is not None:
                                                                                                                                                                                                                                                                                                                      return self.setAlignment(item, constants.ALIGNMENTS.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                                  self.setAlignment(constants.ALIGNMENTS.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                                  return True
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_size_constraint() -> SizeConstraintStr

                                                                                                                                                                                                                                                                                                          Return current size mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/layout.py
                                                                                                                                                                                                                                                                                                          def get_size_constraint(self) -> SizeConstraintStr:
                                                                                                                                                                                                                                                                                                              """Return current size mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  size mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return SIZE_CONSTRAINT.inverse[self.sizeConstraint()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_alignment(alignment: constants.AlignmentStr | constants.AlignmentFlag, item: widgets.QWidget | widgets.QLayout | None = None) -> bool

                                                                                                                                                                                                                                                                                                          Set the alignment for widget / layout to alignment.

                                                                                                                                                                                                                                                                                                          Returns true if w is found in this layout (not including child layouts).

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          alignment AlignmentStr | AlignmentFlag

                                                                                                                                                                                                                                                                                                          alignment for the layout

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          item QWidget | QLayout | None

                                                                                                                                                                                                                                                                                                          set alignment for specific child only

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/layout.py
                                                                                                                                                                                                                                                                                                          def set_alignment(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              alignment: constants.AlignmentStr | constants.AlignmentFlag,
                                                                                                                                                                                                                                                                                                              item: widgets.QWidget | widgets.QLayout | None = None,
                                                                                                                                                                                                                                                                                                          ) -> bool:
                                                                                                                                                                                                                                                                                                              """Set the alignment for widget / layout to alignment.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns true if w is found in this layout (not including child layouts).
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  alignment: alignment for the layout
                                                                                                                                                                                                                                                                                                                  item: set alignment for specific child only
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if item is not None:
                                                                                                                                                                                                                                                                                                                  return self.setAlignment(item, constants.ALIGNMENTS.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                              self.setAlignment(constants.ALIGNMENTS.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                              return True
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_size_constraint(mode: SizeConstraintStr | widgets.QLayout.SizeConstraint)

                                                                                                                                                                                                                                                                                                          Set the size mode of the layout.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode SizeConstraintStr | SizeConstraint

                                                                                                                                                                                                                                                                                                          size mode for the layout

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/layout.py
                                                                                                                                                                                                                                                                                                          def set_size_constraint(
                                                                                                                                                                                                                                                                                                              self, mode: SizeConstraintStr | widgets.QLayout.SizeConstraint
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the size mode of the layout.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: size mode for the layout
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setSizeConstraint(SIZE_CONSTRAINT.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          LineEdit

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QLineEdit

                                                                                                                                                                                                                                                                                                          One-line text editor.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/lineedit.py
                                                                                                                                                                                                                                                                                                          class LineEdit(widgets.WidgetMixin, widgets.QLineEdit):
                                                                                                                                                                                                                                                                                                              """One-line text editor."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(str)
                                                                                                                                                                                                                                                                                                              tab_pressed = core.Signal()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  self._validation_color = gui.Color("orange")
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.textChanged.connect(self._on_value_change)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def supports(cls, instance) -> bool:
                                                                                                                                                                                                                                                                                                                  return isinstance(instance, str)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _on_value_change(self):
                                                                                                                                                                                                                                                                                                                  val = self.get_value()
                                                                                                                                                                                                                                                                                                                  self._update_background()
                                                                                                                                                                                                                                                                                                                  self.value_changed.emit(val)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __repr__(self):
                                                                                                                                                                                                                                                                                                                  return get_repr(self, self.text())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __add__(self, other: str):
                                                                                                                                                                                                                                                                                                                  self.append_text(other)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "echoMode": ECHO_MODE,
                                                                                                                                                                                                                                                                                                                      "cursorMoveStyle": constants.CURSOR_MOVE_STYLE,
                                                                                                                                                                                                                                                                                                                      "alignment": constants.ALIGNMENTS,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def font(self) -> gui.Font:
                                                                                                                                                                                                                                                                                                                  return gui.Font(super().font())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def keyPressEvent(self, event):
                                                                                                                                                                                                                                                                                                                  super().keyPressEvent(event)
                                                                                                                                                                                                                                                                                                                  if event.key() == constants.Key.Key_Tab:
                                                                                                                                                                                                                                                                                                                      self.tab_pressed.emit()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def append_text(self, text: str):
                                                                                                                                                                                                                                                                                                                  self.set_text(self.text() + text)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_text(self, text: str):
                                                                                                                                                                                                                                                                                                                  self.setText(text)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_completer(self, completer: widgets.QCompleter | Literal["files"]):
                                                                                                                                                                                                                                                                                                                  match completer:
                                                                                                                                                                                                                                                                                                                      case widgets.QCompleter():
                                                                                                                                                                                                                                                                                                                          self.setCompleter(completer)
                                                                                                                                                                                                                                                                                                                      case "files":
                                                                                                                                                                                                                                                                                                                          model = widgets.FileSystemModel()
                                                                                                                                                                                                                                                                                                                          model.set_root_path("")
                                                                                                                                                                                                                                                                                                                          completer = widgets.Completer(self)
                                                                                                                                                                                                                                                                                                                          completer.setModel(model)
                                                                                                                                                                                                                                                                                                                          self.setCompleter(completer)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_read_only(self, value: bool = True):
                                                                                                                                                                                                                                                                                                                  """Set text to read-only.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      value: True, for read-only, otherwise False
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setReadOnly(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_regex_validator(
                                                                                                                                                                                                                                                                                                                  self, regex: str, flags: int = 0
                                                                                                                                                                                                                                                                                                              ) -> gui.RegularExpressionValidator:
                                                                                                                                                                                                                                                                                                                  validator = gui.RegularExpressionValidator(self)
                                                                                                                                                                                                                                                                                                                  validator.set_regex(regex, flags)
                                                                                                                                                                                                                                                                                                                  self.set_validator(validator)
                                                                                                                                                                                                                                                                                                                  return validator
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_range(self, lower: int | None, upper: int | None):
                                                                                                                                                                                                                                                                                                                  val = gui.IntValidator()
                                                                                                                                                                                                                                                                                                                  val.set_range(lower, upper)
                                                                                                                                                                                                                                                                                                                  self.set_validator(val)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_validator(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  validator: (
                                                                                                                                                                                                                                                                                                                      gui.QValidator | ValidatorStr | datatypes.PatternType | Callable | None
                                                                                                                                                                                                                                                                                                                  ),
                                                                                                                                                                                                                                                                                                                  strict: bool = True,
                                                                                                                                                                                                                                                                                                                  empty_allowed: bool | None = None,
                                                                                                                                                                                                                                                                                                                  append: bool = False,
                                                                                                                                                                                                                                                                                                                  **kwargs,
                                                                                                                                                                                                                                                                                                              ) -> gui.QValidator | None:
                                                                                                                                                                                                                                                                                                                  from prettyqt import validators
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  val: gui.QValidator | None
                                                                                                                                                                                                                                                                                                                  match validator:
                                                                                                                                                                                                                                                                                                                      case str() if "|" in validator:
                                                                                                                                                                                                                                                                                                                          vals = [get_validator(i, **kwargs) for i in validator.split("|")]  # ty: ignore[invalid-argument-type]
                                                                                                                                                                                                                                                                                                                          val = validators.AndValidator(vals)
                                                                                                                                                                                                                                                                                                                      case str() | re.Pattern() | core.QRegularExpression() | Callable():
                                                                                                                                                                                                                                                                                                                          val = get_validator(validator, **kwargs)  # ty: ignore[invalid-argument-type]
                                                                                                                                                                                                                                                                                                                      case None | gui.QValidator():
                                                                                                                                                                                                                                                                                                                          val = validator
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise ValueError(validator)
                                                                                                                                                                                                                                                                                                                  if empty_allowed is False:
                                                                                                                                                                                                                                                                                                                      val = validators.AndValidator([
                                                                                                                                                                                                                                                                                                                          *([val] if val is not None else []),
                                                                                                                                                                                                                                                                                                                          validators.NotEmptyValidator(),
                                                                                                                                                                                                                                                                                                                      ])
                                                                                                                                                                                                                                                                                                                  elif empty_allowed is True:
                                                                                                                                                                                                                                                                                                                      val = validators.OrValidator([
                                                                                                                                                                                                                                                                                                                          *([val] if val is not None else []),
                                                                                                                                                                                                                                                                                                                          validators.EmptyValidator(),
                                                                                                                                                                                                                                                                                                                      ])
                                                                                                                                                                                                                                                                                                                  if not strict:
                                                                                                                                                                                                                                                                                                                      val = validators.NotStrictValidator(val)
                                                                                                                                                                                                                                                                                                                  if append and (prev := self.validator()) is not None and val is not None:
                                                                                                                                                                                                                                                                                                                      val = validators.AndValidator([prev, val])
                                                                                                                                                                                                                                                                                                                  self.setValidator(val)  # ty: ignore[invalid-argument-type]  # None unsets
                                                                                                                                                                                                                                                                                                                  self._update_background()
                                                                                                                                                                                                                                                                                                                  return val
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_input_mask(self, mask: str):
                                                                                                                                                                                                                                                                                                                  match mask:
                                                                                                                                                                                                                                                                                                                      case "ip_address":
                                                                                                                                                                                                                                                                                                                          mask = "000.000.000.000;_"
                                                                                                                                                                                                                                                                                                                      case "mac_address":
                                                                                                                                                                                                                                                                                                                          mask = "HH:HH:HH:HH:HH:HH;_"
                                                                                                                                                                                                                                                                                                                      case "iso_date":
                                                                                                                                                                                                                                                                                                                          mask = "0000-00-00"
                                                                                                                                                                                                                                                                                                                  self.setInputMask(mask)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _update_background(self):
                                                                                                                                                                                                                                                                                                                  color = None if self.hasAcceptableInput() else self._validation_color
                                                                                                                                                                                                                                                                                                                  self.set_background_color(color)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_validation_color(self, color: datatypes.ColorType):
                                                                                                                                                                                                                                                                                                                  self._validation_color = colors.get_color(color).as_qt()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_validation_color(self) -> gui.QColor:
                                                                                                                                                                                                                                                                                                                  return self._validation_color
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_echo_mode(self, mode: EchoModeStr | widgets.QLineEdit.EchoMode):
                                                                                                                                                                                                                                                                                                                  """Set echo mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: echo mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setEchoMode(ECHO_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_echo_mode(self) -> EchoModeStr:
                                                                                                                                                                                                                                                                                                                  """Return echo mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      echo mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return ECHO_MODE.inverse[self.echoMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_cursor_move_style(
                                                                                                                                                                                                                                                                                                                  self, style: constants.CursorMoveStyleStr | constants.CursorMoveStyle
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set cursor move style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      style: cursor move style to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setCursorMoveStyle(constants.CURSOR_MOVE_STYLE.get_enum_value(style))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_cursor_move_style(self) -> constants.CursorMoveStyleStr:
                                                                                                                                                                                                                                                                                                                  """Return cursor move style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      cursor move style
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.CURSOR_MOVE_STYLE.inverse[self.cursorMoveStyle()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_action(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  action: gui.QAction,
                                                                                                                                                                                                                                                                                                                  position: ActionPositionStr | widgets.QLineEdit.ActionPosition = "trailing",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  self.addAction(action, ACTION_POSITION.get_enum_value(position))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self, value: str):
                                                                                                                                                                                                                                                                                                                  self.setText(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_value(self) -> str:
                                                                                                                                                                                                                                                                                                                  return self.text()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def is_valid(self) -> bool:
                                                                                                                                                                                                                                                                                                                  return self.hasAcceptableInput()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_cursor_move_style() -> constants.CursorMoveStyleStr

                                                                                                                                                                                                                                                                                                          Return cursor move style.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/lineedit.py
                                                                                                                                                                                                                                                                                                          def get_cursor_move_style(self) -> constants.CursorMoveStyleStr:
                                                                                                                                                                                                                                                                                                              """Return cursor move style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  cursor move style
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.CURSOR_MOVE_STYLE.inverse[self.cursorMoveStyle()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_echo_mode() -> EchoModeStr

                                                                                                                                                                                                                                                                                                          Return echo mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/lineedit.py
                                                                                                                                                                                                                                                                                                          def get_echo_mode(self) -> EchoModeStr:
                                                                                                                                                                                                                                                                                                              """Return echo mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  echo mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return ECHO_MODE.inverse[self.echoMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_cursor_move_style(style: constants.CursorMoveStyleStr | constants.CursorMoveStyle)

                                                                                                                                                                                                                                                                                                          Set cursor move style.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          style CursorMoveStyleStr | CursorMoveStyle

                                                                                                                                                                                                                                                                                                          cursor move style to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/lineedit.py
                                                                                                                                                                                                                                                                                                          def set_cursor_move_style(
                                                                                                                                                                                                                                                                                                              self, style: constants.CursorMoveStyleStr | constants.CursorMoveStyle
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set cursor move style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  style: cursor move style to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setCursorMoveStyle(constants.CURSOR_MOVE_STYLE.get_enum_value(style))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_echo_mode(mode: EchoModeStr | widgets.QLineEdit.EchoMode)

                                                                                                                                                                                                                                                                                                          Set echo mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode EchoModeStr | EchoMode

                                                                                                                                                                                                                                                                                                          echo mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/lineedit.py
                                                                                                                                                                                                                                                                                                          def set_echo_mode(self, mode: EchoModeStr | widgets.QLineEdit.EchoMode):
                                                                                                                                                                                                                                                                                                              """Set echo mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: echo mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setEchoMode(ECHO_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_read_only(value: bool = True)

                                                                                                                                                                                                                                                                                                          Set text to read-only.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          value bool

                                                                                                                                                                                                                                                                                                          True, for read-only, otherwise False

                                                                                                                                                                                                                                                                                                          True
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/lineedit.py
                                                                                                                                                                                                                                                                                                          def set_read_only(self, value: bool = True):
                                                                                                                                                                                                                                                                                                              """Set text to read-only.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  value: True, for read-only, otherwise False
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setReadOnly(value)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ListView

                                                                                                                                                                                                                                                                                                          Bases: ListViewMixin, QListView

                                                                                                                                                                                                                                                                                                          List or icon view onto a model.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listview.py
                                                                                                                                                                                                                                                                                                          class ListView(ListViewMixin, widgets.QListView):
                                                                                                                                                                                                                                                                                                              """List or icon view onto a model."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ListViewMixin

                                                                                                                                                                                                                                                                                                          Bases: AbstractItemViewMixin, _ListViewBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listview.py
                                                                                                                                                                                                                                                                                                          class ListViewMixin(widgets.AbstractItemViewMixin, _ListViewBase):
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "viewMode": VIEW_MODE,
                                                                                                                                                                                                                                                                                                                      "resizeMode": RESIZE_MODE,
                                                                                                                                                                                                                                                                                                                      "layoutMode": LAYOUT_MODE,
                                                                                                                                                                                                                                                                                                                      "movement": MOVEMENT,
                                                                                                                                                                                                                                                                                                                      "flow": FLOW,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_view_mode(self, mode: ViewModeStr | widgets.QListView.ViewMode):
                                                                                                                                                                                                                                                                                                                  """Set view mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: view mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setViewMode(VIEW_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_view_mode(self) -> ViewModeStr:
                                                                                                                                                                                                                                                                                                                  """Return view mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      view mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return VIEW_MODE.inverse[self.viewMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_resize_mode(self, mode: ResizeModeStr | widgets.QListView.ResizeMode):
                                                                                                                                                                                                                                                                                                                  """Set resize mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: resize mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setResizeMode(RESIZE_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_resize_mode(self) -> ResizeModeStr:
                                                                                                                                                                                                                                                                                                                  """Return resize mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      resize mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return RESIZE_MODE.inverse[self.resizeMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_layout_mode(self, mode: LayoutModeStr | widgets.QListView.LayoutMode):
                                                                                                                                                                                                                                                                                                                  """Set layout mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: layout mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setLayoutMode(LAYOUT_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_layout_mode(self) -> LayoutModeStr:
                                                                                                                                                                                                                                                                                                                  """Return layout mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      layout mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return LAYOUT_MODE.inverse[self.layoutMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_movement(self, mode: MovementStr | widgets.QListView.Movement):
                                                                                                                                                                                                                                                                                                                  """Set movement mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: movement mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setMovement(MOVEMENT.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_movement(self) -> MovementStr:
                                                                                                                                                                                                                                                                                                                  """Return movement mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      movement mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return MOVEMENT.inverse[self.movement()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_flow(self, mode: FlowStr | widgets.QListView.Flow):
                                                                                                                                                                                                                                                                                                                  """Set flow mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: flow mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setFlow(FLOW.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_flow(self) -> FlowStr:
                                                                                                                                                                                                                                                                                                                  """Return flow mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      flow mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return FLOW.inverse[self.flow()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_grid_size(self, size: datatypes.SizeType):
                                                                                                                                                                                                                                                                                                                  self.setGridSize(datatypes.to_size(size))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_grid_size(self) -> core.Size:
                                                                                                                                                                                                                                                                                                                  return core.Size(self.gridSize())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_flow() -> FlowStr

                                                                                                                                                                                                                                                                                                          Return flow mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listview.py
                                                                                                                                                                                                                                                                                                          def get_flow(self) -> FlowStr:
                                                                                                                                                                                                                                                                                                              """Return flow mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  flow mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return FLOW.inverse[self.flow()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_layout_mode() -> LayoutModeStr

                                                                                                                                                                                                                                                                                                          Return layout mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listview.py
                                                                                                                                                                                                                                                                                                          def get_layout_mode(self) -> LayoutModeStr:
                                                                                                                                                                                                                                                                                                              """Return layout mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  layout mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return LAYOUT_MODE.inverse[self.layoutMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_movement() -> MovementStr

                                                                                                                                                                                                                                                                                                          Return movement mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listview.py
                                                                                                                                                                                                                                                                                                          def get_movement(self) -> MovementStr:
                                                                                                                                                                                                                                                                                                              """Return movement mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  movement mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return MOVEMENT.inverse[self.movement()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_resize_mode() -> ResizeModeStr

                                                                                                                                                                                                                                                                                                          Return resize mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listview.py
                                                                                                                                                                                                                                                                                                          def get_resize_mode(self) -> ResizeModeStr:
                                                                                                                                                                                                                                                                                                              """Return resize mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  resize mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return RESIZE_MODE.inverse[self.resizeMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_view_mode() -> ViewModeStr

                                                                                                                                                                                                                                                                                                          Return view mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listview.py
                                                                                                                                                                                                                                                                                                          def get_view_mode(self) -> ViewModeStr:
                                                                                                                                                                                                                                                                                                              """Return view mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  view mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return VIEW_MODE.inverse[self.viewMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_flow(mode: FlowStr | widgets.QListView.Flow)

                                                                                                                                                                                                                                                                                                          Set flow mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode FlowStr | Flow

                                                                                                                                                                                                                                                                                                          flow mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listview.py
                                                                                                                                                                                                                                                                                                          def set_flow(self, mode: FlowStr | widgets.QListView.Flow):
                                                                                                                                                                                                                                                                                                              """Set flow mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: flow mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setFlow(FLOW.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_layout_mode(mode: LayoutModeStr | widgets.QListView.LayoutMode)

                                                                                                                                                                                                                                                                                                          Set layout mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode LayoutModeStr | LayoutMode

                                                                                                                                                                                                                                                                                                          layout mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listview.py
                                                                                                                                                                                                                                                                                                          def set_layout_mode(self, mode: LayoutModeStr | widgets.QListView.LayoutMode):
                                                                                                                                                                                                                                                                                                              """Set layout mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: layout mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setLayoutMode(LAYOUT_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_movement(mode: MovementStr | widgets.QListView.Movement)

                                                                                                                                                                                                                                                                                                          Set movement mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode MovementStr | Movement

                                                                                                                                                                                                                                                                                                          movement mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listview.py
                                                                                                                                                                                                                                                                                                          def set_movement(self, mode: MovementStr | widgets.QListView.Movement):
                                                                                                                                                                                                                                                                                                              """Set movement mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: movement mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setMovement(MOVEMENT.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_resize_mode(mode: ResizeModeStr | widgets.QListView.ResizeMode)

                                                                                                                                                                                                                                                                                                          Set resize mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ResizeModeStr | ResizeMode

                                                                                                                                                                                                                                                                                                          resize mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listview.py
                                                                                                                                                                                                                                                                                                          def set_resize_mode(self, mode: ResizeModeStr | widgets.QListView.ResizeMode):
                                                                                                                                                                                                                                                                                                              """Set resize mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: resize mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setResizeMode(RESIZE_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_view_mode(mode: ViewModeStr | widgets.QListView.ViewMode)

                                                                                                                                                                                                                                                                                                          Set view mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ViewModeStr | ViewMode

                                                                                                                                                                                                                                                                                                          view mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listview.py
                                                                                                                                                                                                                                                                                                          def set_view_mode(self, mode: ViewModeStr | widgets.QListView.ViewMode):
                                                                                                                                                                                                                                                                                                              """Set view mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: view mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setViewMode(VIEW_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ListWidget

                                                                                                                                                                                                                                                                                                          Bases: ListViewMixin, QListWidget

                                                                                                                                                                                                                                                                                                          Item-based list widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listwidget.py
                                                                                                                                                                                                                                                                                                          class ListWidget(widgets.ListViewMixin, widgets.QListWidget):
                                                                                                                                                                                                                                                                                                              """Item-based list widget."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(object)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, selection_mode: str = "single", **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, selection_mode=selection_mode, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.itemSelectionChanged.connect(self.on_index_change)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __repr__(self):
                                                                                                                                                                                                                                                                                                                  return f"{type(self).__name__}: {self.count()} items"
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(
                                                                                                                                                                                                                                                                                                                  self, row: int | slice
                                                                                                                                                                                                                                                                                                              ) -> widgets.QListWidgetItem | listdelegators.ListDelegator[widgets.QListWidgetItem]:
                                                                                                                                                                                                                                                                                                                  match row:
                                                                                                                                                                                                                                                                                                                      case int():
                                                                                                                                                                                                                                                                                                                          item = self.item(row)
                                                                                                                                                                                                                                                                                                                          if item is None:
                                                                                                                                                                                                                                                                                                                              raise KeyError(row)
                                                                                                                                                                                                                                                                                                                          return item
                                                                                                                                                                                                                                                                                                                      case slice():
                                                                                                                                                                                                                                                                                                                          count = self.count() if row.stop is None else row.stop
                                                                                                                                                                                                                                                                                                                          values = list(range(count)[row])
                                                                                                                                                                                                                                                                                                                          ls = [self.item(i) for i in values]
                                                                                                                                                                                                                                                                                                                          return listdelegators.ListDelegator(ls)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise TypeError(row)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __delitem__(self, row: int):
                                                                                                                                                                                                                                                                                                                  self.takeItem(row)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __add__(self, other: widgets.QListWidgetItem):
                                                                                                                                                                                                                                                                                                                  self.addItem(other)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __iter__(self) -> Iterator[widgets.QListWidgetItem]:
                                                                                                                                                                                                                                                                                                                  return iter(self.get_children())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __len__(self) -> int:
                                                                                                                                                                                                                                                                                                                  return self.count()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def sort(self, reverse: bool = False):
                                                                                                                                                                                                                                                                                                                  order = constants.DESCENDING if reverse else constants.ASCENDING
                                                                                                                                                                                                                                                                                                                  self.sortItems(order)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def on_index_change(self):
                                                                                                                                                                                                                                                                                                                  data = self.get_value()
                                                                                                                                                                                                                                                                                                                  self.value_changed.emit(data)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_children(self) -> listdelegators.ListDelegator[widgets.QListWidgetItem]:
                                                                                                                                                                                                                                                                                                                  items = [self.item(row) for row in range(self.count())]
                                                                                                                                                                                                                                                                                                                  return listdelegators.ListDelegator(items)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_items(self, items: Iterable | Mapping):
                                                                                                                                                                                                                                                                                                                  match items:
                                                                                                                                                                                                                                                                                                                      case Mapping():
                                                                                                                                                                                                                                                                                                                          for k, v in items.items():
                                                                                                                                                                                                                                                                                                                              self.add(v, k)
                                                                                                                                                                                                                                                                                                                      case Iterable():
                                                                                                                                                                                                                                                                                                                          for i in items:
                                                                                                                                                                                                                                                                                                                              if isinstance(i, tuple | list):
                                                                                                                                                                                                                                                                                                                                  self.add(*i)
                                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                                  self.add(i)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise TypeError(items)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @functools.singledispatchmethod
                                                                                                                                                                                                                                                                                                              def add_item(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  name: str = "",
                                                                                                                                                                                                                                                                                                                  icon: datatypes.IconType = None,
                                                                                                                                                                                                                                                                                                                  data: dict | None = None,
                                                                                                                                                                                                                                                                                                                  foreground: QtGui.QBrush | None = None,
                                                                                                                                                                                                                                                                                                                  background: QtGui.QBrush | None = None,
                                                                                                                                                                                                                                                                                                                  font: QtGui.QFont | None = None,
                                                                                                                                                                                                                                                                                                                  selected: bool | None = None,
                                                                                                                                                                                                                                                                                                                  status_tip: str = "",
                                                                                                                                                                                                                                                                                                                  tool_tip: str = "",
                                                                                                                                                                                                                                                                                                                  whats_this: str | None = None,
                                                                                                                                                                                                                                                                                                                  # text_alignment: Optional[str] = None,
                                                                                                                                                                                                                                                                                                                  checkstate: constants.CheckStateStr | constants.CheckState | None = None,
                                                                                                                                                                                                                                                                                                                  flags: constants.ItemFlag | None = None,
                                                                                                                                                                                                                                                                                                                  size_hint: datatypes.SizeType | None = None,
                                                                                                                                                                                                                                                                                                                  is_user_type: bool = False,
                                                                                                                                                                                                                                                                                                              ) -> widgets.ListWidgetItem:
                                                                                                                                                                                                                                                                                                                  typ = 1 if is_user_type else 0
                                                                                                                                                                                                                                                                                                                  item = widgets.ListWidgetItem(name, self, typ)
                                                                                                                                                                                                                                                                                                                  if icon is not None:
                                                                                                                                                                                                                                                                                                                      icon = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                                      item.setIcon(icon)
                                                                                                                                                                                                                                                                                                                  if data is not None:
                                                                                                                                                                                                                                                                                                                      for k, v in data.items():
                                                                                                                                                                                                                                                                                                                          item.set_data(k, v)
                                                                                                                                                                                                                                                                                                                  if foreground is not None:
                                                                                                                                                                                                                                                                                                                      item.setForeground(foreground)
                                                                                                                                                                                                                                                                                                                  if background is not None:
                                                                                                                                                                                                                                                                                                                      item.setBackground(background)
                                                                                                                                                                                                                                                                                                                  if font is not None:
                                                                                                                                                                                                                                                                                                                      item.setFont(font)
                                                                                                                                                                                                                                                                                                                  if flags is not None:
                                                                                                                                                                                                                                                                                                                      item.setFlags(flags)
                                                                                                                                                                                                                                                                                                                  if selected:
                                                                                                                                                                                                                                                                                                                      item.setSelected(selected)
                                                                                                                                                                                                                                                                                                                  if status_tip:
                                                                                                                                                                                                                                                                                                                      item.setStatusTip(status_tip)
                                                                                                                                                                                                                                                                                                                  if tool_tip:
                                                                                                                                                                                                                                                                                                                      item.setToolTip(tool_tip)
                                                                                                                                                                                                                                                                                                                  if whats_this:
                                                                                                                                                                                                                                                                                                                      item.setWhatsThis(whats_this)
                                                                                                                                                                                                                                                                                                                  if size_hint is not None:
                                                                                                                                                                                                                                                                                                                      item.set_size_hint(size_hint)
                                                                                                                                                                                                                                                                                                                  if checkstate is not None:
                                                                                                                                                                                                                                                                                                                      item.set_checkstate(checkstate)
                                                                                                                                                                                                                                                                                                                  self.addItem(item)
                                                                                                                                                                                                                                                                                                                  return item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @add_item.register
                                                                                                                                                                                                                                                                                                              def _(self, listitem: widgets.QListWidgetItem):
                                                                                                                                                                                                                                                                                                                  self.addItem(listitem)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add(self, label: str, data=NoData, icon: datatypes.IconType = None):
                                                                                                                                                                                                                                                                                                                  if data is NoData:
                                                                                                                                                                                                                                                                                                                      data = label
                                                                                                                                                                                                                                                                                                                  item = widgets.ListWidgetItem(label)
                                                                                                                                                                                                                                                                                                                  item.set_icon(icon)
                                                                                                                                                                                                                                                                                                                  item.setData(constants.USER_ROLE, data)
                                                                                                                                                                                                                                                                                                                  self.addItem(item)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_value(self) -> list[Any]:
                                                                                                                                                                                                                                                                                                                  return [i.data(constants.USER_ROLE) for i in self.selectedItems()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self, value):
                                                                                                                                                                                                                                                                                                                  for i in self.get_children():
                                                                                                                                                                                                                                                                                                                      if i.data(constants.USER_ROLE) in value:
                                                                                                                                                                                                                                                                                                                          self.setCurrentItem(i)
                                                                                                                                                                                                                                                                                                                          break
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def scroll_to_item(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  item: widgets.QListWidgetItem,
                                                                                                                                                                                                                                                                                                                  mode: (
                                                                                                                                                                                                                                                                                                                      widgets.abstractitemview.ScrollHintStr | widgets.QAbstractItemView.ScrollHint
                                                                                                                                                                                                                                                                                                                  ) = "ensure_visible",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  self.scrollToItem(item, widgets.abstractitemview.SCROLL_HINT.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def find_items(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  text: str,
                                                                                                                                                                                                                                                                                                                  column: int = 0,
                                                                                                                                                                                                                                                                                                                  mode: constants.MatchFlagStr | constants.MatchFlag = "exact",
                                                                                                                                                                                                                                                                                                                  recursive: bool = False,
                                                                                                                                                                                                                                                                                                                  case_sensitive: bool = False,
                                                                                                                                                                                                                                                                                                              ) -> listdelegators.ListDelegator[widgets.QListWidgetItem]:
                                                                                                                                                                                                                                                                                                                  flag = constants.MATCH_FLAGS.get_enum_value(mode)
                                                                                                                                                                                                                                                                                                                  if recursive:
                                                                                                                                                                                                                                                                                                                      flag |= constants.MatchFlag.MatchRecursive
                                                                                                                                                                                                                                                                                                                  if case_sensitive:
                                                                                                                                                                                                                                                                                                                      flag |= constants.MatchFlag.MatchCaseSensitive
                                                                                                                                                                                                                                                                                                                  items = self.findItems(text, flag, column)  # type: ignore
                                                                                                                                                                                                                                                                                                                  return listdelegators.ListDelegator(items)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ListWidgetItem

                                                                                                                                                                                                                                                                                                          Bases: SerializeMixin, QListWidgetItem

                                                                                                                                                                                                                                                                                                          Item for use with the QListWidget item view class.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listwidgetitem.py
                                                                                                                                                                                                                                                                                                          class ListWidgetItem(serializemixin.SerializeMixin, QtWidgets.QListWidgetItem):
                                                                                                                                                                                                                                                                                                              """Item for use with the QListWidget item view class."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __repr__(self):
                                                                                                                                                                                                                                                                                                                  return get_repr(self, self.icon(), self.text())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __setitem__(self, index: int | constants.ItemDataRoleStr, value):
                                                                                                                                                                                                                                                                                                                  self.set_data(index, value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(self, index: int | constants.ItemDataRoleStr):
                                                                                                                                                                                                                                                                                                                  return self.get_data(index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_icon(self, icon: datatypes.IconType):
                                                                                                                                                                                                                                                                                                                  """Set the icon for the action.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      icon: icon to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  icon = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                                  self.setIcon(icon)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_checkstate(self, state: constants.CheckStateStr | constants.CheckState):
                                                                                                                                                                                                                                                                                                                  """Set checkstate of the checkbox.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      state: checkstate to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setCheckState(constants.CHECK_STATE.get_enum_value(state))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_checkstate(self) -> constants.CheckStateStr:
                                                                                                                                                                                                                                                                                                                  """Return checkstate.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      checkstate
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.CHECK_STATE.inverse[self.checkState()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_background(self) -> gui.Brush:
                                                                                                                                                                                                                                                                                                                  return gui.Brush(self.background())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_foreground(self) -> gui.Brush:
                                                                                                                                                                                                                                                                                                                  return gui.Brush(self.foreground())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_font(self) -> gui.Font:
                                                                                                                                                                                                                                                                                                                  return gui.Font(self.font())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_icon(self) -> gui.Icon | None:
                                                                                                                                                                                                                                                                                                                  return None if (icon := super().icon()).isNull() else gui.Icon(icon)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_data(self, role: constants.ItemDataRoleStr | int, data: Any):
                                                                                                                                                                                                                                                                                                                  role = constants.ITEM_DATA_ROLE[role] if isinstance(role, str) else role
                                                                                                                                                                                                                                                                                                                  super().setData(role, data)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_data(self, role: constants.ItemDataRoleStr | int):
                                                                                                                                                                                                                                                                                                                  role = constants.ITEM_DATA_ROLE[role] if isinstance(role, str) else role
                                                                                                                                                                                                                                                                                                                  return super().data(role)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_size_hint(self, hint: datatypes.SizeType):
                                                                                                                                                                                                                                                                                                                  super().setSizeHint(datatypes.to_size(hint))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_text_alignment(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  horizontal: constants.HorizontalAlignmentStr
                                                                                                                                                                                                                                                                                                                  | constants.AlignmentFlag
                                                                                                                                                                                                                                                                                                                  | None = None,
                                                                                                                                                                                                                                                                                                                  vertical: constants.VerticalAlignmentStr | constants.AlignmentFlag | None = None,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set text alignment of the checkbox.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      horizontal: horizontal text alignment to use
                                                                                                                                                                                                                                                                                                                      vertical: vertical text alignment to use
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if horizontal is None and vertical is None:
                                                                                                                                                                                                                                                                                                                      return
                                                                                                                                                                                                                                                                                                                  flag = constants.AlignmentFlag(0)
                                                                                                                                                                                                                                                                                                                  if vertical is not None:
                                                                                                                                                                                                                                                                                                                      flag |= constants.V_ALIGNMENT.get_enum_value(vertical)
                                                                                                                                                                                                                                                                                                                  if horizontal is not None:
                                                                                                                                                                                                                                                                                                                      flag |= constants.H_ALIGNMENT.get_enum_value(horizontal)
                                                                                                                                                                                                                                                                                                                  self.setTextAlignment(flag)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_checkstate() -> constants.CheckStateStr

                                                                                                                                                                                                                                                                                                          Return checkstate.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listwidgetitem.py
                                                                                                                                                                                                                                                                                                          def get_checkstate(self) -> constants.CheckStateStr:
                                                                                                                                                                                                                                                                                                              """Return checkstate.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  checkstate
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.CHECK_STATE.inverse[self.checkState()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_checkstate(state: constants.CheckStateStr | constants.CheckState)

                                                                                                                                                                                                                                                                                                          Set checkstate of the checkbox.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          state CheckStateStr | CheckState

                                                                                                                                                                                                                                                                                                          checkstate to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listwidgetitem.py
                                                                                                                                                                                                                                                                                                          def set_checkstate(self, state: constants.CheckStateStr | constants.CheckState):
                                                                                                                                                                                                                                                                                                              """Set checkstate of the checkbox.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  state: checkstate to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setCheckState(constants.CHECK_STATE.get_enum_value(state))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_icon(icon: datatypes.IconType)

                                                                                                                                                                                                                                                                                                          Set the icon for the action.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          icon IconType

                                                                                                                                                                                                                                                                                                          icon to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listwidgetitem.py
                                                                                                                                                                                                                                                                                                          def set_icon(self, icon: datatypes.IconType):
                                                                                                                                                                                                                                                                                                              """Set the icon for the action.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  icon: icon to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              icon = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                              self.setIcon(icon)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_text_alignment(horizontal: constants.HorizontalAlignmentStr | constants.AlignmentFlag | None = None, vertical: constants.VerticalAlignmentStr | constants.AlignmentFlag | None = None)

                                                                                                                                                                                                                                                                                                          Set text alignment of the checkbox.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          horizontal HorizontalAlignmentStr | AlignmentFlag | None

                                                                                                                                                                                                                                                                                                          horizontal text alignment to use

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          vertical VerticalAlignmentStr | AlignmentFlag | None

                                                                                                                                                                                                                                                                                                          vertical text alignment to use

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/listwidgetitem.py
                                                                                                                                                                                                                                                                                                          def set_text_alignment(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              horizontal: constants.HorizontalAlignmentStr
                                                                                                                                                                                                                                                                                                              | constants.AlignmentFlag
                                                                                                                                                                                                                                                                                                              | None = None,
                                                                                                                                                                                                                                                                                                              vertical: constants.VerticalAlignmentStr | constants.AlignmentFlag | None = None,
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set text alignment of the checkbox.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  horizontal: horizontal text alignment to use
                                                                                                                                                                                                                                                                                                                  vertical: vertical text alignment to use
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if horizontal is None and vertical is None:
                                                                                                                                                                                                                                                                                                                  return
                                                                                                                                                                                                                                                                                                              flag = constants.AlignmentFlag(0)
                                                                                                                                                                                                                                                                                                              if vertical is not None:
                                                                                                                                                                                                                                                                                                                  flag |= constants.V_ALIGNMENT.get_enum_value(vertical)
                                                                                                                                                                                                                                                                                                              if horizontal is not None:
                                                                                                                                                                                                                                                                                                                  flag |= constants.H_ALIGNMENT.get_enum_value(horizontal)
                                                                                                                                                                                                                                                                                                              self.setTextAlignment(flag)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          MainWindow

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QMainWindow

                                                                                                                                                                                                                                                                                                          Main application window.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mainwindow.py
                                                                                                                                                                                                                                                                                                          class MainWindow(widgets.WidgetMixin, widgets.QMainWindow):
                                                                                                                                                                                                                                                                                                              """Main application window."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, dock_options=DEFAULT_OPTS, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.setMenuBar(widgets.MenuBar())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(self, index: str) -> widgets.QWidget:
                                                                                                                                                                                                                                                                                                                  result = self.find_child(widgets.QWidget, index)
                                                                                                                                                                                                                                                                                                                  if result is None:
                                                                                                                                                                                                                                                                                                                      msg = "Widget not found"
                                                                                                                                                                                                                                                                                                                      raise KeyError(msg)
                                                                                                                                                                                                                                                                                                                  return result
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "toolButtonStyle": constants.TOOLBUTTON_STYLE,
                                                                                                                                                                                                                                                                                                                      "tabShape": widgets.tabwidget.TAB_SHAPES,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_widget(self, widget: widgets.QWidget | None) -> widgets.QWidget | None:
                                                                                                                                                                                                                                                                                                                  """Set widget and return previous one if existing."""
                                                                                                                                                                                                                                                                                                                  previous = self.takeCentralWidget()
                                                                                                                                                                                                                                                                                                                  if widget:
                                                                                                                                                                                                                                                                                                                      self.setCentralWidget(widget)
                                                                                                                                                                                                                                                                                                                  return previous
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def createPopupMenu(self) -> widgets.Menu:
                                                                                                                                                                                                                                                                                                                  menu = widgets.Menu(parent=self, title="Window")
                                                                                                                                                                                                                                                                                                                  for i, item in enumerate(self.get_docks()):
                                                                                                                                                                                                                                                                                                                      action = gui.Action(
                                                                                                                                                                                                                                                                                                                          text=item.windowTitle(),
                                                                                                                                                                                                                                                                                                                          parent=self,
                                                                                                                                                                                                                                                                                                                          checkable=True,
                                                                                                                                                                                                                                                                                                                          checked=item.isVisible(),
                                                                                                                                                                                                                                                                                                                          shortcut=f"Ctrl+Shift+{i}",
                                                                                                                                                                                                                                                                                                                          shortcut_context="application",
                                                                                                                                                                                                                                                                                                                          toggled=item.setVisible,
                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                                      menu.add(action)
                                                                                                                                                                                                                                                                                                                  menu.add_separator()
                                                                                                                                                                                                                                                                                                                  for tb in self.get_toolbars():
                                                                                                                                                                                                                                                                                                                      action = gui.Action(
                                                                                                                                                                                                                                                                                                                          text=tb.windowTitle(),
                                                                                                                                                                                                                                                                                                                          parent=self,
                                                                                                                                                                                                                                                                                                                          checkable=True,
                                                                                                                                                                                                                                                                                                                          toggled=tb.setVisible,
                                                                                                                                                                                                                                                                                                                          checked=tb.isVisible(),
                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                                      menu.add(action)
                                                                                                                                                                                                                                                                                                                  return menu
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add(self, widget: widgets.QWidget, **kwargs):
                                                                                                                                                                                                                                                                                                                  match widget:
                                                                                                                                                                                                                                                                                                                      case widgets.QToolBar():
                                                                                                                                                                                                                                                                                                                          self.add_toolbar(widget, **kwargs)
                                                                                                                                                                                                                                                                                                                      case widgets.QDockWidget():
                                                                                                                                                                                                                                                                                                                          self.add_dockwidget(widget, **kwargs)
                                                                                                                                                                                                                                                                                                                      case widgets.QWidget():
                                                                                                                                                                                                                                                                                                                          if (central := self.centralWidget()) is None or (
                                                                                                                                                                                                                                                                                                                              layout := central.layout()
                                                                                                                                                                                                                                                                                                                          ) is None:
                                                                                                                                                                                                                                                                                                                              msg = "MainWindow needs a central widget with a layout"
                                                                                                                                                                                                                                                                                                                              raise RuntimeError(msg)
                                                                                                                                                                                                                                                                                                                          cast("widgets.LayoutMixin", layout).add(widget, **kwargs)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_corner(
                                                                                                                                                                                                                                                                                                                  self, corner: constants.CornerStr | constants.Corner
                                                                                                                                                                                                                                                                                                              ) -> constants.DockWidgetAreasStr:
                                                                                                                                                                                                                                                                                                                  corner_flag = constants.CORNER.get_enum_value(corner)
                                                                                                                                                                                                                                                                                                                  area = self.corner(corner_flag)
                                                                                                                                                                                                                                                                                                                  return constants.DOCK_WIDGET_AREAS.inverse[area]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_corner(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  corner: constants.CornerStr | constants.Corner,
                                                                                                                                                                                                                                                                                                                  area: constants.DockWidgetAreaStr | constants.DockWidgetArea,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  corner_flag = constants.CORNER.get_enum_value(corner)
                                                                                                                                                                                                                                                                                                                  area_flag = constants.DOCK_WIDGET_AREAS.get_enum_value(area)
                                                                                                                                                                                                                                                                                                                  self.setCorner(corner_flag, area_flag)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_toolbar(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  toolbar: widgets.QToolBar,
                                                                                                                                                                                                                                                                                                                  area: constants.ToolbarAreaStr | constants.ToolBarArea | Literal["auto"] = "auto",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Adds a toolbar to the mainmenu at specified area.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      toolbar: toolbar to use
                                                                                                                                                                                                                                                                                                                      area: area of the toolbar
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if area == "auto":
                                                                                                                                                                                                                                                                                                                      area = self._get_preferred_toolbar_position()
                                                                                                                                                                                                                                                                                                                  self.addToolBar(constants.TOOLBAR_AREA.get_enum_value(area), toolbar)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_toolbar_break(
                                                                                                                                                                                                                                                                                                                  self, position: constants.ToolbarAreaStr | constants.ToolBarArea = "top"
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Adds a toolbar break to the given area behind the last item.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      position: position of the toolbar
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.addToolBarBreak(constants.TOOLBAR_AREA.get_enum_value(position))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def load_window_state(self, recursive: bool = False) -> bool:
                                                                                                                                                                                                                                                                                                                  settings = core.Settings()
                                                                                                                                                                                                                                                                                                                  name = self.objectName()
                                                                                                                                                                                                                                                                                                                  geom = settings.get(f"{name}.geometry")
                                                                                                                                                                                                                                                                                                                  state = settings.get(f"{name}.state")
                                                                                                                                                                                                                                                                                                                  restored = False
                                                                                                                                                                                                                                                                                                                  if geom is not None and state is not None:
                                                                                                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                                                                                                          logger.debug("Loading window state for %r...", self.windowTitle())
                                                                                                                                                                                                                                                                                                                          self.restoreGeometry(geom)
                                                                                                                                                                                                                                                                                                                          if isinstance(state, str):
                                                                                                                                                                                                                                                                                                                              state = state.encode()
                                                                                                                                                                                                                                                                                                                          self.restoreState(state)
                                                                                                                                                                                                                                                                                                                          restored = True
                                                                                                                                                                                                                                                                                                                      except TypeError:
                                                                                                                                                                                                                                                                                                                          logger.exception(
                                                                                                                                                                                                                                                                                                                              "Wrong type for window state. Probably Qt binding switch?"
                                                                                                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                                                                                                  if recursive:
                                                                                                                                                                                                                                                                                                                      for window in self.find_children(MainWindow, recursive=True):
                                                                                                                                                                                                                                                                                                                          if window.objectName():
                                                                                                                                                                                                                                                                                                                              window.load_window_state()
                                                                                                                                                                                                                                                                                                                  return restored
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def save_window_state(self, recursive: bool = False):
                                                                                                                                                                                                                                                                                                                  """Save current window state as QSetting.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      recursive (bool, optional): Description
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  settings = core.Settings()
                                                                                                                                                                                                                                                                                                                  name = self.objectName()
                                                                                                                                                                                                                                                                                                                  logger.debug("Saving window state for %r...", self.windowTitle())
                                                                                                                                                                                                                                                                                                                  settings[f"{name}.geometry"] = self.saveGeometry()
                                                                                                                                                                                                                                                                                                                  settings[f"{name}.state"] = self.saveState()
                                                                                                                                                                                                                                                                                                                  if recursive:
                                                                                                                                                                                                                                                                                                                      for window in self.find_children(MainWindow, recursive=True):
                                                                                                                                                                                                                                                                                                                          if window.objectName():
                                                                                                                                                                                                                                                                                                                              window.save_window_state()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_widget_as_dock(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  name: str,
                                                                                                                                                                                                                                                                                                                  title: str,
                                                                                                                                                                                                                                                                                                                  layout: widgets.layout.LayoutTypeStr | widgets.QLayout = "horizontal",
                                                                                                                                                                                                                                                                                                                  position: constants.DockWidgetAreaStr | constants.DockWidgetArea = "left",
                                                                                                                                                                                                                                                                                                              ) -> widgets.DockWidget:
                                                                                                                                                                                                                                                                                                                  dock_widget = widgets.DockWidget(self, object_name=name, window_title=title)
                                                                                                                                                                                                                                                                                                                  widget = widgets.Widget()
                                                                                                                                                                                                                                                                                                                  widget.setObjectName(f"{name}.widget")
                                                                                                                                                                                                                                                                                                                  widget.set_layout(layout, margin=0)
                                                                                                                                                                                                                                                                                                                  dock_widget.setWidget(widget)
                                                                                                                                                                                                                                                                                                                  self.add_dockwidget(dock_widget, position)
                                                                                                                                                                                                                                                                                                                  return dock_widget
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def add_dockwidget(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  widget: widgets.QDockWidget,
                                                                                                                                                                                                                                                                                                                  position: constants.DockWidgetAreaStr
                                                                                                                                                                                                                                                                                                                  | constants.DockWidgetArea
                                                                                                                                                                                                                                                                                                                  | Literal["auto"] = "auto",
                                                                                                                                                                                                                                                                                                              ) -> None: ...
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def add_dockwidget(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  widget: widgets.QWidget,
                                                                                                                                                                                                                                                                                                                  position: constants.DockWidgetAreaStr
                                                                                                                                                                                                                                                                                                                  | constants.DockWidgetArea
                                                                                                                                                                                                                                                                                                                  | Literal["auto"] = "auto",
                                                                                                                                                                                                                                                                                                                  **kwargs,
                                                                                                                                                                                                                                                                                                              ) -> widgets.DockWidget: ...
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # Then keep your original implementation unchanged
                                                                                                                                                                                                                                                                                                              def add_dockwidget(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  widget: widgets.QWidget,
                                                                                                                                                                                                                                                                                                                  position: (
                                                                                                                                                                                                                                                                                                                      constants.DockWidgetAreaStr | constants.DockWidgetArea | Literal["auto"]
                                                                                                                                                                                                                                                                                                                  ) = "auto",
                                                                                                                                                                                                                                                                                                                  **kwargs,
                                                                                                                                                                                                                                                                                                              ) -> widgets.DockWidget | None:
                                                                                                                                                                                                                                                                                                                  if position == "auto":
                                                                                                                                                                                                                                                                                                                      position = self._get_preferred_dock_position()
                                                                                                                                                                                                                                                                                                                  if not isinstance(widget, widgets.QDockWidget):
                                                                                                                                                                                                                                                                                                                      dock_widget = widgets.DockWidget(self, **kwargs)
                                                                                                                                                                                                                                                                                                                      dock_widget.set_widget(widget)
                                                                                                                                                                                                                                                                                                                      self.addDockWidget(
                                                                                                                                                                                                                                                                                                                          constants.DOCK_WIDGET_AREA.get_enum_value(position), dock_widget
                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                                      return dock_widget
                                                                                                                                                                                                                                                                                                                  self.addDockWidget(constants.DOCK_WIDGET_AREA.get_enum_value(position), widget)
                                                                                                                                                                                                                                                                                                                  return None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def remove(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  items: (
                                                                                                                                                                                                                                                                                                                      Sequence[widgets.QDockWidget | widgets.QToolBar | gui.QAction]
                                                                                                                                                                                                                                                                                                                      | widgets.QDockWidget
                                                                                                                                                                                                                                                                                                                      | widgets.QToolBar
                                                                                                                                                                                                                                                                                                                      | gui.QAction
                                                                                                                                                                                                                                                                                                                  ),
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  widget_list = items if isinstance(items, list) else [items]
                                                                                                                                                                                                                                                                                                                  for i in widget_list:
                                                                                                                                                                                                                                                                                                                      match i:
                                                                                                                                                                                                                                                                                                                          case widgets.QDockWidget():
                                                                                                                                                                                                                                                                                                                              self.removeDockWidget(i)
                                                                                                                                                                                                                                                                                                                          case widgets.QToolBar():
                                                                                                                                                                                                                                                                                                                              self.removeToolBar(i)
                                                                                                                                                                                                                                                                                                                          case gui.QAction():
                                                                                                                                                                                                                                                                                                                              self.removeAction(i)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def show_blocking(self):
                                                                                                                                                                                                                                                                                                                  self.set_modality("application")
                                                                                                                                                                                                                                                                                                                  self.show()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_dock_area(self, widget: widgets.QDockWidget) -> constants.DockWidgetAreasStr:
                                                                                                                                                                                                                                                                                                                  area = self.dockWidgetArea(widget)
                                                                                                                                                                                                                                                                                                                  return constants.DOCK_WIDGET_AREAS.inverse[area]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_toolbar_area(self, widget: widgets.QToolBar) -> constants.ToolbarAreaStr:
                                                                                                                                                                                                                                                                                                                  area = self.toolBarArea(widget)
                                                                                                                                                                                                                                                                                                                  return constants.TOOLBAR_AREA.inverse[area]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_tool_button_style(
                                                                                                                                                                                                                                                                                                                  self, style: constants.ToolButtonStyleStr | constants.ToolButtonStyle
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  self.setToolButtonStyle(constants.TOOLBUTTON_STYLE.get_enum_value(style))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_tool_button_style(self) -> constants.ToolButtonStyleStr:
                                                                                                                                                                                                                                                                                                                  """Return current tool button style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      tool button style
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.TOOLBUTTON_STYLE.inverse[self.toolButtonStyle()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_tab_shape(
                                                                                                                                                                                                                                                                                                                  self, shape: widgets.tabwidget.TabShapeStr | widgets.QTabWidget.TabShape
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set tab shape for the tabwidget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      shape: tab shape to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setTabShape(widgets.tabwidget.TAB_SHAPES.get_enum_value(shape))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_tab_shape(self) -> widgets.tabwidget.TabShapeStr:
                                                                                                                                                                                                                                                                                                                  """Return tab shape.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      tab shape
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return widgets.tabwidget.TAB_SHAPES.inverse[self.tabShape()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_docks(
                                                                                                                                                                                                                                                                                                                  self, position: constants.DockWidgetAreaStr | None = None
                                                                                                                                                                                                                                                                                                              ) -> listdelegators.ListDelegator[widgets.QDockWidget]:
                                                                                                                                                                                                                                                                                                                  docks = self.find_children(widgets.QDockWidget, recursive=False)
                                                                                                                                                                                                                                                                                                                  if position is None:
                                                                                                                                                                                                                                                                                                                      return docks
                                                                                                                                                                                                                                                                                                                  return listdelegators.ListDelegator([
                                                                                                                                                                                                                                                                                                                      i for i in docks if self.get_dock_area(i) == position
                                                                                                                                                                                                                                                                                                                  ])
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_preferred_dock_position(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  preference: constants.DockWidgetAreaStr = "left",
                                                                                                                                                                                                                                                                                                              ) -> constants.DockWidgetAreaStr:
                                                                                                                                                                                                                                                                                                                  """Get location with least amount of docks. If same score, use preference."""
                                                                                                                                                                                                                                                                                                                  areas = [self.get_dock_area(i) for i in self.get_docks()]
                                                                                                                                                                                                                                                                                                                  # by prepending the prio order, we can choose order because
                                                                                                                                                                                                                                                                                                                  # collections.Counter takes insertion order into account.
                                                                                                                                                                                                                                                                                                                  positions = ["bottom", "top", "right", "left"]
                                                                                                                                                                                                                                                                                                                  positions.remove(preference)
                                                                                                                                                                                                                                                                                                                  positions.append(preference)
                                                                                                                                                                                                                                                                                                                  counter = collections.Counter(positions + areas)  # type: ignore[operator]
                                                                                                                                                                                                                                                                                                                  return counter.most_common()[-1][0]  # ty: ignore[invalid-explicit-return]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_preferred_toolbar_position(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  preference: constants.ToolbarAreaStr = "top",
                                                                                                                                                                                                                                                                                                              ) -> constants.ToolbarAreaStr:
                                                                                                                                                                                                                                                                                                                  """See _get_preferred_dock_position."""
                                                                                                                                                                                                                                                                                                                  areas = [self.get_toolbar_area(i) for i in self.get_toolbars()]
                                                                                                                                                                                                                                                                                                                  positions = ["right", "left", "bottom", "top"]
                                                                                                                                                                                                                                                                                                                  positions.remove(preference)
                                                                                                                                                                                                                                                                                                                  positions.append(preference)
                                                                                                                                                                                                                                                                                                                  counter = collections.Counter(positions + areas)  # type: ignore[operator]
                                                                                                                                                                                                                                                                                                                  return counter.most_common()[-1][0]  # ty: ignore[invalid-explicit-return]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_toolbars(
                                                                                                                                                                                                                                                                                                                  self, position: constants.ToolbarAreaStr | None = None
                                                                                                                                                                                                                                                                                                              ) -> listdelegators.ListDelegator[widgets.QToolBar]:
                                                                                                                                                                                                                                                                                                                  toolbars = self.find_children(widgets.QToolBar, recursive=False)
                                                                                                                                                                                                                                                                                                                  if position is None:
                                                                                                                                                                                                                                                                                                                      return toolbars
                                                                                                                                                                                                                                                                                                                  return listdelegators.ListDelegator([
                                                                                                                                                                                                                                                                                                                      i for i in toolbars if self.get_toolbar_area(i) == position
                                                                                                                                                                                                                                                                                                                  ])
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          add_toolbar(toolbar: widgets.QToolBar, area: constants.ToolbarAreaStr | constants.ToolBarArea | Literal['auto'] = 'auto')

                                                                                                                                                                                                                                                                                                          Adds a toolbar to the mainmenu at specified area.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          toolbar QToolBar

                                                                                                                                                                                                                                                                                                          toolbar to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          area ToolbarAreaStr | ToolBarArea | Literal['auto']

                                                                                                                                                                                                                                                                                                          area of the toolbar

                                                                                                                                                                                                                                                                                                          'auto'
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mainwindow.py
                                                                                                                                                                                                                                                                                                          def add_toolbar(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              toolbar: widgets.QToolBar,
                                                                                                                                                                                                                                                                                                              area: constants.ToolbarAreaStr | constants.ToolBarArea | Literal["auto"] = "auto",
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Adds a toolbar to the mainmenu at specified area.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  toolbar: toolbar to use
                                                                                                                                                                                                                                                                                                                  area: area of the toolbar
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if area == "auto":
                                                                                                                                                                                                                                                                                                                  area = self._get_preferred_toolbar_position()
                                                                                                                                                                                                                                                                                                              self.addToolBar(constants.TOOLBAR_AREA.get_enum_value(area), toolbar)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          add_toolbar_break(position: constants.ToolbarAreaStr | constants.ToolBarArea = 'top')

                                                                                                                                                                                                                                                                                                          Adds a toolbar break to the given area behind the last item.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          position ToolbarAreaStr | ToolBarArea

                                                                                                                                                                                                                                                                                                          position of the toolbar

                                                                                                                                                                                                                                                                                                          'top'
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mainwindow.py
                                                                                                                                                                                                                                                                                                          def add_toolbar_break(
                                                                                                                                                                                                                                                                                                              self, position: constants.ToolbarAreaStr | constants.ToolBarArea = "top"
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Adds a toolbar break to the given area behind the last item.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  position: position of the toolbar
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.addToolBarBreak(constants.TOOLBAR_AREA.get_enum_value(position))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_tab_shape() -> widgets.tabwidget.TabShapeStr

                                                                                                                                                                                                                                                                                                          Return tab shape.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mainwindow.py
                                                                                                                                                                                                                                                                                                          def get_tab_shape(self) -> widgets.tabwidget.TabShapeStr:
                                                                                                                                                                                                                                                                                                              """Return tab shape.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  tab shape
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return widgets.tabwidget.TAB_SHAPES.inverse[self.tabShape()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_tool_button_style() -> constants.ToolButtonStyleStr

                                                                                                                                                                                                                                                                                                          Return current tool button style.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mainwindow.py
                                                                                                                                                                                                                                                                                                          def get_tool_button_style(self) -> constants.ToolButtonStyleStr:
                                                                                                                                                                                                                                                                                                              """Return current tool button style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  tool button style
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.TOOLBUTTON_STYLE.inverse[self.toolButtonStyle()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          save_window_state(recursive: bool = False)

                                                                                                                                                                                                                                                                                                          Save current window state as QSetting.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          recursive bool

                                                                                                                                                                                                                                                                                                          Description

                                                                                                                                                                                                                                                                                                          False
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mainwindow.py
                                                                                                                                                                                                                                                                                                          def save_window_state(self, recursive: bool = False):
                                                                                                                                                                                                                                                                                                              """Save current window state as QSetting.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  recursive (bool, optional): Description
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              settings = core.Settings()
                                                                                                                                                                                                                                                                                                              name = self.objectName()
                                                                                                                                                                                                                                                                                                              logger.debug("Saving window state for %r...", self.windowTitle())
                                                                                                                                                                                                                                                                                                              settings[f"{name}.geometry"] = self.saveGeometry()
                                                                                                                                                                                                                                                                                                              settings[f"{name}.state"] = self.saveState()
                                                                                                                                                                                                                                                                                                              if recursive:
                                                                                                                                                                                                                                                                                                                  for window in self.find_children(MainWindow, recursive=True):
                                                                                                                                                                                                                                                                                                                      if window.objectName():
                                                                                                                                                                                                                                                                                                                          window.save_window_state()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_tab_shape(shape: widgets.tabwidget.TabShapeStr | widgets.QTabWidget.TabShape)

                                                                                                                                                                                                                                                                                                          Set tab shape for the tabwidget.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          shape TabShapeStr | TabShape

                                                                                                                                                                                                                                                                                                          tab shape to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mainwindow.py
                                                                                                                                                                                                                                                                                                          def set_tab_shape(
                                                                                                                                                                                                                                                                                                              self, shape: widgets.tabwidget.TabShapeStr | widgets.QTabWidget.TabShape
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set tab shape for the tabwidget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  shape: tab shape to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setTabShape(widgets.tabwidget.TAB_SHAPES.get_enum_value(shape))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_widget(widget: widgets.QWidget | None) -> widgets.QWidget | None

                                                                                                                                                                                                                                                                                                          Set widget and return previous one if existing.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mainwindow.py
                                                                                                                                                                                                                                                                                                          def set_widget(self, widget: widgets.QWidget | None) -> widgets.QWidget | None:
                                                                                                                                                                                                                                                                                                              """Set widget and return previous one if existing."""
                                                                                                                                                                                                                                                                                                              previous = self.takeCentralWidget()
                                                                                                                                                                                                                                                                                                              if widget:
                                                                                                                                                                                                                                                                                                                  self.setCentralWidget(widget)
                                                                                                                                                                                                                                                                                                              return previous
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          MdiArea

                                                                                                                                                                                                                                                                                                          Bases: AbstractScrollAreaMixin, QMdiArea

                                                                                                                                                                                                                                                                                                          Area in which MDI windows are displayed.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mdiarea.py
                                                                                                                                                                                                                                                                                                          class MdiArea(widgets.AbstractScrollAreaMixin, widgets.QMdiArea):
                                                                                                                                                                                                                                                                                                              """Area in which MDI windows are displayed."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __add__(self, other: widgets.QWidget):
                                                                                                                                                                                                                                                                                                                  self.add(other)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_view_mode(self, mode: ViewModeStr | widgets.QMdiArea.ViewMode):
                                                                                                                                                                                                                                                                                                                  """Set view mode for the MDI area.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: view mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setViewMode(VIEW_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_view_mode(self) -> ViewModeStr:
                                                                                                                                                                                                                                                                                                                  """Return current view mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      view mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return VIEW_MODE.inverse[self.viewMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_window_order(self, mode: WindowOrderStr | widgets.QMdiArea.WindowOrder):
                                                                                                                                                                                                                                                                                                                  """Set the window order behaviour for the MDI area.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: window order behaviour to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setActivationOrder(WINDOW_ORDER.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_window_order(self) -> WindowOrderStr:
                                                                                                                                                                                                                                                                                                                  """Return current window order.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      view mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return WINDOW_ORDER.inverse[self.activationOrder()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_tab_position(self, position: TabPositionStr | widgets.QTabWidget.TabPosition):
                                                                                                                                                                                                                                                                                                                  """Set tab position for the MDI area.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      position: tabs position to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setTabPosition(TAB_POSITION.get_enum_value(position))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_tab_position(self) -> TabPositionStr:
                                                                                                                                                                                                                                                                                                                  """Return current tab position.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      tab position
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return TAB_POSITION.inverse[self.tabPosition()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_background(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  brush_or_color: datatypes.ColorAndBrushType,
                                                                                                                                                                                                                                                                                                                  pattern: constants.BrushStyleStr = "solid",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  if isinstance(brush_or_color, gui.QBrush):
                                                                                                                                                                                                                                                                                                                      brush = brush_or_color
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      color = colors.get_color(brush_or_color)
                                                                                                                                                                                                                                                                                                                      brush = gui.Brush(color, constants.BRUSH_STYLE[pattern])
                                                                                                                                                                                                                                                                                                                  self.setBackground(brush)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_background(self) -> gui.Brush:
                                                                                                                                                                                                                                                                                                                  return gui.Brush(self.background())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add(self, *item: widgets.QWidget):
                                                                                                                                                                                                                                                                                                                  for i in item:
                                                                                                                                                                                                                                                                                                                      self.add_subwindow(i)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_subwindow(self, widget: widgets.QWidget) -> widgets.QMdiSubWindow:
                                                                                                                                                                                                                                                                                                                  if not isinstance(widget, widgets.QMdiSubWindow):
                                                                                                                                                                                                                                                                                                                      window = widgets.MdiSubWindow()
                                                                                                                                                                                                                                                                                                                      window.setWidget(widget)
                                                                                                                                                                                                                                                                                                                      self.addSubWindow(window)
                                                                                                                                                                                                                                                                                                                      return window
                                                                                                                                                                                                                                                                                                                  return self.addSubWindow(widget)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_tab_position() -> TabPositionStr

                                                                                                                                                                                                                                                                                                          Return current tab position.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mdiarea.py
                                                                                                                                                                                                                                                                                                          def get_tab_position(self) -> TabPositionStr:
                                                                                                                                                                                                                                                                                                              """Return current tab position.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  tab position
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return TAB_POSITION.inverse[self.tabPosition()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_view_mode() -> ViewModeStr

                                                                                                                                                                                                                                                                                                          Return current view mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mdiarea.py
                                                                                                                                                                                                                                                                                                          def get_view_mode(self) -> ViewModeStr:
                                                                                                                                                                                                                                                                                                              """Return current view mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  view mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return VIEW_MODE.inverse[self.viewMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_window_order() -> WindowOrderStr

                                                                                                                                                                                                                                                                                                          Return current window order.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mdiarea.py
                                                                                                                                                                                                                                                                                                          def get_window_order(self) -> WindowOrderStr:
                                                                                                                                                                                                                                                                                                              """Return current window order.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  view mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return WINDOW_ORDER.inverse[self.activationOrder()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_tab_position(position: TabPositionStr | widgets.QTabWidget.TabPosition)

                                                                                                                                                                                                                                                                                                          Set tab position for the MDI area.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          position TabPositionStr | TabPosition

                                                                                                                                                                                                                                                                                                          tabs position to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mdiarea.py
                                                                                                                                                                                                                                                                                                          def set_tab_position(self, position: TabPositionStr | widgets.QTabWidget.TabPosition):
                                                                                                                                                                                                                                                                                                              """Set tab position for the MDI area.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  position: tabs position to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setTabPosition(TAB_POSITION.get_enum_value(position))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_view_mode(mode: ViewModeStr | widgets.QMdiArea.ViewMode)

                                                                                                                                                                                                                                                                                                          Set view mode for the MDI area.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ViewModeStr | ViewMode

                                                                                                                                                                                                                                                                                                          view mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mdiarea.py
                                                                                                                                                                                                                                                                                                          def set_view_mode(self, mode: ViewModeStr | widgets.QMdiArea.ViewMode):
                                                                                                                                                                                                                                                                                                              """Set view mode for the MDI area.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: view mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setViewMode(VIEW_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_window_order(mode: WindowOrderStr | widgets.QMdiArea.WindowOrder)

                                                                                                                                                                                                                                                                                                          Set the window order behaviour for the MDI area.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode WindowOrderStr | WindowOrder

                                                                                                                                                                                                                                                                                                          window order behaviour to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mdiarea.py
                                                                                                                                                                                                                                                                                                          def set_window_order(self, mode: WindowOrderStr | widgets.QMdiArea.WindowOrder):
                                                                                                                                                                                                                                                                                                              """Set the window order behaviour for the MDI area.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: window order behaviour to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setActivationOrder(WINDOW_ORDER.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          MdiSubWindow

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QMdiSubWindow

                                                                                                                                                                                                                                                                                                          Subwindow class for QMdiArea.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/mdisubwindow.py
                                                                                                                                                                                                                                                                                                          class MdiSubWindow(widgets.WidgetMixin, widgets.QMdiSubWindow):
                                                                                                                                                                                                                                                                                                              """Subwindow class for QMdiArea."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Menu

                                                                                                                                                                                                                                                                                                          Bases: MenuMixin, QMenu

                                                                                                                                                                                                                                                                                                          Menu widget for use in menu bars, context menus, and other popup menus.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/menu.py
                                                                                                                                                                                                                                                                                                          class Menu(MenuMixin, widgets.QMenu):
                                                                                                                                                                                                                                                                                                              """Menu widget for use in menu bars, context menus, and other popup menus."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          MenuBar

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QMenuBar

                                                                                                                                                                                                                                                                                                          Horizontal menu bar.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/menubar.py
                                                                                                                                                                                                                                                                                                          class MenuBar(widgets.WidgetMixin, widgets.QMenuBar):
                                                                                                                                                                                                                                                                                                              """Horizontal menu bar."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __add__(self, other: gui.QAction | widgets.QMenu):
                                                                                                                                                                                                                                                                                                                  self.add(other)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def serialize_fields(self):
                                                                                                                                                                                                                                                                                                                  return dict(
                                                                                                                                                                                                                                                                                                                      default_up=self.isDefaultUp(),
                                                                                                                                                                                                                                                                                                                      native_menu_bar=self.isNativeMenuBar(),
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def add_menu(self, menu_or_str: str) -> widgets.Menu: ...
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def add_menu(self, menu_or_str: widgets.QMenu) -> gui.Action: ...
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_menu(self, menu_or_str: str | widgets.QMenu) -> widgets.Menu | gui.Action:
                                                                                                                                                                                                                                                                                                                  if isinstance(menu_or_str, str):
                                                                                                                                                                                                                                                                                                                      action = gui.Action(parent=self, text=menu_or_str)
                                                                                                                                                                                                                                                                                                                      menu = widgets.Menu(title=menu_or_str, parent=self)
                                                                                                                                                                                                                                                                                                                      action.set_menu(menu)
                                                                                                                                                                                                                                                                                                                      self.addAction(action)
                                                                                                                                                                                                                                                                                                                      return menu
                                                                                                                                                                                                                                                                                                                  action = gui.Action(parent=self, text=menu_or_str.title())
                                                                                                                                                                                                                                                                                                                  action.set_menu(menu_or_str)
                                                                                                                                                                                                                                                                                                                  self.addAction(action)
                                                                                                                                                                                                                                                                                                                  return action
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_separator(self):
                                                                                                                                                                                                                                                                                                                  self.addSeparator()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add(self, *items: widgets.QMenu | gui.QAction):
                                                                                                                                                                                                                                                                                                                  for i in items:
                                                                                                                                                                                                                                                                                                                      if isinstance(i, widgets.QMenu):
                                                                                                                                                                                                                                                                                                                          action = gui.Action(self)
                                                                                                                                                                                                                                                                                                                          action.set_text(i.title())
                                                                                                                                                                                                                                                                                                                          action.set_menu(i)
                                                                                                                                                                                                                                                                                                                          self.addAction(action)
                                                                                                                                                                                                                                                                                                                      else:
                                                                                                                                                                                                                                                                                                                          self.addAction(i)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_corner_widget(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  widget: widgets.QWidget,
                                                                                                                                                                                                                                                                                                                  corner: Literal["top_right", "top_left"] = "top_right",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  match corner:
                                                                                                                                                                                                                                                                                                                      case "top_left":
                                                                                                                                                                                                                                                                                                                          self.setCornerWidget(widget, constants.Corner.TopLeftCorner)
                                                                                                                                                                                                                                                                                                                      case "top_right":
                                                                                                                                                                                                                                                                                                                          self.setCornerWidget(widget, constants.Corner.TopRightCorner)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise ValueError(corner)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_corner_widget(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  corner: Literal["top_right", "top_left"] = "top_right",
                                                                                                                                                                                                                                                                                                              ) -> widgets.QWidget:
                                                                                                                                                                                                                                                                                                                  match corner:
                                                                                                                                                                                                                                                                                                                      case "top_left":
                                                                                                                                                                                                                                                                                                                          return self.cornerWidget(constants.Corner.TopLeftCorner)
                                                                                                                                                                                                                                                                                                                      case "top_right":
                                                                                                                                                                                                                                                                                                                          return self.cornerWidget(constants.Corner.TopRightCorner)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise ValueError(corner)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          MessageBox

                                                                                                                                                                                                                                                                                                          Bases: DialogMixin, QMessageBox

                                                                                                                                                                                                                                                                                                          Modal dialog for informing the user (and for receiving an answer).

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/messagebox.py
                                                                                                                                                                                                                                                                                                          class MessageBox(widgets.DialogMixin, widgets.QMessageBox):
                                                                                                                                                                                                                                                                                                              """Modal dialog for informing the user (and for receiving an answer)."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  icon: datatypes.IconType | IconStr = None,
                                                                                                                                                                                                                                                                                                                  buttons: (
                                                                                                                                                                                                                                                                                                                      list[StandardButtonStr | widgets.QMessageBox.StandardButton] | None
                                                                                                                                                                                                                                                                                                                  ) = None,
                                                                                                                                                                                                                                                                                                                  **kwargs,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  super().__init__(**kwargs)
                                                                                                                                                                                                                                                                                                                  self.set_icon(icon)
                                                                                                                                                                                                                                                                                                                  self.setWindowFlags(
                                                                                                                                                                                                                                                                                                                      constants.WindowType.Dialog
                                                                                                                                                                                                                                                                                                                      | constants.WindowType.WindowTitleHint
                                                                                                                                                                                                                                                                                                                      | constants.WindowType.CustomizeWindowHint
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  if isinstance(buttons, list):
                                                                                                                                                                                                                                                                                                                      for b in buttons:
                                                                                                                                                                                                                                                                                                                          self.add_button(b)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_button(
                                                                                                                                                                                                                                                                                                                  self, button: widgets.QMessageBox.StandardButton | StandardButtonStr
                                                                                                                                                                                                                                                                                                              ) -> widgets.QAbstractButton:
                                                                                                                                                                                                                                                                                                                  return self.button(STANDARD_BUTTON.get_enum_value(button))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def message(
                                                                                                                                                                                                                                                                                                                  cls,
                                                                                                                                                                                                                                                                                                                  text: str,
                                                                                                                                                                                                                                                                                                                  title: str = "",
                                                                                                                                                                                                                                                                                                                  icon: datatypes.IconType = None,
                                                                                                                                                                                                                                                                                                                  detail_text: str | None = None,
                                                                                                                                                                                                                                                                                                              ) -> str:
                                                                                                                                                                                                                                                                                                                  m = cls(window_title=title, text=text)
                                                                                                                                                                                                                                                                                                                  m.set_icon(icon)
                                                                                                                                                                                                                                                                                                                  if detail_text is not None:
                                                                                                                                                                                                                                                                                                                      m.setDetailedText(detail_text)
                                                                                                                                                                                                                                                                                                                  return m.show_blocking()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def show_exception(cls, exception: Exception | None = None):
                                                                                                                                                                                                                                                                                                                  if exception is None:
                                                                                                                                                                                                                                                                                                                      exctype, value = sys.exc_info()[:2]
                                                                                                                                                                                                                                                                                                                      title = str(exctype)
                                                                                                                                                                                                                                                                                                                      text = str(value)
                                                                                                                                                                                                                                                                                                                      tb = traceback.format_exc()
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      title = type(exception).__name__
                                                                                                                                                                                                                                                                                                                      text = str(exception)
                                                                                                                                                                                                                                                                                                                      tb = "".join(traceback.format_exception(exception))
                                                                                                                                                                                                                                                                                                                  dlg = cls(
                                                                                                                                                                                                                                                                                                                      text=text,
                                                                                                                                                                                                                                                                                                                      window_title=title,
                                                                                                                                                                                                                                                                                                                      icon="critical",
                                                                                                                                                                                                                                                                                                                      detailed_text=tb,
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  dlg.show_blocking()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_icon(self, icon: datatypes.IconType | IconStr):
                                                                                                                                                                                                                                                                                                                  if icon in ICONS:
                                                                                                                                                                                                                                                                                                                      self.setIcon(ICONS[icon])
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      ico = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                                      self.setIconPixmap(ico.get_pixmap(size=64))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def show_blocking(self) -> StandardButtonStr:
                                                                                                                                                                                                                                                                                                                  return STANDARD_BUTTON.inverse[widgets.QMessageBox.StandardButton(self.exec())]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_icon_pixmap(self) -> gui.Pixmap | None:
                                                                                                                                                                                                                                                                                                                  pix = self.iconPixmap()
                                                                                                                                                                                                                                                                                                                  return None if pix.isNull() else gui.Pixmap(pix)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_standard_buttons(
                                                                                                                                                                                                                                                                                                                  self, buttons: list[StandardButtonStr | widgets.QMessageBox.StandardButton]
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  flag = self.StandardButton.NoButton
                                                                                                                                                                                                                                                                                                                  for val in buttons:
                                                                                                                                                                                                                                                                                                                      flag |= STANDARD_BUTTON.get_enum_value(val)
                                                                                                                                                                                                                                                                                                                  self.setStandardButtons(flag)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_standard_buttons(self) -> list[StandardButtonStr]:
                                                                                                                                                                                                                                                                                                                  return STANDARD_BUTTON.get_list(self.standardButtons())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_button(
                                                                                                                                                                                                                                                                                                                  self, button: StandardButtonStr | widgets.QMessageBox.StandardButton
                                                                                                                                                                                                                                                                                                              ) -> widgets.QPushButton:
                                                                                                                                                                                                                                                                                                                  """Add a default button.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      button: button to add
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      created button
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return self.addButton(STANDARD_BUTTON.get_enum_value(button))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_custom_button(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  button: str,
                                                                                                                                                                                                                                                                                                                  role: ButtonRoleStr | widgets.QMessageBox.ButtonRole,
                                                                                                                                                                                                                                                                                                                  callback: Callable | None = None,
                                                                                                                                                                                                                                                                                                              ) -> widgets.QPushButton:
                                                                                                                                                                                                                                                                                                                  btn = self.addButton(button, BUTTON_ROLE.get_enum_value(role))
                                                                                                                                                                                                                                                                                                                  if callback:
                                                                                                                                                                                                                                                                                                                      btn.clicked.connect(callback)
                                                                                                                                                                                                                                                                                                                  return btn
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # @classmethod
                                                                                                                                                                                                                                                                                                              # def show_exception(cls, exception):
                                                                                                                                                                                                                                                                                                              #     header = str(exception[0])
                                                                                                                                                                                                                                                                                                              #     error_text = str(exception[1])
                                                                                                                                                                                                                                                                                                              #     widgets.MessageBox.message(error_text, header, "mdi.exclamation")
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_text_format(
                                                                                                                                                                                                                                                                                                                  self, text_format: constants.TextFormatStr | constants.TextFormat
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the text format.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      text_format: text format to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setTextFormat(constants.TEXT_FORMAT.get_enum_value(text_format))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_text_format(self) -> constants.TextFormatStr:
                                                                                                                                                                                                                                                                                                                  """Return current text format.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      text format
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.TEXT_FORMAT.inverse[self.textFormat()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_escape_button(self, button: StandardButtonStr | widgets.QAbstractButton):
                                                                                                                                                                                                                                                                                                                  if isinstance(button, widgets.QAbstractButton):
                                                                                                                                                                                                                                                                                                                      self.setEscapeButton(button)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.setEscapeButton(STANDARD_BUTTON.get_enum_value(button))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_default_button(self, button: StandardButtonStr | widgets.QPushButton):
                                                                                                                                                                                                                                                                                                                  if isinstance(button, widgets.QPushButton):
                                                                                                                                                                                                                                                                                                                      self.setDefaultButton(button)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.setDefaultButton(STANDARD_BUTTON.get_enum_value(button))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_option(self, option: OptionStr | widgets.QMessageBox.Option, on: bool = True):
                                                                                                                                                                                                                                                                                                                  """Set a message box option.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      option: option to set
                                                                                                                                                                                                                                                                                                                      on: whether to enable or disable the option
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setOption(OPTION.get_enum_value(option), on)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def test_option(self, option: OptionStr | widgets.QMessageBox.Option) -> bool:
                                                                                                                                                                                                                                                                                                                  """Return whether a message box option is enabled.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      option: option to test
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return self.testOption(OPTION.get_enum_value(option))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          add_button(button: StandardButtonStr | widgets.QMessageBox.StandardButton) -> widgets.QPushButton

                                                                                                                                                                                                                                                                                                          Add a default button.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          button StandardButtonStr | StandardButton

                                                                                                                                                                                                                                                                                                          button to add

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/messagebox.py
                                                                                                                                                                                                                                                                                                          def add_button(
                                                                                                                                                                                                                                                                                                              self, button: StandardButtonStr | widgets.QMessageBox.StandardButton
                                                                                                                                                                                                                                                                                                          ) -> widgets.QPushButton:
                                                                                                                                                                                                                                                                                                              """Add a default button.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  button: button to add
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  created button
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return self.addButton(STANDARD_BUTTON.get_enum_value(button))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_text_format() -> constants.TextFormatStr

                                                                                                                                                                                                                                                                                                          Return current text format.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/messagebox.py
                                                                                                                                                                                                                                                                                                          def get_text_format(self) -> constants.TextFormatStr:
                                                                                                                                                                                                                                                                                                              """Return current text format.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  text format
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.TEXT_FORMAT.inverse[self.textFormat()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_option(option: OptionStr | widgets.QMessageBox.Option, on: bool = True)

                                                                                                                                                                                                                                                                                                          Set a message box option.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          option OptionStr | Option

                                                                                                                                                                                                                                                                                                          option to set

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          on bool

                                                                                                                                                                                                                                                                                                          whether to enable or disable the option

                                                                                                                                                                                                                                                                                                          True
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/messagebox.py
                                                                                                                                                                                                                                                                                                          def set_option(self, option: OptionStr | widgets.QMessageBox.Option, on: bool = True):
                                                                                                                                                                                                                                                                                                              """Set a message box option.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  option: option to set
                                                                                                                                                                                                                                                                                                                  on: whether to enable or disable the option
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setOption(OPTION.get_enum_value(option), on)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_text_format(text_format: constants.TextFormatStr | constants.TextFormat)

                                                                                                                                                                                                                                                                                                          Set the text format.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          text_format TextFormatStr | TextFormat

                                                                                                                                                                                                                                                                                                          text format to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/messagebox.py
                                                                                                                                                                                                                                                                                                          def set_text_format(
                                                                                                                                                                                                                                                                                                              self, text_format: constants.TextFormatStr | constants.TextFormat
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the text format.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  text_format: text format to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setTextFormat(constants.TEXT_FORMAT.get_enum_value(text_format))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          test_option(option: OptionStr | widgets.QMessageBox.Option) -> bool

                                                                                                                                                                                                                                                                                                          Return whether a message box option is enabled.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          option OptionStr | Option

                                                                                                                                                                                                                                                                                                          option to test

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/messagebox.py
                                                                                                                                                                                                                                                                                                          def test_option(self, option: OptionStr | widgets.QMessageBox.Option) -> bool:
                                                                                                                                                                                                                                                                                                              """Return whether a message box option is enabled.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  option: option to test
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return self.testOption(OPTION.get_enum_value(option))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          PanGesture

                                                                                                                                                                                                                                                                                                          Bases: GestureMixin, QPanGesture

                                                                                                                                                                                                                                                                                                          Describes a panning gesture made by the user.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/pangesture.py
                                                                                                                                                                                                                                                                                                          class PanGesture(widgets.GestureMixin, widgets.QPanGesture):
                                                                                                                                                                                                                                                                                                              """Describes a panning gesture made by the user."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_delta(self) -> core.PointF:
                                                                                                                                                                                                                                                                                                                  return core.PointF(self.delta())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_last_offset(self) -> core.PointF:
                                                                                                                                                                                                                                                                                                                  return core.PointF(self.lastOffset())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_offset(self) -> core.PointF:
                                                                                                                                                                                                                                                                                                                  return core.PointF(self.offset())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          PinchGesture

                                                                                                                                                                                                                                                                                                          Bases: GestureMixin, QPinchGesture

                                                                                                                                                                                                                                                                                                          Describes a pinch gesture made by the user.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/pinchgesture.py
                                                                                                                                                                                                                                                                                                          class PinchGesture(widgets.GestureMixin, widgets.QPinchGesture):
                                                                                                                                                                                                                                                                                                              """Describes a pinch gesture made by the user."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_start_center_point(self) -> core.PointF:
                                                                                                                                                                                                                                                                                                                  return core.PointF(self.startCenterPoint())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_center_point(self) -> core.PointF:
                                                                                                                                                                                                                                                                                                                  return core.PointF(self.centerPoint())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_last_center_point(self) -> core.PointF:
                                                                                                                                                                                                                                                                                                                  return core.PointF(self.lastCenterPoint())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_change_flags(self) -> list[ChangeFlagStr]:
                                                                                                                                                                                                                                                                                                                  return CHANGE_FLAGS.get_list(self.changeFlags())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_change_flags(self, **kwargs):
                                                                                                                                                                                                                                                                                                                  val = widgets.QPinchGesture.ChangeFlag(0)
                                                                                                                                                                                                                                                                                                                  for k, v in kwargs.items():
                                                                                                                                                                                                                                                                                                                      if v is True:
                                                                                                                                                                                                                                                                                                                          val |= CHANGE_FLAGS[k]
                                                                                                                                                                                                                                                                                                                  flag = widgets.QPinchGesture.ChangeFlag(val)
                                                                                                                                                                                                                                                                                                                  self.setChangeFlags(flag)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_total_change_flags(self) -> list[ChangeFlagStr]:
                                                                                                                                                                                                                                                                                                                  return CHANGE_FLAGS.get_list(self.totalChangeFlags())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_total_change_flags(self, **kwargs):
                                                                                                                                                                                                                                                                                                                  val = widgets.QPinchGesture.ChangeFlag(0)
                                                                                                                                                                                                                                                                                                                  for k, v in kwargs.items():
                                                                                                                                                                                                                                                                                                                      if v is True:
                                                                                                                                                                                                                                                                                                                          val |= CHANGE_FLAGS[k]
                                                                                                                                                                                                                                                                                                                  flag = widgets.QPinchGesture.ChangeFlag(val)
                                                                                                                                                                                                                                                                                                                  self.setTotalChangeFlags(flag)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          PlainTextDocumentLayout

                                                                                                                                                                                                                                                                                                          Bases: AbstractTextDocumentLayoutMixin, QPlainTextDocumentLayout

                                                                                                                                                                                                                                                                                                          Implements a plain text layout for QTextDocument.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/plaintextdocumentlayout.py
                                                                                                                                                                                                                                                                                                          5
                                                                                                                                                                                                                                                                                                          6
                                                                                                                                                                                                                                                                                                          7
                                                                                                                                                                                                                                                                                                          8
                                                                                                                                                                                                                                                                                                          class PlainTextDocumentLayout(
                                                                                                                                                                                                                                                                                                              gui.AbstractTextDocumentLayoutMixin, QtWidgets.QPlainTextDocumentLayout
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Implements a plain text layout for QTextDocument."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          PlainTextEdit

                                                                                                                                                                                                                                                                                                          Bases: PlainTextEditMixin, QPlainTextEdit

                                                                                                                                                                                                                                                                                                          Widget that is used to edit and display plain text.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/plaintextedit.py
                                                                                                                                                                                                                                                                                                          class PlainTextEdit(PlainTextEditMixin, widgets.QPlainTextEdit):
                                                                                                                                                                                                                                                                                                              """Widget that is used to edit and display plain text."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          PlainTextEditMixin

                                                                                                                                                                                                                                                                                                          Bases: AbstractScrollAreaMixin, _PlainTextEditBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/plaintextedit.py
                                                                                                                                                                                                                                                                                                          class PlainTextEditMixin(widgets.AbstractScrollAreaMixin, _PlainTextEditBase):
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(str)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, text: str = "", **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(**kwargs)
                                                                                                                                                                                                                                                                                                                  self._allow_wheel_zoom = False
                                                                                                                                                                                                                                                                                                                  self._hl = None
                                                                                                                                                                                                                                                                                                                  self._current_line_color: gui.Color | None = None
                                                                                                                                                                                                                                                                                                                  self._validation_color = gui.Color("orange")
                                                                                                                                                                                                                                                                                                                  self.selecter = texteditselecter.TextEditSelecter(self)
                                                                                                                                                                                                                                                                                                                  self.validator: gui.QValidator | None = None
                                                                                                                                                                                                                                                                                                                  self.textChanged.connect(self._on_value_change)
                                                                                                                                                                                                                                                                                                                  doc = gui.TextDocument(self)
                                                                                                                                                                                                                                                                                                                  layout = widgets.PlainTextDocumentLayout(doc)
                                                                                                                                                                                                                                                                                                                  doc.setDocumentLayout(layout)
                                                                                                                                                                                                                                                                                                                  self.setDocument(doc)
                                                                                                                                                                                                                                                                                                                  self.set_text(text)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __add__(self, other: str):
                                                                                                                                                                                                                                                                                                                  self.append_text(other)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def wheelEvent(self, event):
                                                                                                                                                                                                                                                                                                                  """Handle wheel event for zooming."""
                                                                                                                                                                                                                                                                                                                  if not self._allow_wheel_zoom:
                                                                                                                                                                                                                                                                                                                      return super().wheelEvent(event)
                                                                                                                                                                                                                                                                                                                  if event.modifiers() & constants.CTRL_MOD:
                                                                                                                                                                                                                                                                                                                      self.zoomIn() if event.angleDelta().y() > 0 else self.zoomOut()
                                                                                                                                                                                                                                                                                                                      event.accept()
                                                                                                                                                                                                                                                                                                                      return None
                                                                                                                                                                                                                                                                                                                  super().wheelEvent(event)
                                                                                                                                                                                                                                                                                                                  return None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "lineWrapMode": LINE_WRAP_MODE,
                                                                                                                                                                                                                                                                                                                      "wordWrapMode": gui.textoption.WORD_WRAP_MODE,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def allow_wheel_zoom(self, do_zoom: bool = True):
                                                                                                                                                                                                                                                                                                                  self._allow_wheel_zoom = do_zoom
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def append_text(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  text: str,
                                                                                                                                                                                                                                                                                                                  newline: bool = True,
                                                                                                                                                                                                                                                                                                                  ensure_visible: Literal["always", "when_bottom", "never"] = "always",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  scrollbar = self.verticalScrollBar()
                                                                                                                                                                                                                                                                                                                  at_bottom = scrollbar.value() >= (scrollbar.maximum() - 4)
                                                                                                                                                                                                                                                                                                                  prev_val = scrollbar.value()
                                                                                                                                                                                                                                                                                                                  if newline:
                                                                                                                                                                                                                                                                                                                      self.appendPlainText(text)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.selecter.move_cursor("end")
                                                                                                                                                                                                                                                                                                                      self.insertPlainText(text)
                                                                                                                                                                                                                                                                                                                      self.selecter.move_cursor("end")
                                                                                                                                                                                                                                                                                                                  match ensure_visible:
                                                                                                                                                                                                                                                                                                                      case "always":
                                                                                                                                                                                                                                                                                                                          self.ensureCursorVisible()
                                                                                                                                                                                                                                                                                                                      case "when_bottom":
                                                                                                                                                                                                                                                                                                                          if at_bottom:
                                                                                                                                                                                                                                                                                                                              self.ensureCursorVisible()
                                                                                                                                                                                                                                                                                                                      case "never":
                                                                                                                                                                                                                                                                                                                          scrollbar.setValue(prev_val)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_text(self, text: str):
                                                                                                                                                                                                                                                                                                                  self.setPlainText(text)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_syntaxhighlighter(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  syntax: str | gui.QSyntaxHighlighter,
                                                                                                                                                                                                                                                                                                                  style: syntaxhighlighters.pygmentshighlighter.StyleStr | None = None,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  if isinstance(syntax, gui.QSyntaxHighlighter):
                                                                                                                                                                                                                                                                                                                      self._hl = syntax
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self._hl = syntaxhighlighters.PygmentsHighlighter(
                                                                                                                                                                                                                                                                                                                          self.document(), syntax, style
                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def text(self) -> str:
                                                                                                                                                                                                                                                                                                                  return self.toPlainText()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_read_only(self, value: bool = True):
                                                                                                                                                                                                                                                                                                                  """Make the PlainTextEdit read-only.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      value: True, for read-only, otherwise False
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setReadOnly(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def show_whitespace_and_tabs(self, show: bool):
                                                                                                                                                                                                                                                                                                                  """Set show white spaces flag."""
                                                                                                                                                                                                                                                                                                                  doc = self.document()
                                                                                                                                                                                                                                                                                                                  options = doc.defaultTextOption()
                                                                                                                                                                                                                                                                                                                  flag = gui.QTextOption.Flag.ShowTabsAndSpaces
                                                                                                                                                                                                                                                                                                                  if show:
                                                                                                                                                                                                                                                                                                                      options.setFlags(options.flags() | flag)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      options.setFlags(options.flags() & ~flag)
                                                                                                                                                                                                                                                                                                                  doc.setDefaultTextOption(options)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def paintEvent(self, event: gui.QPaintEvent):
                                                                                                                                                                                                                                                                                                                  if self._current_line_color:
                                                                                                                                                                                                                                                                                                                      with gui.Painter(self.viewport()) as painter:
                                                                                                                                                                                                                                                                                                                          cursor_rect = self.cursorRect()
                                                                                                                                                                                                                                                                                                                          r = core.QRect(0, cursor_rect.top(), self.width(), cursor_rect.height())
                                                                                                                                                                                                                                                                                                                          painter.set_pen(None)
                                                                                                                                                                                                                                                                                                                          painter.setBrush(gui.Color(self._current_line_color))
                                                                                                                                                                                                                                                                                                                          painter.drawRect(r)
                                                                                                                                                                                                                                                                                                                  super().paintEvent(event)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_word_wrap_mode(
                                                                                                                                                                                                                                                                                                                  self, mode: gui.textoption.WordWrapModeStr | gui.QTextOption.WrapMode
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set word wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: word wrap mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setWordWrapMode(gui.textoption.WORD_WRAP_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_word_wrap_mode(self) -> gui.textoption.WordWrapModeStr:
                                                                                                                                                                                                                                                                                                                  """Get the current word wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      Word wrap mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return gui.textoption.WORD_WRAP_MODE.inverse[self.wordWrapMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_line_wrap_mode(
                                                                                                                                                                                                                                                                                                                  self, mode: LineWrapModeStr | widgets.QPlainTextEdit.LineWrapMode
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set line wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: line wrap mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setLineWrapMode(LINE_WRAP_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_line_wrap_mode(self) -> LineWrapModeStr:
                                                                                                                                                                                                                                                                                                                  """Get the current wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      Wrap mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return LINE_WRAP_MODE.inverse[self.lineWrapMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _on_value_change(self):
                                                                                                                                                                                                                                                                                                                  self.value_changed.emit(self.text())
                                                                                                                                                                                                                                                                                                                  if self.validator is not None:
                                                                                                                                                                                                                                                                                                                      self._update_background()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _update_background(self):
                                                                                                                                                                                                                                                                                                                  color = None if self.is_valid() else self._validation_color
                                                                                                                                                                                                                                                                                                                  self.set_background_color(color)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_validation_color(self, color: datatypes.ColorType):
                                                                                                                                                                                                                                                                                                                  self._validation_color = colors.get_color(color).as_qt()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_validation_color(self) -> gui.QColor:
                                                                                                                                                                                                                                                                                                                  return self._validation_color
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_validator(
                                                                                                                                                                                                                                                                                                                  self, validator: gui.QValidator | widgets.lineedit.ValidatorStr | None, **kwargs
                                                                                                                                                                                                                                                                                                              ) -> gui.QValidator | None:
                                                                                                                                                                                                                                                                                                                  if isinstance(validator, str):
                                                                                                                                                                                                                                                                                                                      validator_cls = classhelpers.get_class_for_id(gui.ValidatorMixin, validator)
                                                                                                                                                                                                                                                                                                                      validator = validator_cls(**kwargs)
                                                                                                                                                                                                                                                                                                                  self.validator = validator
                                                                                                                                                                                                                                                                                                                  self._update_background()
                                                                                                                                                                                                                                                                                                                  return validator
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_regex_validator(self, regex: str, flags=0) -> gui.RegularExpressionValidator:
                                                                                                                                                                                                                                                                                                                  validator = gui.RegularExpressionValidator(self)
                                                                                                                                                                                                                                                                                                                  validator.set_regex(regex, flags)
                                                                                                                                                                                                                                                                                                                  self.set_validator(validator)
                                                                                                                                                                                                                                                                                                                  return validator
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def is_valid(self) -> bool:
                                                                                                                                                                                                                                                                                                                  if self.validator is None:
                                                                                                                                                                                                                                                                                                                      return True
                                                                                                                                                                                                                                                                                                                  val = cast(
                                                                                                                                                                                                                                                                                                                      "tuple[gui.QValidator.State, str, int]",
                                                                                                                                                                                                                                                                                                                      self.validator.validate(self.text(), 0),
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  return val[0] == self.validator.State.Acceptable
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self, value: str):
                                                                                                                                                                                                                                                                                                                  self.setPlainText(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_value(self) -> str:
                                                                                                                                                                                                                                                                                                                  return self.text()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_current_line_color(self, color: datatypes.ColorType):
                                                                                                                                                                                                                                                                                                                  if color:
                                                                                                                                                                                                                                                                                                                      if self._current_line_color is None:
                                                                                                                                                                                                                                                                                                                          self.cursorPositionChanged.connect(self.selecter._update_on_block_change)
                                                                                                                                                                                                                                                                                                                      self._current_line_color = colors.get_color(color)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      if self._current_line_color is not None:
                                                                                                                                                                                                                                                                                                                          self.cursorPositionChanged.disconnect(
                                                                                                                                                                                                                                                                                                                              self.selecter._update_on_block_change
                                                                                                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                                                                                                      self._current_line_color = None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_current_line_color(self) -> gui.Color | None:
                                                                                                                                                                                                                                                                                                                  return self._current_line_color
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              current_line_color = core.Property(
                                                                                                                                                                                                                                                                                                                  gui.QColor,
                                                                                                                                                                                                                                                                                                                  get_current_line_color,
                                                                                                                                                                                                                                                                                                                  set_current_line_color,
                                                                                                                                                                                                                                                                                                                  doc="Color to use for current line highlighting",
                                                                                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_visible_line_span(self) -> tuple[int, int]:
                                                                                                                                                                                                                                                                                                                  block = self.firstVisibleBlock()
                                                                                                                                                                                                                                                                                                                  start = block.blockNumber()
                                                                                                                                                                                                                                                                                                                  page_step = self.v_scrollbar.pageStep()
                                                                                                                                                                                                                                                                                                                  end = min(start + page_step, self.blockCount())
                                                                                                                                                                                                                                                                                                                  return (start, end)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_pixel_height(self, exact: bool = True) -> float:
                                                                                                                                                                                                                                                                                                                  """Returns the pixel height of the text area."""
                                                                                                                                                                                                                                                                                                                  widget_margins = self.contentsMargins()
                                                                                                                                                                                                                                                                                                                  # PlainTextEdit installs a prettyqt TextDocument
                                                                                                                                                                                                                                                                                                                  doc = cast("gui.TextDocument", self.document())
                                                                                                                                                                                                                                                                                                                  doc_height = doc.get_pixel_height(exact=exact)
                                                                                                                                                                                                                                                                                                                  return widget_margins.top() + doc_height + widget_margins.bottom()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              validation_color = core.Property(
                                                                                                                                                                                                                                                                                                                  gui.QColor,
                                                                                                                                                                                                                                                                                                                  get_validation_color,
                                                                                                                                                                                                                                                                                                                  set_validation_color,
                                                                                                                                                                                                                                                                                                                  doc="Color to use for invalid text",
                                                                                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_line_wrap_mode() -> LineWrapModeStr

                                                                                                                                                                                                                                                                                                          Get the current wrap mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/plaintextedit.py
                                                                                                                                                                                                                                                                                                          def get_line_wrap_mode(self) -> LineWrapModeStr:
                                                                                                                                                                                                                                                                                                              """Get the current wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  Wrap mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return LINE_WRAP_MODE.inverse[self.lineWrapMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_pixel_height(exact: bool = True) -> float

                                                                                                                                                                                                                                                                                                          Returns the pixel height of the text area.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/plaintextedit.py
                                                                                                                                                                                                                                                                                                          def get_pixel_height(self, exact: bool = True) -> float:
                                                                                                                                                                                                                                                                                                              """Returns the pixel height of the text area."""
                                                                                                                                                                                                                                                                                                              widget_margins = self.contentsMargins()
                                                                                                                                                                                                                                                                                                              # PlainTextEdit installs a prettyqt TextDocument
                                                                                                                                                                                                                                                                                                              doc = cast("gui.TextDocument", self.document())
                                                                                                                                                                                                                                                                                                              doc_height = doc.get_pixel_height(exact=exact)
                                                                                                                                                                                                                                                                                                              return widget_margins.top() + doc_height + widget_margins.bottom()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_word_wrap_mode() -> gui.textoption.WordWrapModeStr

                                                                                                                                                                                                                                                                                                          Get the current word wrap mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/plaintextedit.py
                                                                                                                                                                                                                                                                                                          def get_word_wrap_mode(self) -> gui.textoption.WordWrapModeStr:
                                                                                                                                                                                                                                                                                                              """Get the current word wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  Word wrap mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return gui.textoption.WORD_WRAP_MODE.inverse[self.wordWrapMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_line_wrap_mode(mode: LineWrapModeStr | widgets.QPlainTextEdit.LineWrapMode)

                                                                                                                                                                                                                                                                                                          Set line wrap mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode LineWrapModeStr | LineWrapMode

                                                                                                                                                                                                                                                                                                          line wrap mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/plaintextedit.py
                                                                                                                                                                                                                                                                                                          def set_line_wrap_mode(
                                                                                                                                                                                                                                                                                                              self, mode: LineWrapModeStr | widgets.QPlainTextEdit.LineWrapMode
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set line wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: line wrap mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setLineWrapMode(LINE_WRAP_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_read_only(value: bool = True)

                                                                                                                                                                                                                                                                                                          Make the PlainTextEdit read-only.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          value bool

                                                                                                                                                                                                                                                                                                          True, for read-only, otherwise False

                                                                                                                                                                                                                                                                                                          True
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/plaintextedit.py
                                                                                                                                                                                                                                                                                                          def set_read_only(self, value: bool = True):
                                                                                                                                                                                                                                                                                                              """Make the PlainTextEdit read-only.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  value: True, for read-only, otherwise False
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setReadOnly(value)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_word_wrap_mode(mode: gui.textoption.WordWrapModeStr | gui.QTextOption.WrapMode)

                                                                                                                                                                                                                                                                                                          Set word wrap mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode WordWrapModeStr | WrapMode

                                                                                                                                                                                                                                                                                                          word wrap mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/plaintextedit.py
                                                                                                                                                                                                                                                                                                          def set_word_wrap_mode(
                                                                                                                                                                                                                                                                                                              self, mode: gui.textoption.WordWrapModeStr | gui.QTextOption.WrapMode
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set word wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: word wrap mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setWordWrapMode(gui.textoption.WORD_WRAP_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          show_whitespace_and_tabs(show: bool)

                                                                                                                                                                                                                                                                                                          Set show white spaces flag.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/plaintextedit.py
                                                                                                                                                                                                                                                                                                          def show_whitespace_and_tabs(self, show: bool):
                                                                                                                                                                                                                                                                                                              """Set show white spaces flag."""
                                                                                                                                                                                                                                                                                                              doc = self.document()
                                                                                                                                                                                                                                                                                                              options = doc.defaultTextOption()
                                                                                                                                                                                                                                                                                                              flag = gui.QTextOption.Flag.ShowTabsAndSpaces
                                                                                                                                                                                                                                                                                                              if show:
                                                                                                                                                                                                                                                                                                                  options.setFlags(options.flags() | flag)
                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                  options.setFlags(options.flags() & ~flag)
                                                                                                                                                                                                                                                                                                              doc.setDefaultTextOption(options)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          wheelEvent(event)

                                                                                                                                                                                                                                                                                                          Handle wheel event for zooming.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/plaintextedit.py
                                                                                                                                                                                                                                                                                                          def wheelEvent(self, event):
                                                                                                                                                                                                                                                                                                              """Handle wheel event for zooming."""
                                                                                                                                                                                                                                                                                                              if not self._allow_wheel_zoom:
                                                                                                                                                                                                                                                                                                                  return super().wheelEvent(event)
                                                                                                                                                                                                                                                                                                              if event.modifiers() & constants.CTRL_MOD:
                                                                                                                                                                                                                                                                                                                  self.zoomIn() if event.angleDelta().y() > 0 else self.zoomOut()
                                                                                                                                                                                                                                                                                                                  event.accept()
                                                                                                                                                                                                                                                                                                                  return None
                                                                                                                                                                                                                                                                                                              super().wheelEvent(event)
                                                                                                                                                                                                                                                                                                              return None
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ProgressBar

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QProgressBar

                                                                                                                                                                                                                                                                                                          Horizontal or vertical progress bar.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/progressbar.py
                                                                                                                                                                                                                                                                                                          class ProgressBar(widgets.WidgetMixin, widgets.QProgressBar):
                                                                                                                                                                                                                                                                                                              """Horizontal or vertical progress bar."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, text_visible: bool = True, **kwargs):
                                                                                                                                                                                                                                                                                                                  self._text_direction = widgets.QProgressBar.Direction.TopToBottom
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, text_visible=text_visible, **kwargs)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_alignment(self, alignment: constants.AlignmentStr | constants.AlignmentFlag):
                                                                                                                                                                                                                                                                                                                  """Set the alignment of the layout.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      alignment: alignment for the layout
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setAlignment(constants.ALIGNMENTS.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_alignment(self) -> constants.AlignmentStr:
                                                                                                                                                                                                                                                                                                                  """Return current alignment.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      alignment
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.ALIGNMENTS.inverse[self.alignment()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_text_direction(
                                                                                                                                                                                                                                                                                                                  self, text_direction: TextDirectionStr | widgets.QProgressBar.Direction
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the text direction of the layout.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      text_direction: text direction for the layout
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  val = TEXT_DIRECTIONS.get_enum_value(text_direction)
                                                                                                                                                                                                                                                                                                                  self._text_direction = val
                                                                                                                                                                                                                                                                                                                  self.setTextDirection(val)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_text_direction(self) -> TextDirectionStr:
                                                                                                                                                                                                                                                                                                                  """Return current text direction.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      Text direction
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  direction = (
                                                                                                                                                                                                                                                                                                                      self.textDirection()
                                                                                                                                                                                                                                                                                                                      if hasattr(self, "textDirection")
                                                                                                                                                                                                                                                                                                                      else self._text_direction
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  return TEXT_DIRECTIONS.inverse[direction]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_orientation(
                                                                                                                                                                                                                                                                                                                  self, orientation: constants.OrientationStr | constants.Orientation
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the orientation of the progress bar.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      orientation: orientation for the progress bar
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setOrientation(constants.ORIENTATION.get_enum_value(orientation))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_orientation(self) -> constants.OrientationStr:
                                                                                                                                                                                                                                                                                                                  """Return current orientation.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      orientation
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.ORIENTATION.inverse[self.orientation()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_range(self, start: int, end: int):
                                                                                                                                                                                                                                                                                                                  self.setRange(start, end)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self, value: int):
                                                                                                                                                                                                                                                                                                                  self.setValue(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_value(self) -> int:
                                                                                                                                                                                                                                                                                                                  return self.value()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_alignment() -> constants.AlignmentStr

                                                                                                                                                                                                                                                                                                          Return current alignment.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/progressbar.py
                                                                                                                                                                                                                                                                                                          def get_alignment(self) -> constants.AlignmentStr:
                                                                                                                                                                                                                                                                                                              """Return current alignment.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  alignment
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.ALIGNMENTS.inverse[self.alignment()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_orientation() -> constants.OrientationStr

                                                                                                                                                                                                                                                                                                          Return current orientation.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/progressbar.py
                                                                                                                                                                                                                                                                                                          def get_orientation(self) -> constants.OrientationStr:
                                                                                                                                                                                                                                                                                                              """Return current orientation.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  orientation
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.ORIENTATION.inverse[self.orientation()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_text_direction() -> TextDirectionStr

                                                                                                                                                                                                                                                                                                          Return current text direction.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/progressbar.py
                                                                                                                                                                                                                                                                                                          def get_text_direction(self) -> TextDirectionStr:
                                                                                                                                                                                                                                                                                                              """Return current text direction.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  Text direction
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              direction = (
                                                                                                                                                                                                                                                                                                                  self.textDirection()
                                                                                                                                                                                                                                                                                                                  if hasattr(self, "textDirection")
                                                                                                                                                                                                                                                                                                                  else self._text_direction
                                                                                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                                                                                              return TEXT_DIRECTIONS.inverse[direction]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_alignment(alignment: constants.AlignmentStr | constants.AlignmentFlag)

                                                                                                                                                                                                                                                                                                          Set the alignment of the layout.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          alignment AlignmentStr | AlignmentFlag

                                                                                                                                                                                                                                                                                                          alignment for the layout

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/progressbar.py
                                                                                                                                                                                                                                                                                                          def set_alignment(self, alignment: constants.AlignmentStr | constants.AlignmentFlag):
                                                                                                                                                                                                                                                                                                              """Set the alignment of the layout.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  alignment: alignment for the layout
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setAlignment(constants.ALIGNMENTS.get_enum_value(alignment))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_orientation(orientation: constants.OrientationStr | constants.Orientation)

                                                                                                                                                                                                                                                                                                          Set the orientation of the progress bar.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          orientation OrientationStr | Orientation

                                                                                                                                                                                                                                                                                                          orientation for the progress bar

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/progressbar.py
                                                                                                                                                                                                                                                                                                          def set_orientation(
                                                                                                                                                                                                                                                                                                              self, orientation: constants.OrientationStr | constants.Orientation
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the orientation of the progress bar.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  orientation: orientation for the progress bar
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setOrientation(constants.ORIENTATION.get_enum_value(orientation))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_text_direction(text_direction: TextDirectionStr | widgets.QProgressBar.Direction)

                                                                                                                                                                                                                                                                                                          Set the text direction of the layout.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          text_direction TextDirectionStr | Direction

                                                                                                                                                                                                                                                                                                          text direction for the layout

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/progressbar.py
                                                                                                                                                                                                                                                                                                          def set_text_direction(
                                                                                                                                                                                                                                                                                                              self, text_direction: TextDirectionStr | widgets.QProgressBar.Direction
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the text direction of the layout.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  text_direction: text direction for the layout
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              val = TEXT_DIRECTIONS.get_enum_value(text_direction)
                                                                                                                                                                                                                                                                                                              self._text_direction = val
                                                                                                                                                                                                                                                                                                              self.setTextDirection(val)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ProgressDialog

                                                                                                                                                                                                                                                                                                          Bases: DialogMixin, QProgressDialog

                                                                                                                                                                                                                                                                                                          Feedback on the progress of a slow operation.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/progressdialog.py
                                                                                                                                                                                                                                                                                                          class ProgressDialog(widgets.DialogMixin, widgets.QProgressDialog):
                                                                                                                                                                                                                                                                                                              """Feedback on the progress of a slow operation."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, parent: widgets.QWidget | None = None):
                                                                                                                                                                                                                                                                                                                  super().__init__(parent=parent)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  progress_bar = widgets.ProgressBar()
                                                                                                                                                                                                                                                                                                                  progress_bar.setRange(0, 0)
                                                                                                                                                                                                                                                                                                                  progress_bar.setTextVisible(False)
                                                                                                                                                                                                                                                                                                                  self.setBar(progress_bar)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  self.set_icon("mdi.timer-sand-empty")
                                                                                                                                                                                                                                                                                                                  self.set_modality("application")
                                                                                                                                                                                                                                                                                                                  self.set_flags(
                                                                                                                                                                                                                                                                                                                      minimize=False, maximize=False, close=False, stay_on_top=True, window=True
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  self.setCancelButton(None)
                                                                                                                                                                                                                                                                                                                  self.cancel()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def show_message(self, message: str):
                                                                                                                                                                                                                                                                                                                  self.setLabelText(message)
                                                                                                                                                                                                                                                                                                                  self.show()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ProxyStyle

                                                                                                                                                                                                                                                                                                          Bases: CommonStyleMixin, QProxyStyle

                                                                                                                                                                                                                                                                                                          Convenience class that simplifies dynamically overriding QStyle elements.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/proxystyle.py
                                                                                                                                                                                                                                                                                                          class ProxyStyle(widgets.CommonStyleMixin, widgets.QProxyStyle):
                                                                                                                                                                                                                                                                                                              """Convenience class that simplifies dynamically overriding QStyle elements."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          PushButton

                                                                                                                                                                                                                                                                                                          Bases: PushButtonMixin, QPushButton

                                                                                                                                                                                                                                                                                                          Command button.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/pushbutton.py
                                                                                                                                                                                                                                                                                                          class PushButton(PushButtonMixin, widgets.QPushButton):
                                                                                                                                                                                                                                                                                                              """Command button."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          RadioButton

                                                                                                                                                                                                                                                                                                          Bases: AbstractButtonMixin, QRadioButton

                                                                                                                                                                                                                                                                                                          Radio button with a text label.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/radiobutton.py
                                                                                                                                                                                                                                                                                                          class RadioButton(widgets.AbstractButtonMixin, widgets.QRadioButton):
                                                                                                                                                                                                                                                                                                              """Radio button with a text label."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(bool)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.toggled.connect(self.value_changed)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          RhiWidget

                                                                                                                                                                                                                                                                                                          Bases: RhiWidgetMixin, QRhiWidget

                                                                                                                                                                                                                                                                                                          Widget for rendering 3D graphics via the Qt Rendering Hardware Interface.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/rhiwidget.py
                                                                                                                                                                                                                                                                                                          class RhiWidget(RhiWidgetMixin, widgets.QRhiWidget):
                                                                                                                                                                                                                                                                                                              """Widget for rendering 3D graphics via the Qt Rendering Hardware Interface."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          RhiWidgetMixin

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, _RhiWidgetBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/rhiwidget.py
                                                                                                                                                                                                                                                                                                          class RhiWidgetMixin(widgets.WidgetMixin, _RhiWidgetBase):
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {"colorBufferFormat": TEXTURE_FORMAT}
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_api(self, api: ApiStr | mod.Api):
                                                                                                                                                                                                                                                                                                                  """Set the graphics API to use.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      api: graphics API
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setApi(API.get_enum_value(api))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_api(self) -> ApiStr:
                                                                                                                                                                                                                                                                                                                  """Return current graphics API.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      graphics API
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return API.inverse[self.api()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_color_buffer_format(self, fmt: TextureFormatStr | mod.TextureFormat):
                                                                                                                                                                                                                                                                                                                  """Set the texture format for the color buffer.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      fmt: texture format
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setColorBufferFormat(TEXTURE_FORMAT.get_enum_value(fmt))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_color_buffer_format(self) -> TextureFormatStr:
                                                                                                                                                                                                                                                                                                                  """Return current color buffer texture format.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      texture format
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return TEXTURE_FORMAT.inverse[self.colorBufferFormat()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_fixed_color_buffer_size(self, size: datatypes.SizeType):
                                                                                                                                                                                                                                                                                                                  """Set fixed color buffer size."""
                                                                                                                                                                                                                                                                                                                  self.setFixedColorBufferSize(datatypes.to_size(size))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_fixed_color_buffer_size(self) -> core.Size:
                                                                                                                                                                                                                                                                                                                  """Return fixed color buffer size."""
                                                                                                                                                                                                                                                                                                                  return core.Size(self.fixedColorBufferSize())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_api() -> ApiStr

                                                                                                                                                                                                                                                                                                          Return current graphics API.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/rhiwidget.py
                                                                                                                                                                                                                                                                                                          def get_api(self) -> ApiStr:
                                                                                                                                                                                                                                                                                                              """Return current graphics API.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  graphics API
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return API.inverse[self.api()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_color_buffer_format() -> TextureFormatStr

                                                                                                                                                                                                                                                                                                          Return current color buffer texture format.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/rhiwidget.py
                                                                                                                                                                                                                                                                                                          def get_color_buffer_format(self) -> TextureFormatStr:
                                                                                                                                                                                                                                                                                                              """Return current color buffer texture format.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  texture format
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return TEXTURE_FORMAT.inverse[self.colorBufferFormat()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_fixed_color_buffer_size() -> core.Size

                                                                                                                                                                                                                                                                                                          Return fixed color buffer size.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/rhiwidget.py
                                                                                                                                                                                                                                                                                                          def get_fixed_color_buffer_size(self) -> core.Size:
                                                                                                                                                                                                                                                                                                              """Return fixed color buffer size."""
                                                                                                                                                                                                                                                                                                              return core.Size(self.fixedColorBufferSize())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_api(api: ApiStr | mod.Api)

                                                                                                                                                                                                                                                                                                          Set the graphics API to use.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          api ApiStr | Api

                                                                                                                                                                                                                                                                                                          graphics API

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/rhiwidget.py
                                                                                                                                                                                                                                                                                                          def set_api(self, api: ApiStr | mod.Api):
                                                                                                                                                                                                                                                                                                              """Set the graphics API to use.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  api: graphics API
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setApi(API.get_enum_value(api))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_color_buffer_format(fmt: TextureFormatStr | mod.TextureFormat)

                                                                                                                                                                                                                                                                                                          Set the texture format for the color buffer.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          fmt TextureFormatStr | TextureFormat

                                                                                                                                                                                                                                                                                                          texture format

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/rhiwidget.py
                                                                                                                                                                                                                                                                                                          def set_color_buffer_format(self, fmt: TextureFormatStr | mod.TextureFormat):
                                                                                                                                                                                                                                                                                                              """Set the texture format for the color buffer.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  fmt: texture format
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setColorBufferFormat(TEXTURE_FORMAT.get_enum_value(fmt))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_fixed_color_buffer_size(size: datatypes.SizeType)

                                                                                                                                                                                                                                                                                                          Set fixed color buffer size.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/rhiwidget.py
                                                                                                                                                                                                                                                                                                          def set_fixed_color_buffer_size(self, size: datatypes.SizeType):
                                                                                                                                                                                                                                                                                                              """Set fixed color buffer size."""
                                                                                                                                                                                                                                                                                                              self.setFixedColorBufferSize(datatypes.to_size(size))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          RubberBand

                                                                                                                                                                                                                                                                                                          Bases: RubberBandMixin, QRubberBand

                                                                                                                                                                                                                                                                                                          Rectangle or line that can indicate a selection or a boundary.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/rubberband.py
                                                                                                                                                                                                                                                                                                          class RubberBand(RubberBandMixin, widgets.QRubberBand):
                                                                                                                                                                                                                                                                                                              """Rectangle or line that can indicate a selection or a boundary."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ScrollArea

                                                                                                                                                                                                                                                                                                          Bases: AbstractScrollAreaMixin, QScrollArea

                                                                                                                                                                                                                                                                                                          Scrolling view onto another widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/scrollarea.py
                                                                                                                                                                                                                                                                                                          class ScrollArea(widgets.AbstractScrollAreaMixin, widgets.QScrollArea):
                                                                                                                                                                                                                                                                                                              """Scrolling view onto another widget."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  viewport = widgets.Widget(self, object_name=f"{type(self).__name__}_viewport")
                                                                                                                                                                                                                                                                                                                  self.setViewport(viewport)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __add__(self, other: widgets.QWidget | widgets.QLayout | list):
                                                                                                                                                                                                                                                                                                                  self.add(other)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_visible_widgets(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  typ: type[T] = widgets.QWidget,  # ty: ignore[invalid-parameter-default]
                                                                                                                                                                                                                                                                                                                  partial_allowed: bool = True,
                                                                                                                                                                                                                                                                                                                  margin: int = 10,
                                                                                                                                                                                                                                                                                                                  recursive: bool = True,
                                                                                                                                                                                                                                                                                                              ) -> listdelegators.ListDelegator[T]:
                                                                                                                                                                                                                                                                                                                  """Return all widgets which are visible in the viewport.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Results can be filtered by type and whether widget is fully or partially visible.
                                                                                                                                                                                                                                                                                                                  A positive margin increases the area to search for widgets, a negative margin
                                                                                                                                                                                                                                                                                                                  decreases it.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if (widget := self.widget()) is None:
                                                                                                                                                                                                                                                                                                                      return listdelegators.ListDelegator([])
                                                                                                                                                                                                                                                                                                                  widget = cast("widgets.Widget", widget)  # set via prettyqt
                                                                                                                                                                                                                                                                                                                  viewport = self.viewport()
                                                                                                                                                                                                                                                                                                                  rect = viewport.rect().adjusted(-margin, -margin, margin, margin)
                                                                                                                                                                                                                                                                                                                  found = []
                                                                                                                                                                                                                                                                                                                  for w in widget.find_children(typ, recursive=recursive):
                                                                                                                                                                                                                                                                                                                      top_left = w.mapTo(viewport, w.rect().topLeft())
                                                                                                                                                                                                                                                                                                                      bottom_right = w.mapTo(viewport, w.rect().bottomRight())
                                                                                                                                                                                                                                                                                                                      mapped = core.Rect(top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                      if (partial_allowed and rect.intersects(mapped)) or (
                                                                                                                                                                                                                                                                                                                          not partial_allowed and rect.contains(mapped)
                                                                                                                                                                                                                                                                                                                      ):
                                                                                                                                                                                                                                                                                                                          found.append(w)
                                                                                                                                                                                                                                                                                                                  return listdelegators.ListDelegator(found)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_layout(self) -> widgets.LayoutMixin:
                                                                                                                                                                                                                                                                                                                  """Layout of the scrolled widget (set_layout() installs prettyqt layouts)."""
                                                                                                                                                                                                                                                                                                                  if (widget := self.widget()) is None or (layout := widget.layout()) is None:
                                                                                                                                                                                                                                                                                                                      msg = "ScrollArea has no widget with a layout"
                                                                                                                                                                                                                                                                                                                      raise RuntimeError(msg)
                                                                                                                                                                                                                                                                                                                  return cast("widgets.LayoutMixin", layout)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_children(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                              ) -> listdelegators.ListDelegator[widgets.QWidget | widgets.QLayout]:
                                                                                                                                                                                                                                                                                                                  return self._get_layout().get_children()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_widget(self, widget: widgets.QWidget):
                                                                                                                                                                                                                                                                                                                  self.setWidget(widget)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_widget(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  self._get_layout().addWidget(*args, **kwargs)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_layout(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  layout = self._get_layout()
                                                                                                                                                                                                                                                                                                                  if not isinstance(layout, widgets.QBoxLayout | widgets.QGridLayout):
                                                                                                                                                                                                                                                                                                                      raise TypeError(layout)
                                                                                                                                                                                                                                                                                                                  layout.addLayout(*args, **kwargs)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  item: widgets.QWidget | widgets.QLayout | list,
                                                                                                                                                                                                                                                                                                                  stretch: int | None = None,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  match item:
                                                                                                                                                                                                                                                                                                                      case widgets.QWidget():
                                                                                                                                                                                                                                                                                                                          self.add_widget(item)
                                                                                                                                                                                                                                                                                                                      case widgets.QLayout():
                                                                                                                                                                                                                                                                                                                          widget = widgets.Widget(self)
                                                                                                                                                                                                                                                                                                                          widget.set_layout(item)
                                                                                                                                                                                                                                                                                                                          self.add_widget(widget)
                                                                                                                                                                                                                                                                                                                      case list():
                                                                                                                                                                                                                                                                                                                          for i in item:
                                                                                                                                                                                                                                                                                                                              self.add(i, stretch)
                                                                                                                                                                                                                                                                                                                          return item
                                                                                                                                                                                                                                                                                                                  layout = self._get_layout()
                                                                                                                                                                                                                                                                                                                  if stretch and isinstance(layout, widgets.QBoxLayout):
                                                                                                                                                                                                                                                                                                                      layout.setStretch(layout.count() - 1, stretch)
                                                                                                                                                                                                                                                                                                                  return item
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_visible_widgets(typ: type[T] = widgets.QWidget, partial_allowed: bool = True, margin: int = 10, recursive: bool = True) -> listdelegators.ListDelegator[T]

                                                                                                                                                                                                                                                                                                          Return all widgets which are visible in the viewport.

                                                                                                                                                                                                                                                                                                          Results can be filtered by type and whether widget is fully or partially visible. A positive margin increases the area to search for widgets, a negative margin decreases it.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/scrollarea.py
                                                                                                                                                                                                                                                                                                          def get_visible_widgets(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              typ: type[T] = widgets.QWidget,  # ty: ignore[invalid-parameter-default]
                                                                                                                                                                                                                                                                                                              partial_allowed: bool = True,
                                                                                                                                                                                                                                                                                                              margin: int = 10,
                                                                                                                                                                                                                                                                                                              recursive: bool = True,
                                                                                                                                                                                                                                                                                                          ) -> listdelegators.ListDelegator[T]:
                                                                                                                                                                                                                                                                                                              """Return all widgets which are visible in the viewport.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Results can be filtered by type and whether widget is fully or partially visible.
                                                                                                                                                                                                                                                                                                              A positive margin increases the area to search for widgets, a negative margin
                                                                                                                                                                                                                                                                                                              decreases it.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if (widget := self.widget()) is None:
                                                                                                                                                                                                                                                                                                                  return listdelegators.ListDelegator([])
                                                                                                                                                                                                                                                                                                              widget = cast("widgets.Widget", widget)  # set via prettyqt
                                                                                                                                                                                                                                                                                                              viewport = self.viewport()
                                                                                                                                                                                                                                                                                                              rect = viewport.rect().adjusted(-margin, -margin, margin, margin)
                                                                                                                                                                                                                                                                                                              found = []
                                                                                                                                                                                                                                                                                                              for w in widget.find_children(typ, recursive=recursive):
                                                                                                                                                                                                                                                                                                                  top_left = w.mapTo(viewport, w.rect().topLeft())
                                                                                                                                                                                                                                                                                                                  bottom_right = w.mapTo(viewport, w.rect().bottomRight())
                                                                                                                                                                                                                                                                                                                  mapped = core.Rect(top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                  if (partial_allowed and rect.intersects(mapped)) or (
                                                                                                                                                                                                                                                                                                                      not partial_allowed and rect.contains(mapped)
                                                                                                                                                                                                                                                                                                                  ):
                                                                                                                                                                                                                                                                                                                      found.append(w)
                                                                                                                                                                                                                                                                                                              return listdelegators.ListDelegator(found)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ScrollBar

                                                                                                                                                                                                                                                                                                          Bases: ScrollBarMixin, QScrollBar

                                                                                                                                                                                                                                                                                                          Vertical or horizontal scroll bar.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/scrollbar.py
                                                                                                                                                                                                                                                                                                          class ScrollBar(ScrollBarMixin, widgets.QScrollBar):
                                                                                                                                                                                                                                                                                                              """Vertical or horizontal scroll bar."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Scroller

                                                                                                                                                                                                                                                                                                          Bases: ObjectMixin

                                                                                                                                                                                                                                                                                                          Enables kinetic scrolling for any scrolling widget or graphics item.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/scroller.py
                                                                                                                                                                                                                                                                                                          class Scroller(core.ObjectMixin):
                                                                                                                                                                                                                                                                                                              """Enables kinetic scrolling for any scrolling widget or graphics item."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, item: widgets.QScroller):
                                                                                                                                                                                                                                                                                                                  self.item = item
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getattr__(self, val):
                                                                                                                                                                                                                                                                                                                  return getattr(self.item, val)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_state(self) -> StateStr:
                                                                                                                                                                                                                                                                                                                  """Return current state.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      state
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return STATE.inverse[self.state()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_velocity(self) -> core.PointF:
                                                                                                                                                                                                                                                                                                                  return core.PointF(self.velocity())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_pixel_per_meter(self) -> core.PointF:
                                                                                                                                                                                                                                                                                                                  return core.PointF(self.pixelPerMeter())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_final_position(self) -> core.PointF:
                                                                                                                                                                                                                                                                                                                  return core.PointF(self.finalPosition())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def handle_input(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  input_type: InputStr | widgets.QScroller.Input,
                                                                                                                                                                                                                                                                                                                  position: datatypes.PointFType,
                                                                                                                                                                                                                                                                                                                  timestamp: int = 0,
                                                                                                                                                                                                                                                                                                              ) -> bool:
                                                                                                                                                                                                                                                                                                                  return self.handleInput(
                                                                                                                                                                                                                                                                                                                      INPUT.get_enum_value(input_type), datatypes.to_pointf(position), timestamp
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_scroller_properties(self) -> widgets.ScrollerProperties:
                                                                                                                                                                                                                                                                                                                  return widgets.ScrollerProperties(self.scrollerProperties())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def get_scroller(cls, obj: core.QObject) -> Self:
                                                                                                                                                                                                                                                                                                                  return cls(widgets.QScroller.scroller(obj))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @staticmethod
                                                                                                                                                                                                                                                                                                              def grab_gesture(
                                                                                                                                                                                                                                                                                                                  target: core.QObject,
                                                                                                                                                                                                                                                                                                                  gesture_type: (
                                                                                                                                                                                                                                                                                                                      ScrollGestureTypeStr | widgets.QScroller.ScrollerGestureType
                                                                                                                                                                                                                                                                                                                  ) = "touch",
                                                                                                                                                                                                                                                                                                              ) -> constants.GestureTypeStr:
                                                                                                                                                                                                                                                                                                                  gesture = widgets.QScroller.grabGesture(
                                                                                                                                                                                                                                                                                                                      target, SCROLLER_GESTURE_TYPE.get_enum_value(gesture_type)
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  value = gesture.value
                                                                                                                                                                                                                                                                                                                  if value >= 256:  # noqa: PLR2004  # custom gesture ids start at 256
                                                                                                                                                                                                                                                                                                                      value -= 256
                                                                                                                                                                                                                                                                                                                  return constants.GESTURE_TYPE.inverse[constants.GestureType(value)]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @staticmethod
                                                                                                                                                                                                                                                                                                              def grabbed_gesture(target: core.QObject) -> constants.GestureTypeStr:
                                                                                                                                                                                                                                                                                                                  gesture = widgets.QScroller.grabbedGesture(target)
                                                                                                                                                                                                                                                                                                                  value = gesture.value
                                                                                                                                                                                                                                                                                                                  if value >= 256:  # noqa: PLR2004  # custom gesture ids start at 256
                                                                                                                                                                                                                                                                                                                      value -= 256
                                                                                                                                                                                                                                                                                                                  return constants.GESTURE_TYPE.inverse[constants.GestureType(value)]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_state() -> StateStr

                                                                                                                                                                                                                                                                                                          Return current state.

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

                                                                                                                                                                                                                                                                                                          ScrollerProperties

                                                                                                                                                                                                                                                                                                          Bases: QScrollerProperties

                                                                                                                                                                                                                                                                                                          Stores the settings for a QScroller.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/scrollerproperties.py
                                                                                                                                                                                                                                                                                                          class ScrollerProperties(QtWidgets.QScrollerProperties):
                                                                                                                                                                                                                                                                                                              """Stores the settings for a QScroller."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(self, metric: ScrollmetricStr | mod.ScrollMetric):
                                                                                                                                                                                                                                                                                                                  return self.get_scroll_metric(metric)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __setitem__(self, metric: ScrollmetricStr | mod.ScrollMetric, value: Any):
                                                                                                                                                                                                                                                                                                                  self.set_scroll_metric(metric, value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def keys(self) -> KeysView[ScrollmetricStr]:
                                                                                                                                                                                                                                                                                                                  return SCROLL_METRIC.keys()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __iter__(self) -> Iterator[ScrollmetricStr]:
                                                                                                                                                                                                                                                                                                                  return iter(SCROLL_METRIC.keys())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_scroll_metric(self, metric: ScrollmetricStr | mod.ScrollMetric, value: Any):
                                                                                                                                                                                                                                                                                                                  """Set scroll metric.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      metric: Scroll metric to set
                                                                                                                                                                                                                                                                                                                      value: Value to set
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setScrollMetric(SCROLL_METRIC.get_enum_value(metric), value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_scroll_metric(self, metric: ScrollmetricStr | mod.ScrollMetric) -> Any:
                                                                                                                                                                                                                                                                                                                  """Return scroll metric.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      metric: Scroll metric to get
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      state
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return self.scrollMetric(SCROLL_METRIC.get_enum_value(metric))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_scroll_metrics(self) -> dict[ScrollmetricStr, Any]:
                                                                                                                                                                                                                                                                                                                  return {i: self.get_scroll_metric(i) for i in SCROLL_METRIC}
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_scroll_metric(metric: ScrollmetricStr | mod.ScrollMetric) -> Any

                                                                                                                                                                                                                                                                                                          Return scroll metric.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          metric ScrollmetricStr | ScrollMetric

                                                                                                                                                                                                                                                                                                          Scroll metric to get

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/scrollerproperties.py
                                                                                                                                                                                                                                                                                                          def get_scroll_metric(self, metric: ScrollmetricStr | mod.ScrollMetric) -> Any:
                                                                                                                                                                                                                                                                                                              """Return scroll metric.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  metric: Scroll metric to get
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  state
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return self.scrollMetric(SCROLL_METRIC.get_enum_value(metric))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_scroll_metric(metric: ScrollmetricStr | mod.ScrollMetric, value: Any)

                                                                                                                                                                                                                                                                                                          Set scroll metric.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          metric ScrollmetricStr | ScrollMetric

                                                                                                                                                                                                                                                                                                          Scroll metric to set

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          value Any

                                                                                                                                                                                                                                                                                                          Value to set

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/scrollerproperties.py
                                                                                                                                                                                                                                                                                                          def set_scroll_metric(self, metric: ScrollmetricStr | mod.ScrollMetric, value: Any):
                                                                                                                                                                                                                                                                                                              """Set scroll metric.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  metric: Scroll metric to set
                                                                                                                                                                                                                                                                                                                  value: Value to set
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setScrollMetric(SCROLL_METRIC.get_enum_value(metric), value)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          SizeGrip

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QSizeGrip

                                                                                                                                                                                                                                                                                                          Resize handle for resizing top-level windows.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/sizegrip.py
                                                                                                                                                                                                                                                                                                          class SizeGrip(widgets.WidgetMixin, widgets.QSizeGrip):
                                                                                                                                                                                                                                                                                                              """Resize handle for resizing top-level windows."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def setup_example(cls):
                                                                                                                                                                                                                                                                                                                  w = widgets.Widget()
                                                                                                                                                                                                                                                                                                                  return cls(w)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          SizePolicy

                                                                                                                                                                                                                                                                                                          Bases: QSizePolicy

                                                                                                                                                                                                                                                                                                          Layout attribute describing horizontal and vertical resizing policy.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/sizepolicy.py
                                                                                                                                                                                                                                                                                                          class SizePolicy(QtWidgets.QSizePolicy):
                                                                                                                                                                                                                                                                                                              """Layout attribute describing horizontal and vertical resizing policy."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  match args:
                                                                                                                                                                                                                                                                                                                      case (str(), str()):
                                                                                                                                                                                                                                                                                                                          super().__init__(SIZE_POLICY[args[0]], SIZE_POLICY[args[1]])
                                                                                                                                                                                                                                                                                                                      case (str(), str(), str()):
                                                                                                                                                                                                                                                                                                                          super().__init__(
                                                                                                                                                                                                                                                                                                                              SIZE_POLICY[args[0]], SIZE_POLICY[args[1]], CONTROL_TYPE[args[2]]
                                                                                                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __repr__(self) -> str:
                                                                                                                                                                                                                                                                                                                  return get_repr(
                                                                                                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                                                                                                      self.get_horizontal_policy(),
                                                                                                                                                                                                                                                                                                                      self.get_vertical_policy(),
                                                                                                                                                                                                                                                                                                                      self.get_control_type(),
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getstate__(self):
                                                                                                                                                                                                                                                                                                                  return dict(
                                                                                                                                                                                                                                                                                                                      has_height_for_width=self.hasHeightForWidth(),
                                                                                                                                                                                                                                                                                                                      has_width_for_height=self.hasWidthForHeight(),
                                                                                                                                                                                                                                                                                                                      horizontal_stretch=self.horizontalStretch(),
                                                                                                                                                                                                                                                                                                                      vertical_stretch=self.verticalStretch(),
                                                                                                                                                                                                                                                                                                                      horizontal_policy=self.get_horizontal_policy(),
                                                                                                                                                                                                                                                                                                                      vertical_policy=self.get_vertical_policy(),
                                                                                                                                                                                                                                                                                                                      retain_size_when_hidden=self.retainSizeWhenHidden(),
                                                                                                                                                                                                                                                                                                                      control_type=self.get_control_type(),
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __setstate__(self, state: dict[str, Any]):
                                                                                                                                                                                                                                                                                                                  self.setHeightForWidth(state["has_height_for_width"])
                                                                                                                                                                                                                                                                                                                  self.setWidthForHeight(state["has_width_for_height"])
                                                                                                                                                                                                                                                                                                                  self.setHorizontalStretch(state["horizontal_stretch"])
                                                                                                                                                                                                                                                                                                                  self.setVerticalStretch(state["vertical_stretch"])
                                                                                                                                                                                                                                                                                                                  self.set_horizontal_policy(state["horizontal_policy"])
                                                                                                                                                                                                                                                                                                                  self.set_vertical_policy(state["vertical_policy"])
                                                                                                                                                                                                                                                                                                                  self.setRetainSizeWhenHidden(state["retain_size_when_hidden"])
                                                                                                                                                                                                                                                                                                                  self.set_control_type(state["control_type"])
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __reduce__(self):
                                                                                                                                                                                                                                                                                                                  return type(self), (), self.__getstate__()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def serialize(self) -> dict[str, Any]:
                                                                                                                                                                                                                                                                                                                  return self.__getstate__()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def clone(cls, qpol: QtWidgets.QSizePolicy) -> Self:
                                                                                                                                                                                                                                                                                                                  pol = cls(qpol.horizontalPolicy(), qpol.verticalPolicy(), qpol.controlType())
                                                                                                                                                                                                                                                                                                                  pol.setHeightForWidth(qpol.hasHeightForWidth())
                                                                                                                                                                                                                                                                                                                  pol.setWidthForHeight(qpol.hasWidthForHeight())
                                                                                                                                                                                                                                                                                                                  pol.setHorizontalStretch(qpol.horizontalStretch())
                                                                                                                                                                                                                                                                                                                  pol.setVerticalStretch(qpol.verticalStretch())
                                                                                                                                                                                                                                                                                                                  pol.setRetainSizeWhenHidden(qpol.retainSizeWhenHidden())
                                                                                                                                                                                                                                                                                                                  return pol
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_horizontal_policy(self) -> SizePolicyStr:
                                                                                                                                                                                                                                                                                                                  """Return size policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      horizontal size policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return SIZE_POLICY.inverse[self.horizontalPolicy()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_horizontal_policy(self, policy: SizePolicyStr | QtWidgets.QSizePolicy.Policy):
                                                                                                                                                                                                                                                                                                                  """Set the horizontal policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      policy: policy to set
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setHorizontalPolicy(SIZE_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_vertical_policy(self) -> SizePolicyStr:
                                                                                                                                                                                                                                                                                                                  """Return size policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      vertical size policy
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return SIZE_POLICY.inverse[self.verticalPolicy()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_vertical_policy(self, policy: SizePolicyStr | QtWidgets.QSizePolicy.Policy):
                                                                                                                                                                                                                                                                                                                  """Set the horizontal policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      policy: policy to set
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setVerticalPolicy(SIZE_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_control_type(self) -> ControlTypeStr:
                                                                                                                                                                                                                                                                                                                  """Return control type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      control type
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return CONTROL_TYPE.inverse[self.controlType()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_control_type(self, typ: ControlTypeStr | QtWidgets.QSizePolicy.ControlType):
                                                                                                                                                                                                                                                                                                                  """Set the control type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      typ: control type to set
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setControlType(CONTROL_TYPE.get_enum_value(typ))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_transposed(self) -> Self:
                                                                                                                                                                                                                                                                                                                  transposed = self.transposed()
                                                                                                                                                                                                                                                                                                                  return type(self).clone(transposed)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_control_type() -> ControlTypeStr

                                                                                                                                                                                                                                                                                                          Return control type.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/sizepolicy.py
                                                                                                                                                                                                                                                                                                          def get_control_type(self) -> ControlTypeStr:
                                                                                                                                                                                                                                                                                                              """Return control type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  control type
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return CONTROL_TYPE.inverse[self.controlType()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_horizontal_policy() -> SizePolicyStr

                                                                                                                                                                                                                                                                                                          Return size policy.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/sizepolicy.py
                                                                                                                                                                                                                                                                                                          def get_horizontal_policy(self) -> SizePolicyStr:
                                                                                                                                                                                                                                                                                                              """Return size policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  horizontal size policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return SIZE_POLICY.inverse[self.horizontalPolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_vertical_policy() -> SizePolicyStr

                                                                                                                                                                                                                                                                                                          Return size policy.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/sizepolicy.py
                                                                                                                                                                                                                                                                                                          def get_vertical_policy(self) -> SizePolicyStr:
                                                                                                                                                                                                                                                                                                              """Return size policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  vertical size policy
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return SIZE_POLICY.inverse[self.verticalPolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_control_type(typ: ControlTypeStr | QtWidgets.QSizePolicy.ControlType)

                                                                                                                                                                                                                                                                                                          Set the control type.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          typ ControlTypeStr | ControlType

                                                                                                                                                                                                                                                                                                          control type to set

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/sizepolicy.py
                                                                                                                                                                                                                                                                                                          def set_control_type(self, typ: ControlTypeStr | QtWidgets.QSizePolicy.ControlType):
                                                                                                                                                                                                                                                                                                              """Set the control type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  typ: control type to set
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setControlType(CONTROL_TYPE.get_enum_value(typ))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_horizontal_policy(policy: SizePolicyStr | QtWidgets.QSizePolicy.Policy)

                                                                                                                                                                                                                                                                                                          Set the horizontal policy.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          policy SizePolicyStr | Policy

                                                                                                                                                                                                                                                                                                          policy to set

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/sizepolicy.py
                                                                                                                                                                                                                                                                                                          def set_horizontal_policy(self, policy: SizePolicyStr | QtWidgets.QSizePolicy.Policy):
                                                                                                                                                                                                                                                                                                              """Set the horizontal policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  policy: policy to set
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setHorizontalPolicy(SIZE_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_vertical_policy(policy: SizePolicyStr | QtWidgets.QSizePolicy.Policy)

                                                                                                                                                                                                                                                                                                          Set the horizontal policy.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          policy SizePolicyStr | Policy

                                                                                                                                                                                                                                                                                                          policy to set

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/sizepolicy.py
                                                                                                                                                                                                                                                                                                          def set_vertical_policy(self, policy: SizePolicyStr | QtWidgets.QSizePolicy.Policy):
                                                                                                                                                                                                                                                                                                              """Set the horizontal policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  policy: policy to set
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setVerticalPolicy(SIZE_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Slider

                                                                                                                                                                                                                                                                                                          Bases: AbstractSliderMixin, QSlider

                                                                                                                                                                                                                                                                                                          Vertical or horizontal slider.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/slider.py
                                                                                                                                                                                                                                                                                                          class Slider(widgets.AbstractSliderMixin, widgets.QSlider):
                                                                                                                                                                                                                                                                                                              """Vertical or horizontal slider."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(int)
                                                                                                                                                                                                                                                                                                              clicked = core.Signal(int)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  match args:
                                                                                                                                                                                                                                                                                                                      case (str(), *rest):
                                                                                                                                                                                                                                                                                                                          super().__init__(constants.ORIENTATION[args[0]], *rest, **kwargs)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.valueChanged.connect(self.on_value_change)
                                                                                                                                                                                                                                                                                                                  # style = HollowHandleStyle(
                                                                                                                                                                                                                                                                                                                  #     {
                                                                                                                                                                                                                                                                                                                  #         "groove.height": 4,
                                                                                                                                                                                                                                                                                                                  #         "sub-page.color": gui.QColor(72, 210, 242),
                                                                                                                                                                                                                                                                                                                  #         "add-page.color": gui.QColor(255, 255, 255, 50),
                                                                                                                                                                                                                                                                                                                  #         "handle.color": gui.QColor(72, 210, 242),
                                                                                                                                                                                                                                                                                                                  #         "handle.ring-width": 2,
                                                                                                                                                                                                                                                                                                                  #         "handle.hollow-radius": 10,
                                                                                                                                                                                                                                                                                                                  #         "handle.margin": 0,
                                                                                                                                                                                                                                                                                                                  #     }
                                                                                                                                                                                                                                                                                                                  # )
                                                                                                                                                                                                                                                                                                                  # self.setStyle(style)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def mousePressEvent(self, e: gui.QMouseEvent):
                                                                                                                                                                                                                                                                                                                  self.clicked.emit(self.value())
                                                                                                                                                                                                                                                                                                                  if self.orientation() == constants.Orientation.Horizontal:
                                                                                                                                                                                                                                                                                                                      value = e.pos().x() / self.width() * self.maximum()
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      value = (self.height() - e.pos().y()) / self.height() * self.maximum()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  self.setValue(int(value))
                                                                                                                                                                                                                                                                                                                  super().mousePressEvent(e)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_tick_position(
                                                                                                                                                                                                                                                                                                                  self, position: TickPositionAllStr | widgets.QSlider.TickPosition
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the tick position for the slider.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  For vertical orientation, "above" equals to "left" and "below" to "right".
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      position: position for the ticks
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if position == "left":
                                                                                                                                                                                                                                                                                                                      position = "above"
                                                                                                                                                                                                                                                                                                                  elif position == "right":
                                                                                                                                                                                                                                                                                                                      position = "below"
                                                                                                                                                                                                                                                                                                                  self.setTickPosition(TICK_POSITION.get_enum_value(position))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_tick_position(self) -> TickPositionStr:
                                                                                                                                                                                                                                                                                                                  """Return tick position.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      tick position
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return TICK_POSITION.inverse[self.tickPosition()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_tick_position() -> TickPositionStr

                                                                                                                                                                                                                                                                                                          Return tick position.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/slider.py
                                                                                                                                                                                                                                                                                                          def get_tick_position(self) -> TickPositionStr:
                                                                                                                                                                                                                                                                                                              """Return tick position.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  tick position
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return TICK_POSITION.inverse[self.tickPosition()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_tick_position(position: TickPositionAllStr | widgets.QSlider.TickPosition)

                                                                                                                                                                                                                                                                                                          Set the tick position for the slider.

                                                                                                                                                                                                                                                                                                          For vertical orientation, "above" equals to "left" and "below" to "right".

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          position TickPositionAllStr | TickPosition

                                                                                                                                                                                                                                                                                                          position for the ticks

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/slider.py
                                                                                                                                                                                                                                                                                                          def set_tick_position(
                                                                                                                                                                                                                                                                                                              self, position: TickPositionAllStr | widgets.QSlider.TickPosition
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the tick position for the slider.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              For vertical orientation, "above" equals to "left" and "below" to "right".
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  position: position for the ticks
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if position == "left":
                                                                                                                                                                                                                                                                                                                  position = "above"
                                                                                                                                                                                                                                                                                                              elif position == "right":
                                                                                                                                                                                                                                                                                                                  position = "below"
                                                                                                                                                                                                                                                                                                              self.setTickPosition(TICK_POSITION.get_enum_value(position))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          SpacerItem

                                                                                                                                                                                                                                                                                                          Bases: LayoutItemMixin, QSpacerItem

                                                                                                                                                                                                                                                                                                          Blank space in a layout.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/spaceritem.py
                                                                                                                                                                                                                                                                                                          class SpacerItem(widgets.LayoutItemMixin, widgets.QSpacerItem):
                                                                                                                                                                                                                                                                                                              """Blank space in a layout."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  w: int,
                                                                                                                                                                                                                                                                                                                  h: int,
                                                                                                                                                                                                                                                                                                                  h_policy: widgets.QSizePolicy.Policy
                                                                                                                                                                                                                                                                                                                  | widgets.sizepolicy.SizePolicyStr = "minimum",
                                                                                                                                                                                                                                                                                                                  v_policy: widgets.QSizePolicy.Policy
                                                                                                                                                                                                                                                                                                                  | widgets.sizepolicy.SizePolicyStr = "minimum",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  if isinstance(h_policy, widgets.QSizePolicy.Policy):
                                                                                                                                                                                                                                                                                                                      h_pol = h_policy
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      h_pol = widgets.sizepolicy.SIZE_POLICY[h_policy]
                                                                                                                                                                                                                                                                                                                  if isinstance(v_policy, widgets.QSizePolicy.Policy):
                                                                                                                                                                                                                                                                                                                      v_pol = v_policy
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      v_pol = widgets.sizepolicy.SIZE_POLICY[v_policy]
                                                                                                                                                                                                                                                                                                                  super().__init__(w, h, h_pol, v_pol)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def change_size(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  w: int,
                                                                                                                                                                                                                                                                                                                  h: int,
                                                                                                                                                                                                                                                                                                                  h_policy: widgets.sizepolicy.SizePolicyStr = "minimum",
                                                                                                                                                                                                                                                                                                                  v_policy: widgets.sizepolicy.SizePolicyStr = "minimum",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  h_pol = widgets.sizepolicy.SIZE_POLICY[h_policy]
                                                                                                                                                                                                                                                                                                                  v_pol = widgets.sizepolicy.SIZE_POLICY[v_policy]
                                                                                                                                                                                                                                                                                                                  self.changeSize(w, h, h_pol, v_pol)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_size_policy(self) -> widgets.SizePolicy:
                                                                                                                                                                                                                                                                                                                  return widgets.SizePolicy.clone(self.sizePolicy())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          SplashScreen

                                                                                                                                                                                                                                                                                                          Bases: SplashScreenMixin, QSplashScreen

                                                                                                                                                                                                                                                                                                          Splash screen that can be shown during application startup.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/splashscreen.py
                                                                                                                                                                                                                                                                                                          class SplashScreen(SplashScreenMixin, widgets.QSplashScreen):
                                                                                                                                                                                                                                                                                                              """Splash screen that can be shown during application startup."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Splitter

                                                                                                                                                                                                                                                                                                          Bases: SplitterMixin, QSplitter

                                                                                                                                                                                                                                                                                                          Implements a splitter widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/splitter.py
                                                                                                                                                                                                                                                                                                          class Splitter(SplitterMixin, widgets.QSplitter):
                                                                                                                                                                                                                                                                                                              """Implements a splitter widget."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          SplitterHandle

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QSplitterHandle

                                                                                                                                                                                                                                                                                                          Handle functionality for the splitter.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/splitterhandle.py
                                                                                                                                                                                                                                                                                                          class SplitterHandle(widgets.WidgetMixin, widgets.QSplitterHandle):
                                                                                                                                                                                                                                                                                                              """Handle functionality for the splitter."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              double_clicked = core.Signal(object)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  orientation: constants.OrientationStr | constants.Orientation,
                                                                                                                                                                                                                                                                                                                  parent: widgets.QSplitter,
                                                                                                                                                                                                                                                                                                                  **kwargs,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  ori = constants.ORIENTATION.get_enum_value(orientation)
                                                                                                                                                                                                                                                                                                                  super().__init__(ori, parent, **kwargs)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def setup_example(cls):
                                                                                                                                                                                                                                                                                                                  w = widgets.Splitter("horizontal")
                                                                                                                                                                                                                                                                                                                  return cls("horizontal", w)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def mouseDoubleClickEvent(self, ev):
                                                                                                                                                                                                                                                                                                                  self.double_clicked.emit(self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_orientation(
                                                                                                                                                                                                                                                                                                                  self, orientation: constants.OrientationStr | constants.Orientation
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the orientation of the slider.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      orientation: orientation for the slider
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setOrientation(constants.ORIENTATION.get_enum_value(orientation))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_orientation(self) -> constants.OrientationStr:
                                                                                                                                                                                                                                                                                                                  """Return current orientation.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      orientation
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.ORIENTATION.inverse[self.orientation()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_orientation() -> constants.OrientationStr

                                                                                                                                                                                                                                                                                                          Return current orientation.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/splitterhandle.py
                                                                                                                                                                                                                                                                                                          def get_orientation(self) -> constants.OrientationStr:
                                                                                                                                                                                                                                                                                                              """Return current orientation.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  orientation
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.ORIENTATION.inverse[self.orientation()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_orientation(orientation: constants.OrientationStr | constants.Orientation)

                                                                                                                                                                                                                                                                                                          Set the orientation of the slider.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          orientation OrientationStr | Orientation

                                                                                                                                                                                                                                                                                                          orientation for the slider

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/splitterhandle.py
                                                                                                                                                                                                                                                                                                          def set_orientation(
                                                                                                                                                                                                                                                                                                              self, orientation: constants.OrientationStr | constants.Orientation
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the orientation of the slider.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  orientation: orientation for the slider
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setOrientation(constants.ORIENTATION.get_enum_value(orientation))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          StackedLayout

                                                                                                                                                                                                                                                                                                          Bases: LayoutMixin, QStackedLayout

                                                                                                                                                                                                                                                                                                          Layout containing stack of widgets where only one widget is visible at a time.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/stackedlayout.py
                                                                                                                                                                                                                                                                                                          class StackedLayout(widgets.LayoutMixin, widgets.QStackedLayout):
                                                                                                                                                                                                                                                                                                              """Layout containing stack of widgets where only one widget is visible at a time."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              ID = "stacked"
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {"stackingMode": STACKING_MODE}
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_stacking_mode(self, mode: StackingModeStr):
                                                                                                                                                                                                                                                                                                                  self.setStackingMode(STACKING_MODE[mode])
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_stacking_mode(self) -> StackingModeStr:
                                                                                                                                                                                                                                                                                                                  return STACKING_MODE.inverse[self.stackingMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __add__(self, other: widgets.QWidget | widgets.QLayout):
                                                                                                                                                                                                                                                                                                                  self.add(other)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_current_widget(self, widget: widgets.QWidget):
                                                                                                                                                                                                                                                                                                                  self.setCurrentWidget(widget)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          StackedWidget

                                                                                                                                                                                                                                                                                                          Bases: FrameMixin, QStackedWidget

                                                                                                                                                                                                                                                                                                          Widget containing stack of widgets where only one widget is visible at a time.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/stackedwidget.py
                                                                                                                                                                                                                                                                                                          class StackedWidget(widgets.FrameMixin, widgets.QStackedWidget):
                                                                                                                                                                                                                                                                                                              """Widget containing stack of widgets where only one widget is visible at a time."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.animator = animations.Animator(self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __add__(self, other: widgets.QWidget) -> StackedWidget:
                                                                                                                                                                                                                                                                                                                  self.addWidget(other)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def __getitem__(self, index: int) -> widgets.QWidget: ...
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def __getitem__(
                                                                                                                                                                                                                                                                                                                  self, index: slice
                                                                                                                                                                                                                                                                                                              ) -> listdelegators.ListDelegator[widgets.QWidget]: ...
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(
                                                                                                                                                                                                                                                                                                                  self, index: int | slice
                                                                                                                                                                                                                                                                                                              ) -> widgets.QWidget | listdelegators.ListDelegator[widgets.QWidget]:
                                                                                                                                                                                                                                                                                                                  match index:
                                                                                                                                                                                                                                                                                                                      case int():
                                                                                                                                                                                                                                                                                                                          if index >= self.count():
                                                                                                                                                                                                                                                                                                                              raise IndexError(index)
                                                                                                                                                                                                                                                                                                                          w = self.widget(index)
                                                                                                                                                                                                                                                                                                                          assert w is not None
                                                                                                                                                                                                                                                                                                                          return w
                                                                                                                                                                                                                                                                                                                      case slice():
                                                                                                                                                                                                                                                                                                                          rng = range(*index.indices(self.count()))
                                                                                                                                                                                                                                                                                                                          return listdelegators.ListDelegator(self.widget(i) for i in rng)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise TypeError(index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __delitem__(self, item: int | widgets.QWidget):
                                                                                                                                                                                                                                                                                                                  i = self.widget(item) if isinstance(item, int) else item
                                                                                                                                                                                                                                                                                                                  if i is None:
                                                                                                                                                                                                                                                                                                                      raise IndexError(item)
                                                                                                                                                                                                                                                                                                                  self.removeWidget(i)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __len__(self):
                                                                                                                                                                                                                                                                                                                  # needed for PySide6
                                                                                                                                                                                                                                                                                                                  return self.count()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __contains__(self, item: widgets.QWidget):
                                                                                                                                                                                                                                                                                                                  return self.indexOf(item) >= 0
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_current_widget(self, widget: widgets.QWidget | int):
                                                                                                                                                                                                                                                                                                                  if isinstance(widget, widgets.QWidget):
                                                                                                                                                                                                                                                                                                                      self.setCurrentWidget(widget)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      w = self[widget]
                                                                                                                                                                                                                                                                                                                      self.setCurrentWidget(w)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          StatusBar

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QStatusBar

                                                                                                                                                                                                                                                                                                          Horizontal bar suitable for presenting status information.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/statusbar.py
                                                                                                                                                                                                                                                                                                          class StatusBar(widgets.WidgetMixin, widgets.QStatusBar):
                                                                                                                                                                                                                                                                                                              """Horizontal bar suitable for presenting status information."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __add__(self, other: QtGui.QAction | widgets.QWidget) -> StatusBar:
                                                                                                                                                                                                                                                                                                                  match other:
                                                                                                                                                                                                                                                                                                                      case QtGui.QAction():
                                                                                                                                                                                                                                                                                                                          self.addAction(other)
                                                                                                                                                                                                                                                                                                                          return self
                                                                                                                                                                                                                                                                                                                      case widgets.QWidget():
                                                                                                                                                                                                                                                                                                                          self.addWidget(other)
                                                                                                                                                                                                                                                                                                                          return self
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise TypeError(other)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_threadpool_info(self, threadpool: core.ThreadPool):
                                                                                                                                                                                                                                                                                                                  class ThreadPoolLabel(widgets.Label):
                                                                                                                                                                                                                                                                                                                      def update_job_count(self, num_jobs: int):
                                                                                                                                                                                                                                                                                                                          text = f"Running jobs: {num_jobs}" if num_jobs > 0 else "No running jobs"
                                                                                                                                                                                                                                                                                                                          self.set_text(text)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  status_label = ThreadPoolLabel(self)
                                                                                                                                                                                                                                                                                                                  threadpool.job_num_updated.connect(status_label.update_job_count)
                                                                                                                                                                                                                                                                                                                  status_label.update_job_count(threadpool.activeThreadCount())
                                                                                                                                                                                                                                                                                                                  progress_bar = widgets.ProgressBar(self, text_visible=False)
                                                                                                                                                                                                                                                                                                                  progress_bar.hide()
                                                                                                                                                                                                                                                                                                                  progress_bar.setRange(0, 0)
                                                                                                                                                                                                                                                                                                                  progress_bar.setFixedSize(200, 20)
                                                                                                                                                                                                                                                                                                                  threadpool.busy_state_changed.connect(progress_bar.setVisible)
                                                                                                                                                                                                                                                                                                                  self.addPermanentWidget(status_label)
                                                                                                                                                                                                                                                                                                                  self.addPermanentWidget(progress_bar)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_widget(self, widget: widgets.QWidget, permanent: bool = False) -> None:
                                                                                                                                                                                                                                                                                                                  if permanent:
                                                                                                                                                                                                                                                                                                                      self.addPermanentWidget(widget)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.addWidget(widget)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def show_message(self, message: str, timeout: int = 0) -> None:
                                                                                                                                                                                                                                                                                                                  self.showMessage(message, timeout)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Style

                                                                                                                                                                                                                                                                                                          Bases: StyleMixin, QStyle

                                                                                                                                                                                                                                                                                                          Abstract base class that encapsulates the look and feel of a GUI.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/style.py
                                                                                                                                                                                                                                                                                                          class Style(StyleMixin, widgets.QStyle):
                                                                                                                                                                                                                                                                                                              """Abstract base class that encapsulates the look and feel of a GUI."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          StyleOptionHeaderV2

                                                                                                                                                                                                                                                                                                          Bases: StyleOptionHeaderMixin, QStyleOptionHeaderV2

                                                                                                                                                                                                                                                                                                          Describes the parameters for drawing a header (v2).

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/styleoptionheaderv2.py
                                                                                                                                                                                                                                                                                                          4
                                                                                                                                                                                                                                                                                                          5
                                                                                                                                                                                                                                                                                                          6
                                                                                                                                                                                                                                                                                                          7
                                                                                                                                                                                                                                                                                                          8
                                                                                                                                                                                                                                                                                                          9
                                                                                                                                                                                                                                                                                                          class StyleOptionHeaderV2(widgets.StyleOptionHeaderMixin, widgets.QStyleOptionHeaderV2):
                                                                                                                                                                                                                                                                                                              """Describes the parameters for drawing a header (v2)."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_text_elide_mode(self) -> constants.TextElideModeStr:
                                                                                                                                                                                                                                                                                                                  """Return text elide mode."""
                                                                                                                                                                                                                                                                                                                  return constants.TEXT_ELIDE_MODE.inverse[self.textElideMode]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_text_elide_mode() -> constants.TextElideModeStr

                                                                                                                                                                                                                                                                                                          Return text elide mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/styleoptionheaderv2.py
                                                                                                                                                                                                                                                                                                          7
                                                                                                                                                                                                                                                                                                          8
                                                                                                                                                                                                                                                                                                          9
                                                                                                                                                                                                                                                                                                          def get_text_elide_mode(self) -> constants.TextElideModeStr:
                                                                                                                                                                                                                                                                                                              """Return text elide mode."""
                                                                                                                                                                                                                                                                                                              return constants.TEXT_ELIDE_MODE.inverse[self.textElideMode]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          StyleOptionMenuItemV2

                                                                                                                                                                                                                                                                                                          Bases: StyleOptionMenuItemMixin, QStyleOptionMenuItemV2

                                                                                                                                                                                                                                                                                                          Describes the parameters for drawing a menu item (v2).

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/styleoptionmenuitemv2.py
                                                                                                                                                                                                                                                                                                          4
                                                                                                                                                                                                                                                                                                          5
                                                                                                                                                                                                                                                                                                          6
                                                                                                                                                                                                                                                                                                          7
                                                                                                                                                                                                                                                                                                          class StyleOptionMenuItemV2(
                                                                                                                                                                                                                                                                                                              widgets.StyleOptionMenuItemMixin, widgets.QStyleOptionMenuItemV2
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Describes the parameters for drawing a menu item (v2)."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          StyleOptionSlider

                                                                                                                                                                                                                                                                                                          Bases: StyleOptionComplexMixin, QStyleOptionSlider

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/styleoptionslider.py
                                                                                                                                                                                                                                                                                                          class StyleOptionSlider(widgets.StyleOptionComplexMixin, widgets.QStyleOptionSlider):
                                                                                                                                                                                                                                                                                                              def is_horizontal(self) -> bool:
                                                                                                                                                                                                                                                                                                                  """Check if silder is horizontal.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      True if horizontal, else False
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return self.orientation == constants.HORIZONTAL
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def is_vertical(self) -> bool:
                                                                                                                                                                                                                                                                                                                  """Check if silder is vertical.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      True if vertical, else False
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return self.orientation == constants.VERTICAL
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_horizontal(self) -> None:
                                                                                                                                                                                                                                                                                                                  """Set slider orientation to horizontal."""
                                                                                                                                                                                                                                                                                                                  self.orientation = constants.HORIZONTAL
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_vertical(self) -> None:
                                                                                                                                                                                                                                                                                                                  """Set slider orientation to vertical."""
                                                                                                                                                                                                                                                                                                                  self.orientation = constants.VERTICAL
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_orientation(self) -> Literal["horizontal", "vertical"]:
                                                                                                                                                                                                                                                                                                                  return "horizontal" if self.is_horizontal() else "vertical"
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          is_horizontal() -> bool

                                                                                                                                                                                                                                                                                                          Check if silder is horizontal.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/styleoptionslider.py
                                                                                                                                                                                                                                                                                                          def is_horizontal(self) -> bool:
                                                                                                                                                                                                                                                                                                              """Check if silder is horizontal.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  True if horizontal, else False
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return self.orientation == constants.HORIZONTAL
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          is_vertical() -> bool

                                                                                                                                                                                                                                                                                                          Check if silder is vertical.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/styleoptionslider.py
                                                                                                                                                                                                                                                                                                          def is_vertical(self) -> bool:
                                                                                                                                                                                                                                                                                                              """Check if silder is vertical.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  True if vertical, else False
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return self.orientation == constants.VERTICAL
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_horizontal() -> None

                                                                                                                                                                                                                                                                                                          Set slider orientation to horizontal.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/styleoptionslider.py
                                                                                                                                                                                                                                                                                                          def set_horizontal(self) -> None:
                                                                                                                                                                                                                                                                                                              """Set slider orientation to horizontal."""
                                                                                                                                                                                                                                                                                                              self.orientation = constants.HORIZONTAL
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_vertical() -> None

                                                                                                                                                                                                                                                                                                          Set slider orientation to vertical.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/styleoptionslider.py
                                                                                                                                                                                                                                                                                                          def set_vertical(self) -> None:
                                                                                                                                                                                                                                                                                                              """Set slider orientation to vertical."""
                                                                                                                                                                                                                                                                                                              self.orientation = constants.VERTICAL
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          StylePainter

                                                                                                                                                                                                                                                                                                          Bases: PainterMixin, QStylePainter

                                                                                                                                                                                                                                                                                                          Convenience class for drawing QStyle elements inside a widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/stylepainter.py
                                                                                                                                                                                                                                                                                                          class StylePainter(gui.PainterMixin, widgets.QStylePainter):
                                                                                                                                                                                                                                                                                                              """Convenience class for drawing QStyle elements inside a widget."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def draw_complex_control(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  control: widgets.style.ComplexControlStr,
                                                                                                                                                                                                                                                                                                                  option: widgets.QStyleOptionComplex,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  self.drawComplexControl(widgets.style.COMPLEX_CONTROL[control], option)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          SystemTrayIcon

                                                                                                                                                                                                                                                                                                          Bases: ObjectMixin, QSystemTrayIcon

                                                                                                                                                                                                                                                                                                          Icon for an application in the system tray.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/systemtrayicon.py
                                                                                                                                                                                                                                                                                                          class SystemTrayIcon(core.ObjectMixin, QtWidgets.QSystemTrayIcon):
                                                                                                                                                                                                                                                                                                              """Icon for an application in the system tray."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_icon(self, icon: datatypes.IconType):
                                                                                                                                                                                                                                                                                                                  """Set the system tray icon.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      icon: icon to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  icon = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                                  self.setIcon(icon)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def show_message(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  title: str,
                                                                                                                                                                                                                                                                                                                  message: str = "",
                                                                                                                                                                                                                                                                                                                  icon: datatypes.IconType = None,
                                                                                                                                                                                                                                                                                                                  timeout: int = 10,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  if icon is None:
                                                                                                                                                                                                                                                                                                                      ico = gui.Icon()
                                                                                                                                                                                                                                                                                                                  if icon in MESSAGE_ICONS:
                                                                                                                                                                                                                                                                                                                      ico = MESSAGE_ICONS[icon]
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      ico = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                                  self.showMessage(title, message, ico, timeout * 1000)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_icon(icon: datatypes.IconType)

                                                                                                                                                                                                                                                                                                          Set the system tray icon.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          icon IconType

                                                                                                                                                                                                                                                                                                          icon to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/systemtrayicon.py
                                                                                                                                                                                                                                                                                                          def set_icon(self, icon: datatypes.IconType):
                                                                                                                                                                                                                                                                                                              """Set the system tray icon.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  icon: icon to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              icon = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                              self.setIcon(icon)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          TabBar

                                                                                                                                                                                                                                                                                                          Bases: TabBarMixin, QTabBar

                                                                                                                                                                                                                                                                                                          Tab bar, e.g. for use in tabbed dialogs.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tabbar.py
                                                                                                                                                                                                                                                                                                          class TabBar(TabBarMixin, widgets.QTabBar):
                                                                                                                                                                                                                                                                                                              """Tab bar, e.g. for use in tabbed dialogs."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          TabWidget

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QTabWidget

                                                                                                                                                                                                                                                                                                          Stack of tabbed widgets.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tabwidget.py
                                                                                                                                                                                                                                                                                                          class TabWidget(widgets.WidgetMixin, widgets.QTabWidget):
                                                                                                                                                                                                                                                                                                              """Stack of tabbed widgets."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(
                                                                                                                                                                                                                                                                                                                  self, closable: bool = False, detachable: bool = False, **kwargs
                                                                                                                                                                                                                                                                                                              ) -> None:
                                                                                                                                                                                                                                                                                                                  # Basic initalization
                                                                                                                                                                                                                                                                                                                  super().__init__(**kwargs)
                                                                                                                                                                                                                                                                                                                  self.animator = animations.Animator(self)
                                                                                                                                                                                                                                                                                                                  self.tabCloseRequested.connect(self.remove_tab)
                                                                                                                                                                                                                                                                                                                  self.tab_bar = widgets.TabBar(self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  self.setTabBar(self.tab_bar)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  # Used to keep a reference to detached tabs since their QMainWindow
                                                                                                                                                                                                                                                                                                                  # does not have a parent
                                                                                                                                                                                                                                                                                                                  self.detached_tabs: dict[str, DetachedTab] = {}
                                                                                                                                                                                                                                                                                                                  if detachable:
                                                                                                                                                                                                                                                                                                                      self.set_detachable()
                                                                                                                                                                                                                                                                                                                  self.set_closable(closable)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __len__(self) -> int:
                                                                                                                                                                                                                                                                                                                  return self.count()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def __getitem__(self, index: int) -> widgets.QWidget: ...
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def __getitem__(
                                                                                                                                                                                                                                                                                                                  self, index: slice
                                                                                                                                                                                                                                                                                                              ) -> listdelegators.ListDelegator[widgets.QWidget]: ...
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(
                                                                                                                                                                                                                                                                                                                  self, index: int | slice
                                                                                                                                                                                                                                                                                                              ) -> widgets.QWidget | listdelegators.ListDelegator[widgets.QWidget]:
                                                                                                                                                                                                                                                                                                                  match index:
                                                                                                                                                                                                                                                                                                                      case int():
                                                                                                                                                                                                                                                                                                                          if (widget := self.widget(index)) is None:
                                                                                                                                                                                                                                                                                                                              raise IndexError(index)
                                                                                                                                                                                                                                                                                                                          return widget
                                                                                                                                                                                                                                                                                                                      case slice():
                                                                                                                                                                                                                                                                                                                          rng = range(*index.indices(self.count()))
                                                                                                                                                                                                                                                                                                                          return listdelegators.ListDelegator(self.widget(i) for i in rng)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise TypeError(index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __contains__(self, item: widgets.QWidget):
                                                                                                                                                                                                                                                                                                                  return self.indexOf(item) >= 0
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def update_tab_bar_visibility(self):
                                                                                                                                                                                                                                                                                                                  """Update visibility of the tabBar depending of the number of tabs.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  0 or 1 tab -> tabBar hidden, 2+ tabs - >tabBar visible
                                                                                                                                                                                                                                                                                                                  need to be called explicitly, or be connected to tabInserted/tabRemoved
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.tabBar().setVisible(self.count() > 1)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_icon_size(self, size: datatypes.SizeType):
                                                                                                                                                                                                                                                                                                                  """Set size of the icons."""
                                                                                                                                                                                                                                                                                                                  self.setIconSize(datatypes.to_size(size))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_document_mode(self, state: bool = True) -> None:
                                                                                                                                                                                                                                                                                                                  self.setDocumentMode(state)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_tab_shape(self, shape: TabShapeStr | widgets.QTabWidget.TabShape):
                                                                                                                                                                                                                                                                                                                  """Set tab shape for the tabwidget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      shape: tab shape to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setTabShape(TAB_SHAPES.get_enum_value(shape))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_tab_shape(self) -> TabShapeStr:
                                                                                                                                                                                                                                                                                                                  """Return tab shape.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      tab shape
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return TAB_SHAPES.inverse[self.tabShape()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_tab_position(self, position: TabPositionStr | widgets.QTabWidget.TabPosition):
                                                                                                                                                                                                                                                                                                                  """Set tab position for the tabwidget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      position: tab position to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setTabPosition(TAB_POSITION.get_enum_value(position))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_tab_position(self) -> TabPositionStr:
                                                                                                                                                                                                                                                                                                                  """Return tab position.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      tab position
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return TAB_POSITION.inverse[self.tabPosition()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_children(self) -> list[tuple]:
                                                                                                                                                                                                                                                                                                                  return [
                                                                                                                                                                                                                                                                                                                      (
                                                                                                                                                                                                                                                                                                                          self.widget(i),
                                                                                                                                                                                                                                                                                                                          self.tabText(i),
                                                                                                                                                                                                                                                                                                                          self.tab_icon(i),
                                                                                                                                                                                                                                                                                                                          self.tabToolTip(i),
                                                                                                                                                                                                                                                                                                                          self.tabWhatsThis(i),
                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                                      for i in range(self.count())
                                                                                                                                                                                                                                                                                                                  ]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def tab_icon(self, i: int) -> gui.Icon | None:
                                                                                                                                                                                                                                                                                                                  icon = self.tabIcon(i)
                                                                                                                                                                                                                                                                                                                  return None if icon.isNull() else gui.Icon(icon)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_detachable(self):
                                                                                                                                                                                                                                                                                                                  self.tab_bar.tab_doubleclicked.connect(self.detach_tab)
                                                                                                                                                                                                                                                                                                                  core.CoreApplication.call_on_exit(self.close_detached_tabs)
                                                                                                                                                                                                                                                                                                                  self.setMovable(True)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_closable(self, closable: bool = True):
                                                                                                                                                                                                                                                                                                                  self.setTabsClosable(closable)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @core.Slot(int, core.QPoint)
                                                                                                                                                                                                                                                                                                              def detach_tab(self, index: int, point: datatypes.PointType):
                                                                                                                                                                                                                                                                                                                  """Detach tab by removing its contents and placing them in a DetachedTab window.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      index (int): index location of the tab to be detached
                                                                                                                                                                                                                                                                                                                      point (core.QPoint): screen pos for creating the new DetachedTab window
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  # Get the tab content
                                                                                                                                                                                                                                                                                                                  name = self.tabText(index)
                                                                                                                                                                                                                                                                                                                  icon = self.tab_icon(index) or self.window().windowIcon()
                                                                                                                                                                                                                                                                                                                  if (widget := self.widget(index)) is None:
                                                                                                                                                                                                                                                                                                                      return
                                                                                                                                                                                                                                                                                                                  widget_rect = widget.frameGeometry()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  # Create a new detached tab window
                                                                                                                                                                                                                                                                                                                  detached_tab = DetachedTab(name, widget)
                                                                                                                                                                                                                                                                                                                  detached_tab.set_modality("none")
                                                                                                                                                                                                                                                                                                                  detached_tab.set_icon(icon)
                                                                                                                                                                                                                                                                                                                  detached_tab.setGeometry(widget_rect)
                                                                                                                                                                                                                                                                                                                  detached_tab.on_close.connect(self.attach_tab)
                                                                                                                                                                                                                                                                                                                  detached_tab.move(datatypes.to_point(point))
                                                                                                                                                                                                                                                                                                                  detached_tab.show()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  # Create a reference to maintain access to the detached tab
                                                                                                                                                                                                                                                                                                                  self.detached_tabs[name] = detached_tab
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add(self, widget: widgets.QWidget | widgets.QLayout):
                                                                                                                                                                                                                                                                                                                  """Add widget / layout to TabWidget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Tab label is chosen based on following order:
                                                                                                                                                                                                                                                                                                                  windowTitle -> objectName -> className
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  label = (widget.windowTitle() if isinstance(widget, widgets.QWidget) else "") or (
                                                                                                                                                                                                                                                                                                                      widget.objectName() or type(widget).__name__
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  self.add_tab(widget, label)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_tab(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  item: widgets.QWidget | widgets.QLayout,
                                                                                                                                                                                                                                                                                                                  label: str,
                                                                                                                                                                                                                                                                                                                  icon: datatypes.IconType = None,
                                                                                                                                                                                                                                                                                                                  position: int | None = None,
                                                                                                                                                                                                                                                                                                                  show: bool = False,
                                                                                                                                                                                                                                                                                                              ) -> int:
                                                                                                                                                                                                                                                                                                                  if isinstance(item, widgets.QLayout):
                                                                                                                                                                                                                                                                                                                      widget = widgets.Widget()
                                                                                                                                                                                                                                                                                                                      widget.set_layout(item)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      widget = item
                                                                                                                                                                                                                                                                                                                  if position is None:
                                                                                                                                                                                                                                                                                                                      position = len(self)
                                                                                                                                                                                                                                                                                                                  if not icon:
                                                                                                                                                                                                                                                                                                                      index = self.insertTab(position, widget, label)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      icon = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                                      index = self.insertTab(position, widget, icon, label)
                                                                                                                                                                                                                                                                                                                  if show:
                                                                                                                                                                                                                                                                                                                      self.setCurrentIndex(index)
                                                                                                                                                                                                                                                                                                                  return index
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def attach_tab(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  widget: widgets.QWidget | widgets.QLayout,
                                                                                                                                                                                                                                                                                                                  name: str,
                                                                                                                                                                                                                                                                                                                  icon: datatypes.IconType = None,
                                                                                                                                                                                                                                                                                                                  insert_at: int | None = None,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Re-attach tab.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Re-attach the tab by removing the content from the DetachedTab window,
                                                                                                                                                                                                                                                                                                                  closing it, and placing the content back into the DetachableTabWidget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      widget (Union[widgets.QWidget, widgets.QLayout]): the content widget
                                                                                                                                                                                                                                                                                                                          from the DetachedTab window
                                                                                                                                                                                                                                                                                                                      name (str): the name of the detached tab
                                                                                                                                                                                                                                                                                                                      icon (datatypes.IconType, optional): the window icon for the detached tab
                                                                                                                                                                                                                                                                                                                      insert_at (Optional[int], optional): insert the re-attached tab at the
                                                                                                                                                                                                                                                                                                                          given index
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  widget.setParent(self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  # Remove the reference
                                                                                                                                                                                                                                                                                                                  del self.detached_tabs[name]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  # Determine if the given image and the main window icon are the same.
                                                                                                                                                                                                                                                                                                                  # If they are, then do not add the icon to the tab
                                                                                                                                                                                                                                                                                                                  self.add_tab(widget, name, icon=icon, position=insert_at, show=True)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def close_detached_tabs(self):
                                                                                                                                                                                                                                                                                                                  """Close all tabs that are currently detached."""
                                                                                                                                                                                                                                                                                                                  tabs = list(self.detached_tabs.values())
                                                                                                                                                                                                                                                                                                                  for tab in tabs:
                                                                                                                                                                                                                                                                                                                      tab.close()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @core.Slot(int)
                                                                                                                                                                                                                                                                                                              def remove_tab(self, index_or_widget: int | widgets.QWidget):
                                                                                                                                                                                                                                                                                                                  index = (
                                                                                                                                                                                                                                                                                                                      self.indexOf(index_or_widget)
                                                                                                                                                                                                                                                                                                                      if isinstance(index_or_widget, widgets.QWidget)
                                                                                                                                                                                                                                                                                                                      else index_or_widget
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  widget = (
                                                                                                                                                                                                                                                                                                                      self.widget(index_or_widget)
                                                                                                                                                                                                                                                                                                                      if isinstance(index_or_widget, int)
                                                                                                                                                                                                                                                                                                                      else index_or_widget
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  self.removeTab(index)
                                                                                                                                                                                                                                                                                                                  if widget is not None:
                                                                                                                                                                                                                                                                                                                      widget.deleteLater()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @core.Slot(widgets.QWidget, str)
                                                                                                                                                                                                                                                                                                              def open_widget(self, widget: widgets.QWidget, title: str = "Unnamed"):
                                                                                                                                                                                                                                                                                                                  """Create a tab containing delivered widget."""
                                                                                                                                                                                                                                                                                                                  self.add_tab(widget, title, icon="mdi.widgets", show=True)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_tab(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  index: int,
                                                                                                                                                                                                                                                                                                                  position: widgets.tabbar.PositionStr,
                                                                                                                                                                                                                                                                                                                  widget: widgets.QWidget | None = None,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  # prettyqt installs its own TabBar
                                                                                                                                                                                                                                                                                                                  cast("widgets.TabBar", self.tabBar()).set_tab(index, position, widget)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def create_tab_preview(self, index: int, width: int = 200) -> widgets.Label:
                                                                                                                                                                                                                                                                                                                  widget = widgets.Label(self)
                                                                                                                                                                                                                                                                                                                  widget.setScaledContents(True)
                                                                                                                                                                                                                                                                                                                  if (tab := self.widget(index)) is None:
                                                                                                                                                                                                                                                                                                                      raise IndexError(index)
                                                                                                                                                                                                                                                                                                                  px = tab.grab().scaledToWidth(width)
                                                                                                                                                                                                                                                                                                                  widget.setPixmap(px)
                                                                                                                                                                                                                                                                                                                  widget.resize(width, width)
                                                                                                                                                                                                                                                                                                                  return widget
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          add(widget: widgets.QWidget | widgets.QLayout)

                                                                                                                                                                                                                                                                                                          Add widget / layout to TabWidget.

                                                                                                                                                                                                                                                                                                          Tab label is chosen based on following order: windowTitle -> objectName -> className

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tabwidget.py
                                                                                                                                                                                                                                                                                                          def add(self, widget: widgets.QWidget | widgets.QLayout):
                                                                                                                                                                                                                                                                                                              """Add widget / layout to TabWidget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Tab label is chosen based on following order:
                                                                                                                                                                                                                                                                                                              windowTitle -> objectName -> className
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              label = (widget.windowTitle() if isinstance(widget, widgets.QWidget) else "") or (
                                                                                                                                                                                                                                                                                                                  widget.objectName() or type(widget).__name__
                                                                                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                                                                                              self.add_tab(widget, label)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          attach_tab(widget: widgets.QWidget | widgets.QLayout, name: str, icon: datatypes.IconType = None, insert_at: int | None = None)

                                                                                                                                                                                                                                                                                                          Re-attach tab.

                                                                                                                                                                                                                                                                                                          Re-attach the tab by removing the content from the DetachedTab window, closing it, and placing the content back into the DetachableTabWidget.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          widget Union[QWidget, QLayout]

                                                                                                                                                                                                                                                                                                          the content widget from the DetachedTab window

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          name str

                                                                                                                                                                                                                                                                                                          the name of the detached tab

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          icon IconType

                                                                                                                                                                                                                                                                                                          the window icon for the detached tab

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          insert_at Optional[int]

                                                                                                                                                                                                                                                                                                          insert the re-attached tab at the given index

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tabwidget.py
                                                                                                                                                                                                                                                                                                          def attach_tab(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              widget: widgets.QWidget | widgets.QLayout,
                                                                                                                                                                                                                                                                                                              name: str,
                                                                                                                                                                                                                                                                                                              icon: datatypes.IconType = None,
                                                                                                                                                                                                                                                                                                              insert_at: int | None = None,
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Re-attach tab.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Re-attach the tab by removing the content from the DetachedTab window,
                                                                                                                                                                                                                                                                                                              closing it, and placing the content back into the DetachableTabWidget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  widget (Union[widgets.QWidget, widgets.QLayout]): the content widget
                                                                                                                                                                                                                                                                                                                      from the DetachedTab window
                                                                                                                                                                                                                                                                                                                  name (str): the name of the detached tab
                                                                                                                                                                                                                                                                                                                  icon (datatypes.IconType, optional): the window icon for the detached tab
                                                                                                                                                                                                                                                                                                                  insert_at (Optional[int], optional): insert the re-attached tab at the
                                                                                                                                                                                                                                                                                                                      given index
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              widget.setParent(self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # Remove the reference
                                                                                                                                                                                                                                                                                                              del self.detached_tabs[name]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # Determine if the given image and the main window icon are the same.
                                                                                                                                                                                                                                                                                                              # If they are, then do not add the icon to the tab
                                                                                                                                                                                                                                                                                                              self.add_tab(widget, name, icon=icon, position=insert_at, show=True)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          close_detached_tabs()

                                                                                                                                                                                                                                                                                                          Close all tabs that are currently detached.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tabwidget.py
                                                                                                                                                                                                                                                                                                          def close_detached_tabs(self):
                                                                                                                                                                                                                                                                                                              """Close all tabs that are currently detached."""
                                                                                                                                                                                                                                                                                                              tabs = list(self.detached_tabs.values())
                                                                                                                                                                                                                                                                                                              for tab in tabs:
                                                                                                                                                                                                                                                                                                                  tab.close()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          detach_tab(index: int, point: datatypes.PointType)

                                                                                                                                                                                                                                                                                                          Detach tab by removing its contents and placing them in a DetachedTab window.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          index int

                                                                                                                                                                                                                                                                                                          index location of the tab to be detached

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          point QPoint

                                                                                                                                                                                                                                                                                                          screen pos for creating the new DetachedTab window

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tabwidget.py
                                                                                                                                                                                                                                                                                                          @core.Slot(int, core.QPoint)
                                                                                                                                                                                                                                                                                                          def detach_tab(self, index: int, point: datatypes.PointType):
                                                                                                                                                                                                                                                                                                              """Detach tab by removing its contents and placing them in a DetachedTab window.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  index (int): index location of the tab to be detached
                                                                                                                                                                                                                                                                                                                  point (core.QPoint): screen pos for creating the new DetachedTab window
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              # Get the tab content
                                                                                                                                                                                                                                                                                                              name = self.tabText(index)
                                                                                                                                                                                                                                                                                                              icon = self.tab_icon(index) or self.window().windowIcon()
                                                                                                                                                                                                                                                                                                              if (widget := self.widget(index)) is None:
                                                                                                                                                                                                                                                                                                                  return
                                                                                                                                                                                                                                                                                                              widget_rect = widget.frameGeometry()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # Create a new detached tab window
                                                                                                                                                                                                                                                                                                              detached_tab = DetachedTab(name, widget)
                                                                                                                                                                                                                                                                                                              detached_tab.set_modality("none")
                                                                                                                                                                                                                                                                                                              detached_tab.set_icon(icon)
                                                                                                                                                                                                                                                                                                              detached_tab.setGeometry(widget_rect)
                                                                                                                                                                                                                                                                                                              detached_tab.on_close.connect(self.attach_tab)
                                                                                                                                                                                                                                                                                                              detached_tab.move(datatypes.to_point(point))
                                                                                                                                                                                                                                                                                                              detached_tab.show()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # Create a reference to maintain access to the detached tab
                                                                                                                                                                                                                                                                                                              self.detached_tabs[name] = detached_tab
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_tab_position() -> TabPositionStr

                                                                                                                                                                                                                                                                                                          Return tab position.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tabwidget.py
                                                                                                                                                                                                                                                                                                          def get_tab_position(self) -> TabPositionStr:
                                                                                                                                                                                                                                                                                                              """Return tab position.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  tab position
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return TAB_POSITION.inverse[self.tabPosition()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_tab_shape() -> TabShapeStr

                                                                                                                                                                                                                                                                                                          Return tab shape.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tabwidget.py
                                                                                                                                                                                                                                                                                                          def get_tab_shape(self) -> TabShapeStr:
                                                                                                                                                                                                                                                                                                              """Return tab shape.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  tab shape
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return TAB_SHAPES.inverse[self.tabShape()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          open_widget(widget: widgets.QWidget, title: str = 'Unnamed')

                                                                                                                                                                                                                                                                                                          Create a tab containing delivered widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tabwidget.py
                                                                                                                                                                                                                                                                                                          @core.Slot(widgets.QWidget, str)
                                                                                                                                                                                                                                                                                                          def open_widget(self, widget: widgets.QWidget, title: str = "Unnamed"):
                                                                                                                                                                                                                                                                                                              """Create a tab containing delivered widget."""
                                                                                                                                                                                                                                                                                                              self.add_tab(widget, title, icon="mdi.widgets", show=True)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_icon_size(size: datatypes.SizeType)

                                                                                                                                                                                                                                                                                                          Set size of the icons.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tabwidget.py
                                                                                                                                                                                                                                                                                                          def set_icon_size(self, size: datatypes.SizeType):
                                                                                                                                                                                                                                                                                                              """Set size of the icons."""
                                                                                                                                                                                                                                                                                                              self.setIconSize(datatypes.to_size(size))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_tab_position(position: TabPositionStr | widgets.QTabWidget.TabPosition)

                                                                                                                                                                                                                                                                                                          Set tab position for the tabwidget.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          position TabPositionStr | TabPosition

                                                                                                                                                                                                                                                                                                          tab position to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tabwidget.py
                                                                                                                                                                                                                                                                                                          def set_tab_position(self, position: TabPositionStr | widgets.QTabWidget.TabPosition):
                                                                                                                                                                                                                                                                                                              """Set tab position for the tabwidget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  position: tab position to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setTabPosition(TAB_POSITION.get_enum_value(position))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_tab_shape(shape: TabShapeStr | widgets.QTabWidget.TabShape)

                                                                                                                                                                                                                                                                                                          Set tab shape for the tabwidget.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          shape TabShapeStr | TabShape

                                                                                                                                                                                                                                                                                                          tab shape to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tabwidget.py
                                                                                                                                                                                                                                                                                                          def set_tab_shape(self, shape: TabShapeStr | widgets.QTabWidget.TabShape):
                                                                                                                                                                                                                                                                                                              """Set tab shape for the tabwidget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  shape: tab shape to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setTabShape(TAB_SHAPES.get_enum_value(shape))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          update_tab_bar_visibility()

                                                                                                                                                                                                                                                                                                          Update visibility of the tabBar depending of the number of tabs.

                                                                                                                                                                                                                                                                                                          0 or 1 tab -> tabBar hidden, 2+ tabs - >tabBar visible need to be called explicitly, or be connected to tabInserted/tabRemoved

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tabwidget.py
                                                                                                                                                                                                                                                                                                          def update_tab_bar_visibility(self):
                                                                                                                                                                                                                                                                                                              """Update visibility of the tabBar depending of the number of tabs.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              0 or 1 tab -> tabBar hidden, 2+ tabs - >tabBar visible
                                                                                                                                                                                                                                                                                                              need to be called explicitly, or be connected to tabInserted/tabRemoved
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.tabBar().setVisible(self.count() > 1)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          TableView

                                                                                                                                                                                                                                                                                                          Bases: TableViewMixin, QTableView

                                                                                                                                                                                                                                                                                                          Default model/view implementation of a table view.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tableview.py
                                                                                                                                                                                                                                                                                                          class TableView(TableViewMixin, widgets.QTableView):
                                                                                                                                                                                                                                                                                                              """Default model/view implementation of a table view."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          TableViewMixin

                                                                                                                                                                                                                                                                                                          Bases: AbstractItemViewMixin, _TableViewBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tableview.py
                                                                                                                                                                                                                                                                                                          class TableViewMixin(widgets.AbstractItemViewMixin, _TableViewBase):
                                                                                                                                                                                                                                                                                                              def __init__(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  *args,
                                                                                                                                                                                                                                                                                                                  alternating_row_colors: bool = True,
                                                                                                                                                                                                                                                                                                                  word_wrap: bool = False,
                                                                                                                                                                                                                                                                                                                  **kwargs,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  if "object_name" not in kwargs and "objectName" not in kwargs:
                                                                                                                                                                                                                                                                                                                      kwargs["object_name"] = type(self).__name__
                                                                                                                                                                                                                                                                                                                  super().__init__(
                                                                                                                                                                                                                                                                                                                      *args,
                                                                                                                                                                                                                                                                                                                      alternating_row_colors=alternating_row_colors,
                                                                                                                                                                                                                                                                                                                      word_wrap=word_wrap,
                                                                                                                                                                                                                                                                                                                      **kwargs,
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  self.setHorizontalHeader(widgets.HeaderView("horizontal", parent=self))
                                                                                                                                                                                                                                                                                                                  self.setVerticalHeader(widgets.HeaderView("vertical", parent=self))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {"gridStyle": constants.PEN_STYLE}
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @property
                                                                                                                                                                                                                                                                                                              def h_header(self) -> widgets.HeaderView:
                                                                                                                                                                                                                                                                                                                  # prettyqt installs its own HeaderViews on construction
                                                                                                                                                                                                                                                                                                                  return cast("widgets.HeaderView", self.horizontalHeader())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @h_header.setter
                                                                                                                                                                                                                                                                                                              def h_header(self, header: widgets.QHeaderView):
                                                                                                                                                                                                                                                                                                                  self.setHorizontalHeader(header)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @property
                                                                                                                                                                                                                                                                                                              def v_header(self) -> widgets.HeaderView:
                                                                                                                                                                                                                                                                                                                  return cast("widgets.HeaderView", self.verticalHeader())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @v_header.setter
                                                                                                                                                                                                                                                                                                              def v_header(self, header: widgets.QHeaderView):
                                                                                                                                                                                                                                                                                                                  self.setVerticalHeader(header)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def is_cell_visible(self, row: int, column: int) -> bool:
                                                                                                                                                                                                                                                                                                                  is_in_horizontal = self.h_header.is_in_visual_range(column)
                                                                                                                                                                                                                                                                                                                  is_in_vertical = self.v_header.is_in_visual_range(row)
                                                                                                                                                                                                                                                                                                                  return is_in_horizontal and is_in_vertical
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_sorting_enabled(self, enabled: bool, do_sort: bool = False):
                                                                                                                                                                                                                                                                                                                  """Hack to avoid direct sort when setting sorting enabled."""
                                                                                                                                                                                                                                                                                                                  model = self.model()
                                                                                                                                                                                                                                                                                                                  if not do_sort and model is not None:
                                                                                                                                                                                                                                                                                                                      backup = model.sort
                                                                                                                                                                                                                                                                                                                      model.sort = lambda x, y: None  # ty: ignore[invalid-assignment]
                                                                                                                                                                                                                                                                                                                  self.setSortingEnabled(enabled)
                                                                                                                                                                                                                                                                                                                  if not do_sort and model is not None:
                                                                                                                                                                                                                                                                                                                      model.sort = backup
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def setup_list_style(self):
                                                                                                                                                                                                                                                                                                                  self.set_selection_behavior("rows")
                                                                                                                                                                                                                                                                                                                  self.h_header.setStretchLastSection(True)
                                                                                                                                                                                                                                                                                                                  self.v_header.set_resize_mode("fixed")
                                                                                                                                                                                                                                                                                                                  self.v_header.set_default_section_size(28)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def adapt_sizes(self):
                                                                                                                                                                                                                                                                                                                  model = self.model()
                                                                                                                                                                                                                                                                                                                  if model is not None and (model.rowCount() * model.columnCount()) < 1000:  # noqa: PLR2004
                                                                                                                                                                                                                                                                                                                      self.resizeColumnsToContents()
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.h_header.resize_sections("interactive")
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def sort_by_column(self, column: int | None, ascending: bool = True):
                                                                                                                                                                                                                                                                                                                  column = -1 if column is None else column
                                                                                                                                                                                                                                                                                                                  order = constants.ASCENDING if ascending else constants.DESCENDING
                                                                                                                                                                                                                                                                                                                  self.sortByColumn(column, order)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_grid_style(self, style: constants.PenStyleStr | constants.PenStyle):
                                                                                                                                                                                                                                                                                                                  """Set grid style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      style: grid style to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setGridStyle(constants.PEN_STYLE.get_enum_value(style))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_grid_style(self) -> constants.PenStyleStr:
                                                                                                                                                                                                                                                                                                                  """Return grid style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      grid style
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.PEN_STYLE.inverse[self.gridStyle()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_visible_section_span(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  orientation: constants.OrientationStr | constants.Orientation,
                                                                                                                                                                                                                                                                                                                  margin: int = 0,
                                                                                                                                                                                                                                                                                                              ) -> tuple[int, int]:
                                                                                                                                                                                                                                                                                                                  """Get a tuple containing the visible start/end indexes.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  if there are no items visible, return -1, -1
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  rect = self.viewport().rect()
                                                                                                                                                                                                                                                                                                                  if orientation in ["horizontal", constants.HORIZONTAL]:
                                                                                                                                                                                                                                                                                                                      start = self.columnAt(rect.left())
                                                                                                                                                                                                                                                                                                                      count = self.model().columnCount()
                                                                                                                                                                                                                                                                                                                      end = self.columnAt(rect.right())
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      start = self.rowAt(rect.top())
                                                                                                                                                                                                                                                                                                                      count = self.model().rowCount()
                                                                                                                                                                                                                                                                                                                      end = self.rowAt(rect.bottom())
                                                                                                                                                                                                                                                                                                                  if count == 0:
                                                                                                                                                                                                                                                                                                                      return (-1, -1)
                                                                                                                                                                                                                                                                                                                  start = max(0, start - margin)
                                                                                                                                                                                                                                                                                                                  end = count if end == -1 else min(end + margin, count)
                                                                                                                                                                                                                                                                                                                  return (start, end)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def resizeColumnsToContents(self, max_columns: int | None = 500):
                                                                                                                                                                                                                                                                                                                  if (model := self.model()) is None:
                                                                                                                                                                                                                                                                                                                      return
                                                                                                                                                                                                                                                                                                                  colcount = model.columnCount()
                                                                                                                                                                                                                                                                                                                  if max_columns is None:
                                                                                                                                                                                                                                                                                                                      super().resizeColumnsToContents()
                                                                                                                                                                                                                                                                                                                      return
                                                                                                                                                                                                                                                                                                                  to_check = min(colcount, max_columns)
                                                                                                                                                                                                                                                                                                                  for i in range(to_check):
                                                                                                                                                                                                                                                                                                                      self.resizeColumnToContents(i)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def resize_visible_columns_to_contents(self, margin: int = 0):
                                                                                                                                                                                                                                                                                                                  if not self.isVisible():
                                                                                                                                                                                                                                                                                                                      logger.warning("trying resize_visible_columns_to_contents while not visible.")
                                                                                                                                                                                                                                                                                                                  colcount = self.model().columnCount()
                                                                                                                                                                                                                                                                                                                  autosized_cols = set()
                                                                                                                                                                                                                                                                                                                  col, end = self.get_visible_section_span("horizontal", margin=margin)
                                                                                                                                                                                                                                                                                                                  width = self.viewport().width()
                                                                                                                                                                                                                                                                                                                  while col <= end:
                                                                                                                                                                                                                                                                                                                      if col not in autosized_cols:
                                                                                                                                                                                                                                                                                                                          autosized_cols.add(col)
                                                                                                                                                                                                                                                                                                                          self.resizeColumnToContents(col)
                                                                                                                                                                                                                                                                                                                      col += 1
                                                                                                                                                                                                                                                                                                                      #  end may change during resize
                                                                                                                                                                                                                                                                                                                      end = self.columnAt(width)
                                                                                                                                                                                                                                                                                                                      end = colcount if end == -1 else end
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def auto_span(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  orientation: constants.OrientationStr
                                                                                                                                                                                                                                                                                                                  | constants.Orientation = constants.HORIZONTAL,
                                                                                                                                                                                                                                                                                                                  role=constants.DISPLAY_ROLE,
                                                                                                                                                                                                                                                                                                                  start: tuple[int, int] = (0, 0),
                                                                                                                                                                                                                                                                                                                  end: tuple[int, int] | None = None,
                                                                                                                                                                                                                                                                                                              ) -> list[tuple[int, int, int, int]]:
                                                                                                                                                                                                                                                                                                                  """Set spans in given direction based on same content in given role."""
                                                                                                                                                                                                                                                                                                                  is_horizontal = orientation in [constants.HORIZONTAL, "horizontal"]
                                                                                                                                                                                                                                                                                                                  model = self.model()
                                                                                                                                                                                                                                                                                                                  spans = []
                                                                                                                                                                                                                                                                                                                  # figure out the ranges
                                                                                                                                                                                                                                                                                                                  if is_horizontal:
                                                                                                                                                                                                                                                                                                                      start_level = max(0, start[0])
                                                                                                                                                                                                                                                                                                                      start_section = max(0, start[1])
                                                                                                                                                                                                                                                                                                                      end_level = model.rowCount()
                                                                                                                                                                                                                                                                                                                      end_section = model.columnCount()
                                                                                                                                                                                                                                                                                                                      if end:
                                                                                                                                                                                                                                                                                                                          end_level = min(max(0, end[0]), end_level)
                                                                                                                                                                                                                                                                                                                          end_section = min(max(0, end[1]), end_section)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      start_level = max(0, start[1])
                                                                                                                                                                                                                                                                                                                      start_section = max(0, start[0])
                                                                                                                                                                                                                                                                                                                      end_level = model.columnCount()
                                                                                                                                                                                                                                                                                                                      end_section = model.rowCount()
                                                                                                                                                                                                                                                                                                                      if end:
                                                                                                                                                                                                                                                                                                                          end_level = min(max(0, end[1]), end_level)
                                                                                                                                                                                                                                                                                                                          end_section = min(max(0, end[0]), end_section)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  # adjust the spans.
                                                                                                                                                                                                                                                                                                                  for level in range(start_level, end_level):
                                                                                                                                                                                                                                                                                                                      match_start = None
                                                                                                                                                                                                                                                                                                                      if is_horizontal:
                                                                                                                                                                                                                                                                                                                          arr = [
                                                                                                                                                                                                                                                                                                                              model.index(level, i).data(role)
                                                                                                                                                                                                                                                                                                                              for i in range(start_section, end_section + 1)
                                                                                                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                                                                                                          typ = type(self).__name__
                                                                                                                                                                                                                                                                                                                          logger.debug("%s: spanning horizontal %s", typ, arr)
                                                                                                                                                                                                                                                                                                                      else:
                                                                                                                                                                                                                                                                                                                          arr = [
                                                                                                                                                                                                                                                                                                                              model.index(i, level).data(role)
                                                                                                                                                                                                                                                                                                                              for i in range(start_section, end_section + 1)
                                                                                                                                                                                                                                                                                                                          ]
                                                                                                                                                                                                                                                                                                                          typ = type(self).__name__
                                                                                                                                                                                                                                                                                                                          logger.debug("%s: spanning vertical %s", typ, arr)
                                                                                                                                                                                                                                                                                                                      for section in range(1, len(arr)):
                                                                                                                                                                                                                                                                                                                          if arr[section] == arr[section - 1]:
                                                                                                                                                                                                                                                                                                                              if match_start is None:
                                                                                                                                                                                                                                                                                                                                  match_start = section - 1
                                                                                                                                                                                                                                                                                                                              # If this is the last cell, need to end it
                                                                                                                                                                                                                                                                                                                              if section == end_section - start_section:
                                                                                                                                                                                                                                                                                                                                  match_end = section
                                                                                                                                                                                                                                                                                                                                  span_size = match_end - match_start + 1
                                                                                                                                                                                                                                                                                                                                  begin = match_start + start_section
                                                                                                                                                                                                                                                                                                                                  if is_horizontal:
                                                                                                                                                                                                                                                                                                                                      self.setSpan(level, begin, 1, span_size)
                                                                                                                                                                                                                                                                                                                                      spans.append((level, begin, 1, span_size))
                                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                                      spans.append((begin, level, span_size, 1))
                                                                                                                                                                                                                                                                                                                                      self.setSpan(begin, level, span_size, 1)
                                                                                                                                                                                                                                                                                                                          elif match_start is not None:
                                                                                                                                                                                                                                                                                                                              match_end = section - 1
                                                                                                                                                                                                                                                                                                                              span_size = match_end - match_start + 1
                                                                                                                                                                                                                                                                                                                              begin = match_start + start_section
                                                                                                                                                                                                                                                                                                                              if is_horizontal:
                                                                                                                                                                                                                                                                                                                                  self.setSpan(level, begin, 1, span_size)
                                                                                                                                                                                                                                                                                                                                  spans.append((level, begin, 1, span_size))
                                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                                  self.setSpan(begin, level, span_size, 1)
                                                                                                                                                                                                                                                                                                                                  spans.append((begin, level, span_size, 1))
                                                                                                                                                                                                                                                                                                                              match_start = None
                                                                                                                                                                                                                                                                                                                  return spans
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          auto_span(orientation: constants.OrientationStr | constants.Orientation = constants.HORIZONTAL, role=constants.DISPLAY_ROLE, start: tuple[int, int] = (0, 0), end: tuple[int, int] | None = None) -> list[tuple[int, int, int, int]]

                                                                                                                                                                                                                                                                                                          Set spans in given direction based on same content in given role.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tableview.py
                                                                                                                                                                                                                                                                                                          def auto_span(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              orientation: constants.OrientationStr
                                                                                                                                                                                                                                                                                                              | constants.Orientation = constants.HORIZONTAL,
                                                                                                                                                                                                                                                                                                              role=constants.DISPLAY_ROLE,
                                                                                                                                                                                                                                                                                                              start: tuple[int, int] = (0, 0),
                                                                                                                                                                                                                                                                                                              end: tuple[int, int] | None = None,
                                                                                                                                                                                                                                                                                                          ) -> list[tuple[int, int, int, int]]:
                                                                                                                                                                                                                                                                                                              """Set spans in given direction based on same content in given role."""
                                                                                                                                                                                                                                                                                                              is_horizontal = orientation in [constants.HORIZONTAL, "horizontal"]
                                                                                                                                                                                                                                                                                                              model = self.model()
                                                                                                                                                                                                                                                                                                              spans = []
                                                                                                                                                                                                                                                                                                              # figure out the ranges
                                                                                                                                                                                                                                                                                                              if is_horizontal:
                                                                                                                                                                                                                                                                                                                  start_level = max(0, start[0])
                                                                                                                                                                                                                                                                                                                  start_section = max(0, start[1])
                                                                                                                                                                                                                                                                                                                  end_level = model.rowCount()
                                                                                                                                                                                                                                                                                                                  end_section = model.columnCount()
                                                                                                                                                                                                                                                                                                                  if end:
                                                                                                                                                                                                                                                                                                                      end_level = min(max(0, end[0]), end_level)
                                                                                                                                                                                                                                                                                                                      end_section = min(max(0, end[1]), end_section)
                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                  start_level = max(0, start[1])
                                                                                                                                                                                                                                                                                                                  start_section = max(0, start[0])
                                                                                                                                                                                                                                                                                                                  end_level = model.columnCount()
                                                                                                                                                                                                                                                                                                                  end_section = model.rowCount()
                                                                                                                                                                                                                                                                                                                  if end:
                                                                                                                                                                                                                                                                                                                      end_level = min(max(0, end[1]), end_level)
                                                                                                                                                                                                                                                                                                                      end_section = min(max(0, end[0]), end_section)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # adjust the spans.
                                                                                                                                                                                                                                                                                                              for level in range(start_level, end_level):
                                                                                                                                                                                                                                                                                                                  match_start = None
                                                                                                                                                                                                                                                                                                                  if is_horizontal:
                                                                                                                                                                                                                                                                                                                      arr = [
                                                                                                                                                                                                                                                                                                                          model.index(level, i).data(role)
                                                                                                                                                                                                                                                                                                                          for i in range(start_section, end_section + 1)
                                                                                                                                                                                                                                                                                                                      ]
                                                                                                                                                                                                                                                                                                                      typ = type(self).__name__
                                                                                                                                                                                                                                                                                                                      logger.debug("%s: spanning horizontal %s", typ, arr)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      arr = [
                                                                                                                                                                                                                                                                                                                          model.index(i, level).data(role)
                                                                                                                                                                                                                                                                                                                          for i in range(start_section, end_section + 1)
                                                                                                                                                                                                                                                                                                                      ]
                                                                                                                                                                                                                                                                                                                      typ = type(self).__name__
                                                                                                                                                                                                                                                                                                                      logger.debug("%s: spanning vertical %s", typ, arr)
                                                                                                                                                                                                                                                                                                                  for section in range(1, len(arr)):
                                                                                                                                                                                                                                                                                                                      if arr[section] == arr[section - 1]:
                                                                                                                                                                                                                                                                                                                          if match_start is None:
                                                                                                                                                                                                                                                                                                                              match_start = section - 1
                                                                                                                                                                                                                                                                                                                          # If this is the last cell, need to end it
                                                                                                                                                                                                                                                                                                                          if section == end_section - start_section:
                                                                                                                                                                                                                                                                                                                              match_end = section
                                                                                                                                                                                                                                                                                                                              span_size = match_end - match_start + 1
                                                                                                                                                                                                                                                                                                                              begin = match_start + start_section
                                                                                                                                                                                                                                                                                                                              if is_horizontal:
                                                                                                                                                                                                                                                                                                                                  self.setSpan(level, begin, 1, span_size)
                                                                                                                                                                                                                                                                                                                                  spans.append((level, begin, 1, span_size))
                                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                                  spans.append((begin, level, span_size, 1))
                                                                                                                                                                                                                                                                                                                                  self.setSpan(begin, level, span_size, 1)
                                                                                                                                                                                                                                                                                                                      elif match_start is not None:
                                                                                                                                                                                                                                                                                                                          match_end = section - 1
                                                                                                                                                                                                                                                                                                                          span_size = match_end - match_start + 1
                                                                                                                                                                                                                                                                                                                          begin = match_start + start_section
                                                                                                                                                                                                                                                                                                                          if is_horizontal:
                                                                                                                                                                                                                                                                                                                              self.setSpan(level, begin, 1, span_size)
                                                                                                                                                                                                                                                                                                                              spans.append((level, begin, 1, span_size))
                                                                                                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                                                                                                              self.setSpan(begin, level, span_size, 1)
                                                                                                                                                                                                                                                                                                                              spans.append((begin, level, span_size, 1))
                                                                                                                                                                                                                                                                                                                          match_start = None
                                                                                                                                                                                                                                                                                                              return spans
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_grid_style() -> constants.PenStyleStr

                                                                                                                                                                                                                                                                                                          Return grid style.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tableview.py
                                                                                                                                                                                                                                                                                                          def get_grid_style(self) -> constants.PenStyleStr:
                                                                                                                                                                                                                                                                                                              """Return grid style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  grid style
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.PEN_STYLE.inverse[self.gridStyle()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_visible_section_span(orientation: constants.OrientationStr | constants.Orientation, margin: int = 0) -> tuple[int, int]

                                                                                                                                                                                                                                                                                                          Get a tuple containing the visible start/end indexes.

                                                                                                                                                                                                                                                                                                          if there are no items visible, return -1, -1

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tableview.py
                                                                                                                                                                                                                                                                                                          def get_visible_section_span(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              orientation: constants.OrientationStr | constants.Orientation,
                                                                                                                                                                                                                                                                                                              margin: int = 0,
                                                                                                                                                                                                                                                                                                          ) -> tuple[int, int]:
                                                                                                                                                                                                                                                                                                              """Get a tuple containing the visible start/end indexes.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              if there are no items visible, return -1, -1
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              rect = self.viewport().rect()
                                                                                                                                                                                                                                                                                                              if orientation in ["horizontal", constants.HORIZONTAL]:
                                                                                                                                                                                                                                                                                                                  start = self.columnAt(rect.left())
                                                                                                                                                                                                                                                                                                                  count = self.model().columnCount()
                                                                                                                                                                                                                                                                                                                  end = self.columnAt(rect.right())
                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                  start = self.rowAt(rect.top())
                                                                                                                                                                                                                                                                                                                  count = self.model().rowCount()
                                                                                                                                                                                                                                                                                                                  end = self.rowAt(rect.bottom())
                                                                                                                                                                                                                                                                                                              if count == 0:
                                                                                                                                                                                                                                                                                                                  return (-1, -1)
                                                                                                                                                                                                                                                                                                              start = max(0, start - margin)
                                                                                                                                                                                                                                                                                                              end = count if end == -1 else min(end + margin, count)
                                                                                                                                                                                                                                                                                                              return (start, end)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_grid_style(style: constants.PenStyleStr | constants.PenStyle)

                                                                                                                                                                                                                                                                                                          Set grid style.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          style PenStyleStr | PenStyle

                                                                                                                                                                                                                                                                                                          grid style to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tableview.py
                                                                                                                                                                                                                                                                                                          def set_grid_style(self, style: constants.PenStyleStr | constants.PenStyle):
                                                                                                                                                                                                                                                                                                              """Set grid style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  style: grid style to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setGridStyle(constants.PEN_STYLE.get_enum_value(style))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_sorting_enabled(enabled: bool, do_sort: bool = False)

                                                                                                                                                                                                                                                                                                          Hack to avoid direct sort when setting sorting enabled.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tableview.py
                                                                                                                                                                                                                                                                                                          def set_sorting_enabled(self, enabled: bool, do_sort: bool = False):
                                                                                                                                                                                                                                                                                                              """Hack to avoid direct sort when setting sorting enabled."""
                                                                                                                                                                                                                                                                                                              model = self.model()
                                                                                                                                                                                                                                                                                                              if not do_sort and model is not None:
                                                                                                                                                                                                                                                                                                                  backup = model.sort
                                                                                                                                                                                                                                                                                                                  model.sort = lambda x, y: None  # ty: ignore[invalid-assignment]
                                                                                                                                                                                                                                                                                                              self.setSortingEnabled(enabled)
                                                                                                                                                                                                                                                                                                              if not do_sort and model is not None:
                                                                                                                                                                                                                                                                                                                  model.sort = backup
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          TableWidgetItem

                                                                                                                                                                                                                                                                                                          Bases: QTableWidgetItem

                                                                                                                                                                                                                                                                                                          Item for use with the QTableWidget class.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tablewidgetitem.py
                                                                                                                                                                                                                                                                                                          class TableWidgetItem(QtWidgets.QTableWidgetItem):
                                                                                                                                                                                                                                                                                                              """Item for use with the QTableWidget class."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __setitem__(self, index: int | constants.ItemDataRoleStr, value):
                                                                                                                                                                                                                                                                                                                  self.set_data(index, value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(self, index: int | constants.ItemDataRoleStr):
                                                                                                                                                                                                                                                                                                                  return self.get_data(index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_flag(
                                                                                                                                                                                                                                                                                                                  self, flag_name: constants.ItemFlagStr | constants.ItemFlag, value: bool
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set a flag based on str name."""
                                                                                                                                                                                                                                                                                                                  flag = constants.ITEM_FLAG.get_enum_value(flag_name)
                                                                                                                                                                                                                                                                                                                  if value:
                                                                                                                                                                                                                                                                                                                      self.setFlags(self.flags() | flag)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.setFlags(self.flags() & ~flag)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_editable(self, editable: bool):
                                                                                                                                                                                                                                                                                                                  """Set whether this item is user-editable."""
                                                                                                                                                                                                                                                                                                                  self.set_flag("editable", editable)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_icon(self, icon: datatypes.IconType):
                                                                                                                                                                                                                                                                                                                  """Set the icon for the action.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      icon: icon to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  icon = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                                  self.setIcon(icon)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_checkstate(self, state: constants.CheckStateStr | constants.CheckState):
                                                                                                                                                                                                                                                                                                                  """Set checkstate of the checkbox.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      state: checkstate to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setCheckState(constants.CHECK_STATE.get_enum_value(state))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_checkstate(self) -> constants.CheckStateStr:
                                                                                                                                                                                                                                                                                                                  """Return checkstate.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      checkstate
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.CHECK_STATE.inverse[self.checkState()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_text_alignment(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  horizontal: (
                                                                                                                                                                                                                                                                                                                      constants.HorizontalAlignmentStr | constants.AlignmentFlag | None
                                                                                                                                                                                                                                                                                                                  ) = None,
                                                                                                                                                                                                                                                                                                                  vertical: constants.VerticalAlignmentStr | constants.AlignmentFlag | None = None,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set text alignment of the checkbox.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      horizontal: horizontal text alignment to use
                                                                                                                                                                                                                                                                                                                      vertical: vertical text alignment to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if horizontal is None and vertical is None:
                                                                                                                                                                                                                                                                                                                      return
                                                                                                                                                                                                                                                                                                                  flag = constants.AlignmentFlag(0)
                                                                                                                                                                                                                                                                                                                  if vertical is not None:
                                                                                                                                                                                                                                                                                                                      flag |= constants.V_ALIGNMENT.get_enum_value(vertical)
                                                                                                                                                                                                                                                                                                                  if horizontal is not None:
                                                                                                                                                                                                                                                                                                                      flag |= constants.H_ALIGNMENT.get_enum_value(horizontal)
                                                                                                                                                                                                                                                                                                                  self.setTextAlignment(flag)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_background(self) -> gui.Brush:
                                                                                                                                                                                                                                                                                                                  return gui.Brush(self.background())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_foreground(self) -> gui.Brush:
                                                                                                                                                                                                                                                                                                                  return gui.Brush(self.foreground())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_font(self) -> gui.Font:
                                                                                                                                                                                                                                                                                                                  return gui.Font(self.font())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_icon(self) -> gui.Icon | None:
                                                                                                                                                                                                                                                                                                                  return None if (icon := self.icon()).isNull() else gui.Icon(icon)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_data(self, role: constants.ItemDataRoleStr | int, data: Any):
                                                                                                                                                                                                                                                                                                                  if isinstance(role, str):
                                                                                                                                                                                                                                                                                                                      role = constants.ITEM_DATA_ROLE[role]
                                                                                                                                                                                                                                                                                                                  super().setData(role, data)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_data(self, role: constants.ItemDataRoleStr | int) -> Any:
                                                                                                                                                                                                                                                                                                                  if isinstance(role, str):
                                                                                                                                                                                                                                                                                                                      role = constants.ITEM_DATA_ROLE[role]
                                                                                                                                                                                                                                                                                                                  return super().data(role)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_tooltip(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  tooltip: str | datatypes.PathType,
                                                                                                                                                                                                                                                                                                                  size: datatypes.SizeType | None = None,
                                                                                                                                                                                                                                                                                                                  rich_text: bool = False,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  if isinstance(tooltip, os.PathLike):
                                                                                                                                                                                                                                                                                                                      path = os.fspath(tooltip)
                                                                                                                                                                                                                                                                                                                      if size is None:
                                                                                                                                                                                                                                                                                                                          tooltip = f"<img src={path!r}>"
                                                                                                                                                                                                                                                                                                                      else:
                                                                                                                                                                                                                                                                                                                          qsize = datatypes.to_size(size)
                                                                                                                                                                                                                                                                                                                          w, h = qsize.width(), qsize.height()
                                                                                                                                                                                                                                                                                                                          tooltip = f'<img src={path!r} width="{w}" height="{h}">'
                                                                                                                                                                                                                                                                                                                  if rich_text:
                                                                                                                                                                                                                                                                                                                      tooltip = f"<html>{html.escape(tooltip)}</html>"
                                                                                                                                                                                                                                                                                                                  super().setToolTip(tooltip)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_checkstate() -> constants.CheckStateStr

                                                                                                                                                                                                                                                                                                          Return checkstate.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tablewidgetitem.py
                                                                                                                                                                                                                                                                                                          def get_checkstate(self) -> constants.CheckStateStr:
                                                                                                                                                                                                                                                                                                              """Return checkstate.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  checkstate
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.CHECK_STATE.inverse[self.checkState()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_checkstate(state: constants.CheckStateStr | constants.CheckState)

                                                                                                                                                                                                                                                                                                          Set checkstate of the checkbox.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          state CheckStateStr | CheckState

                                                                                                                                                                                                                                                                                                          checkstate to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tablewidgetitem.py
                                                                                                                                                                                                                                                                                                          def set_checkstate(self, state: constants.CheckStateStr | constants.CheckState):
                                                                                                                                                                                                                                                                                                              """Set checkstate of the checkbox.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  state: checkstate to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setCheckState(constants.CHECK_STATE.get_enum_value(state))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_editable(editable: bool)

                                                                                                                                                                                                                                                                                                          Set whether this item is user-editable.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tablewidgetitem.py
                                                                                                                                                                                                                                                                                                          def set_editable(self, editable: bool):
                                                                                                                                                                                                                                                                                                              """Set whether this item is user-editable."""
                                                                                                                                                                                                                                                                                                              self.set_flag("editable", editable)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_flag(flag_name: constants.ItemFlagStr | constants.ItemFlag, value: bool)

                                                                                                                                                                                                                                                                                                          Set a flag based on str name.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tablewidgetitem.py
                                                                                                                                                                                                                                                                                                          def set_flag(
                                                                                                                                                                                                                                                                                                              self, flag_name: constants.ItemFlagStr | constants.ItemFlag, value: bool
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set a flag based on str name."""
                                                                                                                                                                                                                                                                                                              flag = constants.ITEM_FLAG.get_enum_value(flag_name)
                                                                                                                                                                                                                                                                                                              if value:
                                                                                                                                                                                                                                                                                                                  self.setFlags(self.flags() | flag)
                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                  self.setFlags(self.flags() & ~flag)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_icon(icon: datatypes.IconType)

                                                                                                                                                                                                                                                                                                          Set the icon for the action.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          icon IconType

                                                                                                                                                                                                                                                                                                          icon to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tablewidgetitem.py
                                                                                                                                                                                                                                                                                                          def set_icon(self, icon: datatypes.IconType):
                                                                                                                                                                                                                                                                                                              """Set the icon for the action.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  icon: icon to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              icon = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                              self.setIcon(icon)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_text_alignment(horizontal: constants.HorizontalAlignmentStr | constants.AlignmentFlag | None = None, vertical: constants.VerticalAlignmentStr | constants.AlignmentFlag | None = None)

                                                                                                                                                                                                                                                                                                          Set text alignment of the checkbox.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          horizontal HorizontalAlignmentStr | AlignmentFlag | None

                                                                                                                                                                                                                                                                                                          horizontal text alignment to use

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          vertical VerticalAlignmentStr | AlignmentFlag | None

                                                                                                                                                                                                                                                                                                          vertical text alignment to use

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tablewidgetitem.py
                                                                                                                                                                                                                                                                                                          def set_text_alignment(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              horizontal: (
                                                                                                                                                                                                                                                                                                                  constants.HorizontalAlignmentStr | constants.AlignmentFlag | None
                                                                                                                                                                                                                                                                                                              ) = None,
                                                                                                                                                                                                                                                                                                              vertical: constants.VerticalAlignmentStr | constants.AlignmentFlag | None = None,
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set text alignment of the checkbox.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  horizontal: horizontal text alignment to use
                                                                                                                                                                                                                                                                                                                  vertical: vertical text alignment to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if horizontal is None and vertical is None:
                                                                                                                                                                                                                                                                                                                  return
                                                                                                                                                                                                                                                                                                              flag = constants.AlignmentFlag(0)
                                                                                                                                                                                                                                                                                                              if vertical is not None:
                                                                                                                                                                                                                                                                                                                  flag |= constants.V_ALIGNMENT.get_enum_value(vertical)
                                                                                                                                                                                                                                                                                                              if horizontal is not None:
                                                                                                                                                                                                                                                                                                                  flag |= constants.H_ALIGNMENT.get_enum_value(horizontal)
                                                                                                                                                                                                                                                                                                              self.setTextAlignment(flag)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          TapGesture

                                                                                                                                                                                                                                                                                                          Bases: GestureMixin, QTapGesture

                                                                                                                                                                                                                                                                                                          Describes a tap gesture made by the user.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tapgesture.py
                                                                                                                                                                                                                                                                                                          4
                                                                                                                                                                                                                                                                                                          5
                                                                                                                                                                                                                                                                                                          6
                                                                                                                                                                                                                                                                                                          7
                                                                                                                                                                                                                                                                                                          8
                                                                                                                                                                                                                                                                                                          class TapGesture(widgets.GestureMixin, widgets.QTapGesture):
                                                                                                                                                                                                                                                                                                              """Describes a tap gesture made by the user."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_position(self) -> core.PointF:
                                                                                                                                                                                                                                                                                                                  return core.PointF(self.position())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          TextBrowser

                                                                                                                                                                                                                                                                                                          Bases: TextEditMixin, QTextBrowser

                                                                                                                                                                                                                                                                                                          Rich text browser with hypertext navigation.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/textbrowser.py
                                                                                                                                                                                                                                                                                                          class TextBrowser(widgets.TextEditMixin, widgets.QTextBrowser):
                                                                                                                                                                                                                                                                                                              """Rich text browser with hypertext navigation."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.setOpenExternalLinks(True)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # def dragEnterEvent(self, event):
                                                                                                                                                                                                                                                                                                              #     u = event.mimeData().urls()
                                                                                                                                                                                                                                                                                                              #     for url in u:
                                                                                                                                                                                                                                                                                                              #         file_path = os.path.abspath(url.toLocalFile())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              #         ext = file_path.split(".")[-1]
                                                                                                                                                                                                                                                                                                              #         if ext in ["txt", "md", "markdown"]:
                                                                                                                                                                                                                                                                                                              #             event.accept()
                                                                                                                                                                                                                                                                                                              #         else:
                                                                                                                                                                                                                                                                                                              #             event.ignore()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # def dropEvent(self, event):
                                                                                                                                                                                                                                                                                                              #     event.accept()
                                                                                                                                                                                                                                                                                                              #     self.show_markdown_file(self.filePath)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_markdown_file(self, file_path: datatypes.PathType):
                                                                                                                                                                                                                                                                                                                  file_path = pathlib.Path(file_path)
                                                                                                                                                                                                                                                                                                                  with file_path.open() as f:
                                                                                                                                                                                                                                                                                                                      file_content = f.read()
                                                                                                                                                                                                                                                                                                                  self.setMarkdown(file_content)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_markdown(self, text: str):
                                                                                                                                                                                                                                                                                                                  self.setMarkdown(text)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_search_paths(self) -> list[pathlib.Path]:
                                                                                                                                                                                                                                                                                                                  return [pathlib.Path(p) for p in self.searchPaths()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_search_paths(self, paths: Iterable[datatypes.PathType]):
                                                                                                                                                                                                                                                                                                                  self.setSearchPaths([os.fspath(p) for p in paths])
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_source_type(self) -> gui.textdocument.ResourceTypeStr:
                                                                                                                                                                                                                                                                                                                  return gui.textdocument.RESOURCE_TYPES.inverse[self.sourceType()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          TextEdit

                                                                                                                                                                                                                                                                                                          Bases: TextEditMixin, QTextEdit

                                                                                                                                                                                                                                                                                                          Widget that is used to edit and display both plain and rich text.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/textedit.py
                                                                                                                                                                                                                                                                                                          class TextEdit(TextEditMixin, widgets.QTextEdit):
                                                                                                                                                                                                                                                                                                              """Widget that is used to edit and display both plain and rich text."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          TextEditMixin

                                                                                                                                                                                                                                                                                                          Bases: AbstractScrollAreaMixin, _TextEditBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/textedit.py
                                                                                                                                                                                                                                                                                                          class TextEditMixin(widgets.AbstractScrollAreaMixin, _TextEditBase):
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(str)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, **kwargs) -> None:
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.textChanged.connect(self.on_value_change)
                                                                                                                                                                                                                                                                                                                  self.selecter = texteditselecter.TextEditSelecter(self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __add__(self, other: str) -> Self:
                                                                                                                                                                                                                                                                                                                  self.append_text(other)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "autoFormatting": AUTO_FORMATTING,
                                                                                                                                                                                                                                                                                                                      "lineWrapMode": LINE_WRAP_MODE,
                                                                                                                                                                                                                                                                                                                      "wordWrapMode": gui.textoption.WORD_WRAP_MODE,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def on_value_change(self) -> None:
                                                                                                                                                                                                                                                                                                                  self.value_changed.emit(self.text())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_text(self, text: str) -> None:
                                                                                                                                                                                                                                                                                                                  self.setPlainText(text)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def append_text(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  text: str,
                                                                                                                                                                                                                                                                                                                  newline: bool = True,
                                                                                                                                                                                                                                                                                                                  ensure_visible: Literal["always", "when_bottom", "never"] = "always",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  scrollbar = self.verticalScrollBar()
                                                                                                                                                                                                                                                                                                                  at_bottom = scrollbar.value() >= (scrollbar.maximum() - 4)
                                                                                                                                                                                                                                                                                                                  prev_val = scrollbar.value()
                                                                                                                                                                                                                                                                                                                  if newline:
                                                                                                                                                                                                                                                                                                                      self.append(text)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.selecter.move_cursor("end")
                                                                                                                                                                                                                                                                                                                      self.insertHtml(text)
                                                                                                                                                                                                                                                                                                                      self.selecter.move_cursor("end")
                                                                                                                                                                                                                                                                                                                  match ensure_visible:
                                                                                                                                                                                                                                                                                                                      case "always":
                                                                                                                                                                                                                                                                                                                          self.ensureCursorVisible()
                                                                                                                                                                                                                                                                                                                      case "when_bottom":
                                                                                                                                                                                                                                                                                                                          if at_bottom:
                                                                                                                                                                                                                                                                                                                              self.ensureCursorVisible()
                                                                                                                                                                                                                                                                                                                      case "never":
                                                                                                                                                                                                                                                                                                                          scrollbar.setValue(prev_val)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def text(self) -> str:
                                                                                                                                                                                                                                                                                                                  return self.toPlainText()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_read_only(self, value: bool = True) -> None:
                                                                                                                                                                                                                                                                                                                  self.setReadOnly(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_text_color(self, color: datatypes.ColorType) -> None:
                                                                                                                                                                                                                                                                                                                  color = colors.get_color(color)
                                                                                                                                                                                                                                                                                                                  self.setTextColor(color)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_line_wrap_mode(self, mode: LineWrapModeStr | widgets.QTextEdit.LineWrapMode):
                                                                                                                                                                                                                                                                                                                  """Set line wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: line wrap mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setLineWrapMode(LINE_WRAP_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_line_wrap_mode(self) -> LineWrapModeStr:
                                                                                                                                                                                                                                                                                                                  """Get the current wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      Wrap mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return LINE_WRAP_MODE.inverse[self.lineWrapMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_auto_formatting(
                                                                                                                                                                                                                                                                                                                  self, mode: AutoFormattingStr | widgets.QTextEdit.AutoFormattingFlag
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set auto formatting mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: auto formatting mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setAutoFormatting(AUTO_FORMATTING.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_auto_formatting(self) -> AutoFormattingStr:
                                                                                                                                                                                                                                                                                                                  """Get the current auto formatting mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      Auto formatting mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return AUTO_FORMATTING.inverse[self.autoFormatting()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_word_wrap_mode(
                                                                                                                                                                                                                                                                                                                  self, mode: gui.textoption.WordWrapModeStr | gui.QTextOption.WrapMode
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set word wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: word wrap mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setWordWrapMode(gui.textoption.WORD_WRAP_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_word_wrap_mode(self) -> gui.textoption.WordWrapModeStr:
                                                                                                                                                                                                                                                                                                                  """Get the current word wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      Word wrap mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return gui.textoption.WORD_WRAP_MODE.inverse[self.wordWrapMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_auto_formatting() -> AutoFormattingStr

                                                                                                                                                                                                                                                                                                          Get the current auto formatting mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/textedit.py
                                                                                                                                                                                                                                                                                                          def get_auto_formatting(self) -> AutoFormattingStr:
                                                                                                                                                                                                                                                                                                              """Get the current auto formatting mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  Auto formatting mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return AUTO_FORMATTING.inverse[self.autoFormatting()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_line_wrap_mode() -> LineWrapModeStr

                                                                                                                                                                                                                                                                                                          Get the current wrap mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/textedit.py
                                                                                                                                                                                                                                                                                                          def get_line_wrap_mode(self) -> LineWrapModeStr:
                                                                                                                                                                                                                                                                                                              """Get the current wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  Wrap mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return LINE_WRAP_MODE.inverse[self.lineWrapMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_word_wrap_mode() -> gui.textoption.WordWrapModeStr

                                                                                                                                                                                                                                                                                                          Get the current word wrap mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/textedit.py
                                                                                                                                                                                                                                                                                                          def get_word_wrap_mode(self) -> gui.textoption.WordWrapModeStr:
                                                                                                                                                                                                                                                                                                              """Get the current word wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  Word wrap mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return gui.textoption.WORD_WRAP_MODE.inverse[self.wordWrapMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_auto_formatting(mode: AutoFormattingStr | widgets.QTextEdit.AutoFormattingFlag)

                                                                                                                                                                                                                                                                                                          Set auto formatting mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode AutoFormattingStr | AutoFormattingFlag

                                                                                                                                                                                                                                                                                                          auto formatting mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/textedit.py
                                                                                                                                                                                                                                                                                                          def set_auto_formatting(
                                                                                                                                                                                                                                                                                                              self, mode: AutoFormattingStr | widgets.QTextEdit.AutoFormattingFlag
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set auto formatting mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: auto formatting mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setAutoFormatting(AUTO_FORMATTING.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_line_wrap_mode(mode: LineWrapModeStr | widgets.QTextEdit.LineWrapMode)

                                                                                                                                                                                                                                                                                                          Set line wrap mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode LineWrapModeStr | LineWrapMode

                                                                                                                                                                                                                                                                                                          line wrap mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/textedit.py
                                                                                                                                                                                                                                                                                                          def set_line_wrap_mode(self, mode: LineWrapModeStr | widgets.QTextEdit.LineWrapMode):
                                                                                                                                                                                                                                                                                                              """Set line wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: line wrap mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setLineWrapMode(LINE_WRAP_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_word_wrap_mode(mode: gui.textoption.WordWrapModeStr | gui.QTextOption.WrapMode)

                                                                                                                                                                                                                                                                                                          Set word wrap mode.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode WordWrapModeStr | WrapMode

                                                                                                                                                                                                                                                                                                          word wrap mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/textedit.py
                                                                                                                                                                                                                                                                                                          def set_word_wrap_mode(
                                                                                                                                                                                                                                                                                                              self, mode: gui.textoption.WordWrapModeStr | gui.QTextOption.WrapMode
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set word wrap mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: word wrap mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setWordWrapMode(gui.textoption.WORD_WRAP_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          TimeEdit

                                                                                                                                                                                                                                                                                                          Bases: DateTimeEditMixin, QTimeEdit

                                                                                                                                                                                                                                                                                                          Widget for editing times based on the QDateTimeEdit widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/timeedit.py
                                                                                                                                                                                                                                                                                                          class TimeEdit(widgets.DateTimeEditMixin, widgets.QTimeEdit):
                                                                                                                                                                                                                                                                                                              """Widget for editing times based on the QDateTimeEdit widget."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              value_changed = core.Signal(dt.datetime)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_range(self, lower: datatypes.TimeType, upper: datatypes.TimeType):
                                                                                                                                                                                                                                                                                                                  # self.setToolTip(f"{lower.toString()} <= x <= {upper.toString()}")
                                                                                                                                                                                                                                                                                                                  self.setTimeRange(datatypes.to_time(lower), datatypes.to_time(upper))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_value(self) -> dt.time:
                                                                                                                                                                                                                                                                                                                  return self.get_time()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self, value: datatypes.TimeType):
                                                                                                                                                                                                                                                                                                                  self.set_time(value)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_time(self, value: datatypes.TimeType):
                                                                                                                                                                                                                                                                                                                  super().setTime(datatypes.to_time(value))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def setup_example(cls):
                                                                                                                                                                                                                                                                                                                  widget = TimeEdit()
                                                                                                                                                                                                                                                                                                                  widget.set_value("02:11:50")
                                                                                                                                                                                                                                                                                                                  return widget
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ToolBar

                                                                                                                                                                                                                                                                                                          Bases: ToolBarMixin, QToolBar

                                                                                                                                                                                                                                                                                                          Movable panel that contains a set of controls.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/toolbar.py
                                                                                                                                                                                                                                                                                                          class ToolBar(ToolBarMixin, widgets.QToolBar):
                                                                                                                                                                                                                                                                                                              """Movable panel that contains a set of controls."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ToolBox

                                                                                                                                                                                                                                                                                                          Bases: FrameMixin, QToolBox

                                                                                                                                                                                                                                                                                                          Column of tabbed widget items.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/toolbox.py
                                                                                                                                                                                                                                                                                                          class ToolBox(widgets.FrameMixin, widgets.QToolBox):
                                                                                                                                                                                                                                                                                                              """Column of tabbed widget items."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(
                                                                                                                                                                                                                                                                                                                  self, index: int | str
                                                                                                                                                                                                                                                                                                              ) -> widgets.QWidget | listdelegators.ListDelegator[widgets.QWidget]:
                                                                                                                                                                                                                                                                                                                  match index:
                                                                                                                                                                                                                                                                                                                      case int():
                                                                                                                                                                                                                                                                                                                          if (widget := self.widget(index)) is None:
                                                                                                                                                                                                                                                                                                                              raise IndexError(index)
                                                                                                                                                                                                                                                                                                                          return widget
                                                                                                                                                                                                                                                                                                                      case str():
                                                                                                                                                                                                                                                                                                                          result = self.find_child(widgets.QWidget, index)
                                                                                                                                                                                                                                                                                                                          if result is None:
                                                                                                                                                                                                                                                                                                                              msg = "Widget not found"
                                                                                                                                                                                                                                                                                                                              raise KeyError(msg)
                                                                                                                                                                                                                                                                                                                          return result
                                                                                                                                                                                                                                                                                                                      case slice():
                                                                                                                                                                                                                                                                                                                          rng = range(*index.indices(self.count()))
                                                                                                                                                                                                                                                                                                                          wdgs = [self.widget(i) for i in rng]
                                                                                                                                                                                                                                                                                                                          return listdelegators.ListDelegator(wdgs)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise TypeError(index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __delitem__(self, index: int):
                                                                                                                                                                                                                                                                                                                  self.removeItem(index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # def __setstate__(self, state):
                                                                                                                                                                                                                                                                                                              #     for i, item in enumerate(state["items"]):
                                                                                                                                                                                                                                                                                                              #         self.addItem(item["widget"], item["icon"], item["text"])
                                                                                                                                                                                                                                                                                                              #         self.setItemEnabled(i, item["enabled"])
                                                                                                                                                                                                                                                                                                              #         self.setItemToolTip(i, item["tool_tip"])
                                                                                                                                                                                                                                                                                                              #     self.setCurrentIndex(state["current_index"])
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # def __reduce__(self):
                                                                                                                                                                                                                                                                                                              #     return type(self), (), self.__getstate__()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __iter__(self) -> Iterator[widgets.QWidget]:
                                                                                                                                                                                                                                                                                                                  return iter(self.get_children())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __contains__(self, item: widgets.QWidget):
                                                                                                                                                                                                                                                                                                                  return self.indexOf(item) >= 0
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_children(self) -> listdelegators.ListDelegator[widgets.QWidget]:
                                                                                                                                                                                                                                                                                                                  widgets = [self.widget(i) for i in range(self.count())]
                                                                                                                                                                                                                                                                                                                  return listdelegators.ListDelegator(widgets)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_widget(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  widget: widgets.QWidget,
                                                                                                                                                                                                                                                                                                                  title: str | None = None,
                                                                                                                                                                                                                                                                                                                  icon: datatypes.IconType = None,
                                                                                                                                                                                                                                                                                                                  tooltip: str = "",
                                                                                                                                                                                                                                                                                                                  enabled: bool = True,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  title = widget.objectName() if title is None else title
                                                                                                                                                                                                                                                                                                                  icon = iconprovider.get_icon(icon) if icon else gui.Icon()
                                                                                                                                                                                                                                                                                                                  self.addItem(widget, icon, title)
                                                                                                                                                                                                                                                                                                                  index = self.indexOf(widget)
                                                                                                                                                                                                                                                                                                                  if tooltip:
                                                                                                                                                                                                                                                                                                                      self.setItemToolTip(index, tooltip)
                                                                                                                                                                                                                                                                                                                  self.setItemEnabled(index, enabled)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_item_icon(self, index: int) -> gui.Icon | None:
                                                                                                                                                                                                                                                                                                                  icon = self.itemIcon(index)
                                                                                                                                                                                                                                                                                                                  return None if icon.isNull() else gui.Icon(icon)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ToolButton

                                                                                                                                                                                                                                                                                                          Bases: AbstractButtonMixin, QToolButton

                                                                                                                                                                                                                                                                                                          Quick-access button to commands or options, usually used inside a QToolBar.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/toolbutton.py
                                                                                                                                                                                                                                                                                                          class ToolButton(widgets.AbstractButtonMixin, widgets.QToolButton):
                                                                                                                                                                                                                                                                                                              """Quick-access button to commands or options, usually used inside a QToolBar."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(self, item: str) -> QtGui.QAction:
                                                                                                                                                                                                                                                                                                                  if (menu := self.menu()) is None:
                                                                                                                                                                                                                                                                                                                      raise KeyError(item)
                                                                                                                                                                                                                                                                                                                  return cast("widgets.Menu", menu)[item]  # set via prettyqt's set_menu()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # def set_menu(self, menu: widgets.QMenu):
                                                                                                                                                                                                                                                                                                              #     menu.setParent(self)
                                                                                                                                                                                                                                                                                                              #     self.setMenu(menu)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "toolButtonStyle": constants.TOOLBUTTON_STYLE,
                                                                                                                                                                                                                                                                                                                      "arrowType": constants.ARROW_TYPE,
                                                                                                                                                                                                                                                                                                                      "popupMode": POPUP_MODE,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def for_menu(cls, menu: widgets.QMenu, icon: datatypes.IconType = None) -> Self:
                                                                                                                                                                                                                                                                                                                  btn = cls()
                                                                                                                                                                                                                                                                                                                  btn.setMenu(menu)
                                                                                                                                                                                                                                                                                                                  # btn.set_title(menu.title())
                                                                                                                                                                                                                                                                                                                  btn.set_popup_mode("instant")
                                                                                                                                                                                                                                                                                                                  btn.set_icon(icon)
                                                                                                                                                                                                                                                                                                                  return btn
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_default_action(self, action: QtGui.QAction):
                                                                                                                                                                                                                                                                                                                  self.setDefaultAction(action)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_popup_mode(
                                                                                                                                                                                                                                                                                                                  self, mode: PopupModeStr | widgets.QToolButton.ToolButtonPopupMode
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the popup mode of the toolbutton.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: popup mode to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setPopupMode(POPUP_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_popup_mode(self) -> PopupModeStr:
                                                                                                                                                                                                                                                                                                                  """Return popup mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      popup mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return POPUP_MODE.inverse[self.popupMode()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_arrow_type(self, mode: constants.ArrowTypeStr | constants.ArrowType):
                                                                                                                                                                                                                                                                                                                  """Set the arrow type of the toolbutton.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      mode: arrow type to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setArrowType(constants.ARROW_TYPE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_arrow_type(self) -> constants.ArrowTypeStr:
                                                                                                                                                                                                                                                                                                                  """Return arrow type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      arrow type
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.ARROW_TYPE.inverse[self.arrowType()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_style(self, style: constants.ToolButtonStyleStr | constants.ToolButtonStyle):
                                                                                                                                                                                                                                                                                                                  """Set the toolbutton style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      style: style to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setToolButtonStyle(constants.TOOLBUTTON_STYLE.get_enum_value(style))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_style(self) -> constants.ToolButtonStyleStr:
                                                                                                                                                                                                                                                                                                                  """Return toolbutton style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      toolbutton style
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.TOOLBUTTON_STYLE.inverse[self.toolButtonStyle()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_arrow_type() -> constants.ArrowTypeStr

                                                                                                                                                                                                                                                                                                          Return arrow type.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/toolbutton.py
                                                                                                                                                                                                                                                                                                          def get_arrow_type(self) -> constants.ArrowTypeStr:
                                                                                                                                                                                                                                                                                                              """Return arrow type.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  arrow type
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.ARROW_TYPE.inverse[self.arrowType()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_popup_mode() -> PopupModeStr

                                                                                                                                                                                                                                                                                                          Return popup mode.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/toolbutton.py
                                                                                                                                                                                                                                                                                                          def get_popup_mode(self) -> PopupModeStr:
                                                                                                                                                                                                                                                                                                              """Return popup mode.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  popup mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return POPUP_MODE.inverse[self.popupMode()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_style() -> constants.ToolButtonStyleStr

                                                                                                                                                                                                                                                                                                          Return toolbutton style.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/toolbutton.py
                                                                                                                                                                                                                                                                                                          def get_style(self) -> constants.ToolButtonStyleStr:
                                                                                                                                                                                                                                                                                                              """Return toolbutton style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  toolbutton style
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.TOOLBUTTON_STYLE.inverse[self.toolButtonStyle()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_arrow_type(mode: constants.ArrowTypeStr | constants.ArrowType)

                                                                                                                                                                                                                                                                                                          Set the arrow type of the toolbutton.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode ArrowTypeStr | ArrowType

                                                                                                                                                                                                                                                                                                          arrow type to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/toolbutton.py
                                                                                                                                                                                                                                                                                                          def set_arrow_type(self, mode: constants.ArrowTypeStr | constants.ArrowType):
                                                                                                                                                                                                                                                                                                              """Set the arrow type of the toolbutton.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: arrow type to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setArrowType(constants.ARROW_TYPE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_popup_mode(mode: PopupModeStr | widgets.QToolButton.ToolButtonPopupMode)

                                                                                                                                                                                                                                                                                                          Set the popup mode of the toolbutton.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          mode PopupModeStr | ToolButtonPopupMode

                                                                                                                                                                                                                                                                                                          popup mode to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/toolbutton.py
                                                                                                                                                                                                                                                                                                          def set_popup_mode(
                                                                                                                                                                                                                                                                                                              self, mode: PopupModeStr | widgets.QToolButton.ToolButtonPopupMode
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the popup mode of the toolbutton.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  mode: popup mode to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setPopupMode(POPUP_MODE.get_enum_value(mode))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_style(style: constants.ToolButtonStyleStr | constants.ToolButtonStyle)

                                                                                                                                                                                                                                                                                                          Set the toolbutton style.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          style ToolButtonStyleStr | ToolButtonStyle

                                                                                                                                                                                                                                                                                                          style to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/toolbutton.py
                                                                                                                                                                                                                                                                                                          def set_style(self, style: constants.ToolButtonStyleStr | constants.ToolButtonStyle):
                                                                                                                                                                                                                                                                                                              """Set the toolbutton style.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  style: style to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setToolButtonStyle(constants.TOOLBUTTON_STYLE.get_enum_value(style))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          ToolTip

                                                                                                                                                                                                                                                                                                          Bases: QToolTip

                                                                                                                                                                                                                                                                                                          Tool tips (balloon help) for any widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/tooltip.py
                                                                                                                                                                                                                                                                                                          class ToolTip(QtWidgets.QToolTip):
                                                                                                                                                                                                                                                                                                              """Tool tips (balloon help) for any widget."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def show_text(
                                                                                                                                                                                                                                                                                                                  cls,
                                                                                                                                                                                                                                                                                                                  position: datatypes.PointType | None = None,
                                                                                                                                                                                                                                                                                                                  text: str = "",
                                                                                                                                                                                                                                                                                                                  linebreak_px: int = 400,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  cls.showText(
                                                                                                                                                                                                                                                                                                                      QtGui.QCursor.pos() if position is None else datatypes.to_point(position),
                                                                                                                                                                                                                                                                                                                      f'<div style="max-width: {linebreak_px}px">{text}</div>',
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          TreeView

                                                                                                                                                                                                                                                                                                          Bases: TreeViewMixin, QTreeView

                                                                                                                                                                                                                                                                                                          Default model/view implementation of a tree view.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/treeview.py
                                                                                                                                                                                                                                                                                                          class TreeView(TreeViewMixin, widgets.QTreeView):
                                                                                                                                                                                                                                                                                                              """Default model/view implementation of a tree view."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          TreeViewMixin

                                                                                                                                                                                                                                                                                                          Bases: AbstractItemViewMixin, _TreeViewBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/treeview.py
                                                                                                                                                                                                                                                                                                          class TreeViewMixin(widgets.AbstractItemViewMixin, _TreeViewBase):
                                                                                                                                                                                                                                                                                                              def __init__(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  *args,
                                                                                                                                                                                                                                                                                                                  root_is_decorated: bool = True,
                                                                                                                                                                                                                                                                                                                  all_columns_show_focus: bool = True,
                                                                                                                                                                                                                                                                                                                  uniform_row_heights: bool = True,
                                                                                                                                                                                                                                                                                                                  alternating_row_colors: bool = True,
                                                                                                                                                                                                                                                                                                                  selection_mode: str = "extended",
                                                                                                                                                                                                                                                                                                                  **kwargs,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  super().__init__(
                                                                                                                                                                                                                                                                                                                      *args,
                                                                                                                                                                                                                                                                                                                      root_is_decorated=root_is_decorated,
                                                                                                                                                                                                                                                                                                                      all_columns_show_focus=all_columns_show_focus,
                                                                                                                                                                                                                                                                                                                      uniform_row_heights=uniform_row_heights,
                                                                                                                                                                                                                                                                                                                      alternating_row_colors=alternating_row_colors,
                                                                                                                                                                                                                                                                                                                      selection_mode=selection_mode,
                                                                                                                                                                                                                                                                                                                      **kwargs,
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                                  self.setStyleSheet("QTreeView::item { padding: 5px }")
                                                                                                                                                                                                                                                                                                                  self.h_header = widgets.HeaderView("horizontal", parent=self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @property
                                                                                                                                                                                                                                                                                                              def h_header(self) -> widgets.HeaderView:
                                                                                                                                                                                                                                                                                                                  # prettyqt installs its own HeaderView on construction
                                                                                                                                                                                                                                                                                                                  return cast("widgets.HeaderView", self.header())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @h_header.setter
                                                                                                                                                                                                                                                                                                              def h_header(self, header: widgets.QHeaderView):
                                                                                                                                                                                                                                                                                                                  self.setHeader(header)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def show_root(self, value: bool):
                                                                                                                                                                                                                                                                                                                  self.setRootIndex(core.QModelIndex())
                                                                                                                                                                                                                                                                                                                  if not value:
                                                                                                                                                                                                                                                                                                                      self.setRootIndex(self.model().index(0, 0))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_expanded(
                                                                                                                                                                                                                                                                                                                  self, index: core.ModelIndex | Iterable[core.ModelIndex], expanded: bool = True
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set expaned state of an index or an Iterable of indexes."""
                                                                                                                                                                                                                                                                                                                  match index:
                                                                                                                                                                                                                                                                                                                      case Iterable():
                                                                                                                                                                                                                                                                                                                          for idx in index:
                                                                                                                                                                                                                                                                                                                              self.setExpanded(idx, expanded)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          self.setExpanded(index, expanded)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def expand_all(self, depth: int | None = None):
                                                                                                                                                                                                                                                                                                                  if depth is None:
                                                                                                                                                                                                                                                                                                                      super().expandAll()
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      model = self.model()
                                                                                                                                                                                                                                                                                                                      if not isinstance(model, core.AbstractItemModelMixin):
                                                                                                                                                                                                                                                                                                                          raise TypeError(model)
                                                                                                                                                                                                                                                                                                                      for idx in model.iter_tree(parent_index=self.rootIndex(), depth=depth):
                                                                                                                                                                                                                                                                                                                          self.setExpanded(idx, True)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_sorting_enabled(self, enabled: bool, do_sort: bool = False):
                                                                                                                                                                                                                                                                                                                  """Hack to avoid direct sort when setting sorting enabled."""
                                                                                                                                                                                                                                                                                                                  model = self.model()
                                                                                                                                                                                                                                                                                                                  if not do_sort and model is not None:
                                                                                                                                                                                                                                                                                                                      backup = model.sort
                                                                                                                                                                                                                                                                                                                      model.sort = lambda x, y: None  # ty: ignore[invalid-assignment]
                                                                                                                                                                                                                                                                                                                  self.setSortingEnabled(enabled)
                                                                                                                                                                                                                                                                                                                  if not do_sort and model is not None:
                                                                                                                                                                                                                                                                                                                      model.sort = backup
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_indentation(self, indentation: int):
                                                                                                                                                                                                                                                                                                                  self.setIndentation(indentation)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def setup_list_style(self):
                                                                                                                                                                                                                                                                                                                  self.setSelectionBehavior(self.SelectionBehavior.SelectRows)
                                                                                                                                                                                                                                                                                                                  self.h_header.setStretchLastSection(True)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def adapt_sizes(self):
                                                                                                                                                                                                                                                                                                                  model = self.model()
                                                                                                                                                                                                                                                                                                                  if model is not None and (model.rowCount() * model.columnCount()) < 1000:  # noqa: PLR2004
                                                                                                                                                                                                                                                                                                                      self.h_header.resizeSections(self.h_header.ResizeMode.ResizeToContents)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.h_header.resize_sections("interactive")
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def sort_by_column(self, column: int | None, ascending: bool = True):
                                                                                                                                                                                                                                                                                                                  column = -1 if column is None else column
                                                                                                                                                                                                                                                                                                                  order = constants.ASCENDING if ascending else constants.DESCENDING
                                                                                                                                                                                                                                                                                                                  self.sortByColumn(column, order)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_expanded(index: core.ModelIndex | Iterable[core.ModelIndex], expanded: bool = True)

                                                                                                                                                                                                                                                                                                          Set expaned state of an index or an Iterable of indexes.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/treeview.py
                                                                                                                                                                                                                                                                                                          def set_expanded(
                                                                                                                                                                                                                                                                                                              self, index: core.ModelIndex | Iterable[core.ModelIndex], expanded: bool = True
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set expaned state of an index or an Iterable of indexes."""
                                                                                                                                                                                                                                                                                                              match index:
                                                                                                                                                                                                                                                                                                                  case Iterable():
                                                                                                                                                                                                                                                                                                                      for idx in index:
                                                                                                                                                                                                                                                                                                                          self.setExpanded(idx, expanded)
                                                                                                                                                                                                                                                                                                                  case _:
                                                                                                                                                                                                                                                                                                                      self.setExpanded(index, expanded)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_sorting_enabled(enabled: bool, do_sort: bool = False)

                                                                                                                                                                                                                                                                                                          Hack to avoid direct sort when setting sorting enabled.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/treeview.py
                                                                                                                                                                                                                                                                                                          def set_sorting_enabled(self, enabled: bool, do_sort: bool = False):
                                                                                                                                                                                                                                                                                                              """Hack to avoid direct sort when setting sorting enabled."""
                                                                                                                                                                                                                                                                                                              model = self.model()
                                                                                                                                                                                                                                                                                                              if not do_sort and model is not None:
                                                                                                                                                                                                                                                                                                                  backup = model.sort
                                                                                                                                                                                                                                                                                                                  model.sort = lambda x, y: None  # ty: ignore[invalid-assignment]
                                                                                                                                                                                                                                                                                                              self.setSortingEnabled(enabled)
                                                                                                                                                                                                                                                                                                              if not do_sort and model is not None:
                                                                                                                                                                                                                                                                                                                  model.sort = backup
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          TreeWidget

                                                                                                                                                                                                                                                                                                          Bases: TreeWidgetMixin, QTreeWidget

                                                                                                                                                                                                                                                                                                          Tree view that uses a predefined tree model.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/treewidget.py
                                                                                                                                                                                                                                                                                                          class TreeWidget(TreeWidgetMixin, widgets.QTreeWidget):
                                                                                                                                                                                                                                                                                                              """Tree view that uses a predefined tree model."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          TreeWidgetItem

                                                                                                                                                                                                                                                                                                          Bases: SerializeMixin, QTreeWidgetItem

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/treewidgetitem.py
                                                                                                                                                                                                                                                                                                          class TreeWidgetItem(serializemixin.SerializeMixin, QtWidgets.QTreeWidgetItem):
                                                                                                                                                                                                                                                                                                              def __repr__(self):
                                                                                                                                                                                                                                                                                                                  return get_repr(self)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def serialize_fields(self):
                                                                                                                                                                                                                                                                                                                  data = [self.data(i, constants.USER_ROLE) for i in range(self.columnCount())]
                                                                                                                                                                                                                                                                                                                  return dict(
                                                                                                                                                                                                                                                                                                                      text=[self.text(i) for i in range(self.columnCount())],
                                                                                                                                                                                                                                                                                                                      tool_tip=[self.toolTip(i) for i in range(self.columnCount())],
                                                                                                                                                                                                                                                                                                                      status_tip=[self.statusTip(i) for i in range(self.columnCount())],
                                                                                                                                                                                                                                                                                                                      checkstate=[self.get_checkstate(i) for i in range(self.columnCount())],
                                                                                                                                                                                                                                                                                                                      icon=[self.get_icon(i) for i in range(self.columnCount())],
                                                                                                                                                                                                                                                                                                                      data=data,
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __iter__(self) -> Iterator[QtWidgets.QTreeWidgetItem]:
                                                                                                                                                                                                                                                                                                                  return iter(
                                                                                                                                                                                                                                                                                                                      c for i in range(self.childCount()) if (c := self.child(i)) is not None
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __len__(self):
                                                                                                                                                                                                                                                                                                                  return self.childCount()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(
                                                                                                                                                                                                                                                                                                                  self, index: int | slice
                                                                                                                                                                                                                                                                                                              ) -> (
                                                                                                                                                                                                                                                                                                                  QtWidgets.QTreeWidgetItem
                                                                                                                                                                                                                                                                                                                  | listdelegators.ListDelegator[QtWidgets.QTreeWidgetItem]
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  match index:
                                                                                                                                                                                                                                                                                                                      case int():
                                                                                                                                                                                                                                                                                                                          item = self.child(index)
                                                                                                                                                                                                                                                                                                                          if item is None:
                                                                                                                                                                                                                                                                                                                              raise KeyError(index)
                                                                                                                                                                                                                                                                                                                          return item
                                                                                                                                                                                                                                                                                                                      case slice():
                                                                                                                                                                                                                                                                                                                          count = self.childCount() if index.stop is None else index.stop
                                                                                                                                                                                                                                                                                                                          values = list(range(count)[index])
                                                                                                                                                                                                                                                                                                                          ls = [self.child(i) for i in values]
                                                                                                                                                                                                                                                                                                                          return listdelegators.ListDelegator(ls)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise TypeError(index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __delitem__(self, index: int):
                                                                                                                                                                                                                                                                                                                  self.takeChild(index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __add__(self, other: QtWidgets.QTreeWidgetItem) -> TreeWidgetItem:
                                                                                                                                                                                                                                                                                                                  self.addChild(other)
                                                                                                                                                                                                                                                                                                                  return self
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def setChecked(self, column: int, checked: bool):
                                                                                                                                                                                                                                                                                                                  self.setCheckState(
                                                                                                                                                                                                                                                                                                                      column,
                                                                                                                                                                                                                                                                                                                      constants.CheckState.Checked if checked else constants.CheckState.Unchecked,
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def isChecked(self, col: int) -> bool:
                                                                                                                                                                                                                                                                                                                  return self.checkState(col) == constants.CheckState.Checked
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_children(
                                                                                                                                                                                                                                                                                                                  self, recursive: bool = False
                                                                                                                                                                                                                                                                                                              ) -> listdelegators.ListDelegator[QtWidgets.QTreeWidgetItem]:
                                                                                                                                                                                                                                                                                                                  """Get children of this item.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  recursive option is written iteratively to also support original QTreeWidgetItems.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if not recursive:
                                                                                                                                                                                                                                                                                                                      children = [self.child(i) for i in range(self.childCount())]
                                                                                                                                                                                                                                                                                                                      return listdelegators.ListDelegator([i for i in children if i is not None])
                                                                                                                                                                                                                                                                                                                  results = []
                                                                                                                                                                                                                                                                                                                  nodes = [self]
                                                                                                                                                                                                                                                                                                                  while nodes:
                                                                                                                                                                                                                                                                                                                      items = []
                                                                                                                                                                                                                                                                                                                      for node in nodes:
                                                                                                                                                                                                                                                                                                                          results.append(node)
                                                                                                                                                                                                                                                                                                                          items.extend(node.child(i) for i in range(node.childCount()))
                                                                                                                                                                                                                                                                                                                      nodes = items
                                                                                                                                                                                                                                                                                                                  return listdelegators.ListDelegator(results[1:])
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def collapse(self, recursive: bool = False):
                                                                                                                                                                                                                                                                                                                  if recursive:
                                                                                                                                                                                                                                                                                                                      for i in range(self.childCount()):
                                                                                                                                                                                                                                                                                                                          if isinstance(child := self.child(i), TreeWidgetItem):
                                                                                                                                                                                                                                                                                                                              child.collapse(True)
                                                                                                                                                                                                                                                                                                                  self.setExpanded(False)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def expand(self, recursive: bool = False):
                                                                                                                                                                                                                                                                                                                  self.setExpanded(True)
                                                                                                                                                                                                                                                                                                                  if recursive:
                                                                                                                                                                                                                                                                                                                      for i in range(self.childCount()):
                                                                                                                                                                                                                                                                                                                          if isinstance(child := self.child(i), TreeWidgetItem):
                                                                                                                                                                                                                                                                                                                              child.expand(True)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_size_hint(self, hint: datatypes.SizeType, column: int = 0):
                                                                                                                                                                                                                                                                                                                  self.setSizeHint(column, datatypes.to_size(hint))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def sort_children(self, column: int, descending: bool = False):
                                                                                                                                                                                                                                                                                                                  order = constants.DESCENDING if descending else constants.ASCENDING
                                                                                                                                                                                                                                                                                                                  self.sortChildren(column, order)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_data(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  data: Any,
                                                                                                                                                                                                                                                                                                                  role: constants.ItemDataRoleStr | constants.ItemDataRole | int,
                                                                                                                                                                                                                                                                                                                  column: int = 0,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  if isinstance(role, str):
                                                                                                                                                                                                                                                                                                                      role = constants.ITEM_DATA_ROLE[role]
                                                                                                                                                                                                                                                                                                                  super().setData(column, role, data)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_data(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  role: constants.ItemDataRoleStr | constants.ItemDataRole | int,
                                                                                                                                                                                                                                                                                                                  column: int = 0,
                                                                                                                                                                                                                                                                                                              ) -> Any:
                                                                                                                                                                                                                                                                                                                  if isinstance(role, str):
                                                                                                                                                                                                                                                                                                                      role = constants.ITEM_DATA_ROLE[role]
                                                                                                                                                                                                                                                                                                                  return super().data(column, role)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_icon(self, icon: datatypes.IconType, column: int = 0):
                                                                                                                                                                                                                                                                                                                  """Set the icon for the action.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      icon: icon to use
                                                                                                                                                                                                                                                                                                                      column: column
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  icon = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                                  self.setIcon(column, icon)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_background(self, column: int = 0) -> gui.Brush:
                                                                                                                                                                                                                                                                                                                  return gui.Brush(self.background(column))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_foreground(self, column: int = 0) -> gui.Brush:
                                                                                                                                                                                                                                                                                                                  return gui.Brush(self.foreground(column))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_font(self, column: int = 0) -> gui.Font:
                                                                                                                                                                                                                                                                                                                  return gui.Font(self.font(column))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_icon(self, column: int = 0) -> gui.Icon | None:
                                                                                                                                                                                                                                                                                                                  return None if (icon := self.icon(column)).isNull() else gui.Icon(icon)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_checkstate(
                                                                                                                                                                                                                                                                                                                  self, state: constants.CheckStateStr | constants.CheckState, column: int = 0
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set checkstate of the checkbox.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      state: checkstate to use
                                                                                                                                                                                                                                                                                                                      column: column
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setCheckState(column, constants.CHECK_STATE.get_enum_value(state))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_checkstate(self, column: int = 0) -> constants.CheckStateStr:
                                                                                                                                                                                                                                                                                                                  """Return checkstate.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      column: column
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      checkstate
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.CHECK_STATE.inverse[self.checkState(column)]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_child_indicator_policy(
                                                                                                                                                                                                                                                                                                                  self, policy: ChildIndicatorPolicyStr | mod.ChildIndicatorPolicy
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the child indicator policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      policy: child indicator policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setChildIndicatorPolicy(CHILD_INDICATOR_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_child_indicator_policy(self) -> ChildIndicatorPolicyStr:
                                                                                                                                                                                                                                                                                                                  """Return current child indicator policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      child indicator policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return CHILD_INDICATOR_POLICY.inverse[self.childIndicatorPolicy()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_text_alignment(self, column: int) -> constants.AlignmentStr:
                                                                                                                                                                                                                                                                                                                  return constants.ALIGNMENTS.inverse[
                                                                                                                                                                                                                                                                                                                      constants.AlignmentFlag(self.textAlignment(column))
                                                                                                                                                                                                                                                                                                                  ]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_checkstate(column: int = 0) -> constants.CheckStateStr

                                                                                                                                                                                                                                                                                                          Return checkstate.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          column int

                                                                                                                                                                                                                                                                                                          column

                                                                                                                                                                                                                                                                                                          0
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/treewidgetitem.py
                                                                                                                                                                                                                                                                                                          def get_checkstate(self, column: int = 0) -> constants.CheckStateStr:
                                                                                                                                                                                                                                                                                                              """Return checkstate.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  column: column
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  checkstate
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.CHECK_STATE.inverse[self.checkState(column)]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_child_indicator_policy() -> ChildIndicatorPolicyStr

                                                                                                                                                                                                                                                                                                          Return current child indicator policy.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/treewidgetitem.py
                                                                                                                                                                                                                                                                                                          def get_child_indicator_policy(self) -> ChildIndicatorPolicyStr:
                                                                                                                                                                                                                                                                                                              """Return current child indicator policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  child indicator policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return CHILD_INDICATOR_POLICY.inverse[self.childIndicatorPolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_children(recursive: bool = False) -> listdelegators.ListDelegator[QtWidgets.QTreeWidgetItem]

                                                                                                                                                                                                                                                                                                          Get children of this item.

                                                                                                                                                                                                                                                                                                          recursive option is written iteratively to also support original QTreeWidgetItems.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/treewidgetitem.py
                                                                                                                                                                                                                                                                                                          def get_children(
                                                                                                                                                                                                                                                                                                              self, recursive: bool = False
                                                                                                                                                                                                                                                                                                          ) -> listdelegators.ListDelegator[QtWidgets.QTreeWidgetItem]:
                                                                                                                                                                                                                                                                                                              """Get children of this item.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              recursive option is written iteratively to also support original QTreeWidgetItems.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if not recursive:
                                                                                                                                                                                                                                                                                                                  children = [self.child(i) for i in range(self.childCount())]
                                                                                                                                                                                                                                                                                                                  return listdelegators.ListDelegator([i for i in children if i is not None])
                                                                                                                                                                                                                                                                                                              results = []
                                                                                                                                                                                                                                                                                                              nodes = [self]
                                                                                                                                                                                                                                                                                                              while nodes:
                                                                                                                                                                                                                                                                                                                  items = []
                                                                                                                                                                                                                                                                                                                  for node in nodes:
                                                                                                                                                                                                                                                                                                                      results.append(node)
                                                                                                                                                                                                                                                                                                                      items.extend(node.child(i) for i in range(node.childCount()))
                                                                                                                                                                                                                                                                                                                  nodes = items
                                                                                                                                                                                                                                                                                                              return listdelegators.ListDelegator(results[1:])
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_checkstate(state: constants.CheckStateStr | constants.CheckState, column: int = 0)

                                                                                                                                                                                                                                                                                                          Set checkstate of the checkbox.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          state CheckStateStr | CheckState

                                                                                                                                                                                                                                                                                                          checkstate to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          column int

                                                                                                                                                                                                                                                                                                          column

                                                                                                                                                                                                                                                                                                          0
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/treewidgetitem.py
                                                                                                                                                                                                                                                                                                          def set_checkstate(
                                                                                                                                                                                                                                                                                                              self, state: constants.CheckStateStr | constants.CheckState, column: int = 0
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set checkstate of the checkbox.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  state: checkstate to use
                                                                                                                                                                                                                                                                                                                  column: column
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setCheckState(column, constants.CHECK_STATE.get_enum_value(state))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_child_indicator_policy(policy: ChildIndicatorPolicyStr | mod.ChildIndicatorPolicy)

                                                                                                                                                                                                                                                                                                          Set the child indicator policy.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          policy ChildIndicatorPolicyStr | ChildIndicatorPolicy

                                                                                                                                                                                                                                                                                                          child indicator policy

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/treewidgetitem.py
                                                                                                                                                                                                                                                                                                          def set_child_indicator_policy(
                                                                                                                                                                                                                                                                                                              self, policy: ChildIndicatorPolicyStr | mod.ChildIndicatorPolicy
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the child indicator policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  policy: child indicator policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setChildIndicatorPolicy(CHILD_INDICATOR_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_icon(icon: datatypes.IconType, column: int = 0)

                                                                                                                                                                                                                                                                                                          Set the icon for the action.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          icon IconType

                                                                                                                                                                                                                                                                                                          icon to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          column int

                                                                                                                                                                                                                                                                                                          column

                                                                                                                                                                                                                                                                                                          0
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/treewidgetitem.py
                                                                                                                                                                                                                                                                                                          def set_icon(self, icon: datatypes.IconType, column: int = 0):
                                                                                                                                                                                                                                                                                                              """Set the icon for the action.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  icon: icon to use
                                                                                                                                                                                                                                                                                                                  column: column
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              icon = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                              self.setIcon(column, icon)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          UndoView

                                                                                                                                                                                                                                                                                                          Bases: ListViewMixin, QUndoView

                                                                                                                                                                                                                                                                                                          Displays the contents of a QUndoStack.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/undoview.py
                                                                                                                                                                                                                                                                                                          class UndoView(widgets.ListViewMixin, widgets.QUndoView):
                                                                                                                                                                                                                                                                                                              """Displays the contents of a QUndoStack."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def __getitem__(self, index: int) -> gui.QUndoCommand:
                                                                                                                                                                                                                                                                                                                  return self.stack().command(index)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_clean_icon(self, icon: datatypes.IconType):
                                                                                                                                                                                                                                                                                                                  """Set the icon for the clean button.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      icon: icon to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  icon = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                                  self.setCleanIcon(icon)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_value(self, value: gui.QUndoGroup | gui.QUndoStack):
                                                                                                                                                                                                                                                                                                                  if isinstance(value, gui.QUndoGroup):
                                                                                                                                                                                                                                                                                                                      self.setGroup(value)
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.setStack(value)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_clean_icon(icon: datatypes.IconType)

                                                                                                                                                                                                                                                                                                          Set the icon for the clean button.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          icon IconType

                                                                                                                                                                                                                                                                                                          icon to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/undoview.py
                                                                                                                                                                                                                                                                                                          def set_clean_icon(self, icon: datatypes.IconType):
                                                                                                                                                                                                                                                                                                              """Set the icon for the clean button.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  icon: icon to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              icon = iconprovider.get_icon(icon)
                                                                                                                                                                                                                                                                                                              self.setCleanIcon(icon)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          VBoxLayout

                                                                                                                                                                                                                                                                                                          Bases: BoxLayoutMixin, QVBoxLayout

                                                                                                                                                                                                                                                                                                          Lines up widgets vertically.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/vboxlayout.py
                                                                                                                                                                                                                                                                                                          4
                                                                                                                                                                                                                                                                                                          5
                                                                                                                                                                                                                                                                                                          6
                                                                                                                                                                                                                                                                                                          7
                                                                                                                                                                                                                                                                                                          class VBoxLayout(widgets.boxlayout.BoxLayoutMixin, widgets.QVBoxLayout):
                                                                                                                                                                                                                                                                                                              """Lines up widgets vertically."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              ID = "vertical"
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          WhatsThis

                                                                                                                                                                                                                                                                                                          Bases: QWhatsThis

                                                                                                                                                                                                                                                                                                          Simple description of any widget, i.e. answering the question "What's This?".

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/whatsthis.py
                                                                                                                                                                                                                                                                                                          class WhatsThis(QtWidgets.QWhatsThis):
                                                                                                                                                                                                                                                                                                              """Simple description of any widget, i.e. answering the question "What's This?"."""
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              @contextlib.contextmanager
                                                                                                                                                                                                                                                                                                              def enter_mode(cls):
                                                                                                                                                                                                                                                                                                                  cls.enterWhatsThisMode()
                                                                                                                                                                                                                                                                                                                  yield cls
                                                                                                                                                                                                                                                                                                                  cls.leaveWhatsThisMode()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Widget

                                                                                                                                                                                                                                                                                                          Bases: WidgetMixin, QWidget

                                                                                                                                                                                                                                                                                                          The base class of all user interface objects.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          class Widget(WidgetMixin, widgets.QWidget):
                                                                                                                                                                                                                                                                                                              """The base class of all user interface objects."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          WidgetItem

                                                                                                                                                                                                                                                                                                          Bases: LayoutItemMixin, QWidgetItem

                                                                                                                                                                                                                                                                                                          Layout item that represents a widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widgetitem.py
                                                                                                                                                                                                                                                                                                          class WidgetItem(widgets.LayoutItemMixin, widgets.QWidgetItem):
                                                                                                                                                                                                                                                                                                              """Layout item that represents a widget."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          WidgetMixin

                                                                                                                                                                                                                                                                                                          Bases: ObjectMixin, PaintDeviceMixin, _WidgetBase

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                            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
                                                                                                                                                                                                                                                                                                           552
                                                                                                                                                                                                                                                                                                           553
                                                                                                                                                                                                                                                                                                           554
                                                                                                                                                                                                                                                                                                           555
                                                                                                                                                                                                                                                                                                           556
                                                                                                                                                                                                                                                                                                           557
                                                                                                                                                                                                                                                                                                           558
                                                                                                                                                                                                                                                                                                           559
                                                                                                                                                                                                                                                                                                           560
                                                                                                                                                                                                                                                                                                           561
                                                                                                                                                                                                                                                                                                           562
                                                                                                                                                                                                                                                                                                           563
                                                                                                                                                                                                                                                                                                           564
                                                                                                                                                                                                                                                                                                           565
                                                                                                                                                                                                                                                                                                           566
                                                                                                                                                                                                                                                                                                           567
                                                                                                                                                                                                                                                                                                           568
                                                                                                                                                                                                                                                                                                           569
                                                                                                                                                                                                                                                                                                           570
                                                                                                                                                                                                                                                                                                           571
                                                                                                                                                                                                                                                                                                           572
                                                                                                                                                                                                                                                                                                           573
                                                                                                                                                                                                                                                                                                           574
                                                                                                                                                                                                                                                                                                           575
                                                                                                                                                                                                                                                                                                           576
                                                                                                                                                                                                                                                                                                           577
                                                                                                                                                                                                                                                                                                           578
                                                                                                                                                                                                                                                                                                           579
                                                                                                                                                                                                                                                                                                           580
                                                                                                                                                                                                                                                                                                           581
                                                                                                                                                                                                                                                                                                           582
                                                                                                                                                                                                                                                                                                           583
                                                                                                                                                                                                                                                                                                           584
                                                                                                                                                                                                                                                                                                           585
                                                                                                                                                                                                                                                                                                           586
                                                                                                                                                                                                                                                                                                           587
                                                                                                                                                                                                                                                                                                           588
                                                                                                                                                                                                                                                                                                           589
                                                                                                                                                                                                                                                                                                           590
                                                                                                                                                                                                                                                                                                           591
                                                                                                                                                                                                                                                                                                           592
                                                                                                                                                                                                                                                                                                           593
                                                                                                                                                                                                                                                                                                           594
                                                                                                                                                                                                                                                                                                           595
                                                                                                                                                                                                                                                                                                           596
                                                                                                                                                                                                                                                                                                           597
                                                                                                                                                                                                                                                                                                           598
                                                                                                                                                                                                                                                                                                           599
                                                                                                                                                                                                                                                                                                           600
                                                                                                                                                                                                                                                                                                           601
                                                                                                                                                                                                                                                                                                           602
                                                                                                                                                                                                                                                                                                           603
                                                                                                                                                                                                                                                                                                           604
                                                                                                                                                                                                                                                                                                           605
                                                                                                                                                                                                                                                                                                           606
                                                                                                                                                                                                                                                                                                           607
                                                                                                                                                                                                                                                                                                           608
                                                                                                                                                                                                                                                                                                           609
                                                                                                                                                                                                                                                                                                           610
                                                                                                                                                                                                                                                                                                           611
                                                                                                                                                                                                                                                                                                           612
                                                                                                                                                                                                                                                                                                           613
                                                                                                                                                                                                                                                                                                           614
                                                                                                                                                                                                                                                                                                           615
                                                                                                                                                                                                                                                                                                           616
                                                                                                                                                                                                                                                                                                           617
                                                                                                                                                                                                                                                                                                           618
                                                                                                                                                                                                                                                                                                           619
                                                                                                                                                                                                                                                                                                           620
                                                                                                                                                                                                                                                                                                           621
                                                                                                                                                                                                                                                                                                           622
                                                                                                                                                                                                                                                                                                           623
                                                                                                                                                                                                                                                                                                           624
                                                                                                                                                                                                                                                                                                           625
                                                                                                                                                                                                                                                                                                           626
                                                                                                                                                                                                                                                                                                           627
                                                                                                                                                                                                                                                                                                           628
                                                                                                                                                                                                                                                                                                           629
                                                                                                                                                                                                                                                                                                           630
                                                                                                                                                                                                                                                                                                           631
                                                                                                                                                                                                                                                                                                           632
                                                                                                                                                                                                                                                                                                           633
                                                                                                                                                                                                                                                                                                           634
                                                                                                                                                                                                                                                                                                           635
                                                                                                                                                                                                                                                                                                           636
                                                                                                                                                                                                                                                                                                           637
                                                                                                                                                                                                                                                                                                           638
                                                                                                                                                                                                                                                                                                           639
                                                                                                                                                                                                                                                                                                           640
                                                                                                                                                                                                                                                                                                           641
                                                                                                                                                                                                                                                                                                           642
                                                                                                                                                                                                                                                                                                           643
                                                                                                                                                                                                                                                                                                           644
                                                                                                                                                                                                                                                                                                           645
                                                                                                                                                                                                                                                                                                           646
                                                                                                                                                                                                                                                                                                           647
                                                                                                                                                                                                                                                                                                           648
                                                                                                                                                                                                                                                                                                           649
                                                                                                                                                                                                                                                                                                           650
                                                                                                                                                                                                                                                                                                           651
                                                                                                                                                                                                                                                                                                           652
                                                                                                                                                                                                                                                                                                           653
                                                                                                                                                                                                                                                                                                           654
                                                                                                                                                                                                                                                                                                           655
                                                                                                                                                                                                                                                                                                           656
                                                                                                                                                                                                                                                                                                           657
                                                                                                                                                                                                                                                                                                           658
                                                                                                                                                                                                                                                                                                           659
                                                                                                                                                                                                                                                                                                           660
                                                                                                                                                                                                                                                                                                           661
                                                                                                                                                                                                                                                                                                           662
                                                                                                                                                                                                                                                                                                           663
                                                                                                                                                                                                                                                                                                           664
                                                                                                                                                                                                                                                                                                           665
                                                                                                                                                                                                                                                                                                           666
                                                                                                                                                                                                                                                                                                           667
                                                                                                                                                                                                                                                                                                           668
                                                                                                                                                                                                                                                                                                           669
                                                                                                                                                                                                                                                                                                           670
                                                                                                                                                                                                                                                                                                           671
                                                                                                                                                                                                                                                                                                           672
                                                                                                                                                                                                                                                                                                           673
                                                                                                                                                                                                                                                                                                           674
                                                                                                                                                                                                                                                                                                           675
                                                                                                                                                                                                                                                                                                           676
                                                                                                                                                                                                                                                                                                           677
                                                                                                                                                                                                                                                                                                           678
                                                                                                                                                                                                                                                                                                           679
                                                                                                                                                                                                                                                                                                           680
                                                                                                                                                                                                                                                                                                           681
                                                                                                                                                                                                                                                                                                           682
                                                                                                                                                                                                                                                                                                           683
                                                                                                                                                                                                                                                                                                           684
                                                                                                                                                                                                                                                                                                           685
                                                                                                                                                                                                                                                                                                           686
                                                                                                                                                                                                                                                                                                           687
                                                                                                                                                                                                                                                                                                           688
                                                                                                                                                                                                                                                                                                           689
                                                                                                                                                                                                                                                                                                           690
                                                                                                                                                                                                                                                                                                           691
                                                                                                                                                                                                                                                                                                           692
                                                                                                                                                                                                                                                                                                           693
                                                                                                                                                                                                                                                                                                           694
                                                                                                                                                                                                                                                                                                           695
                                                                                                                                                                                                                                                                                                           696
                                                                                                                                                                                                                                                                                                           697
                                                                                                                                                                                                                                                                                                           698
                                                                                                                                                                                                                                                                                                           699
                                                                                                                                                                                                                                                                                                           700
                                                                                                                                                                                                                                                                                                           701
                                                                                                                                                                                                                                                                                                           702
                                                                                                                                                                                                                                                                                                           703
                                                                                                                                                                                                                                                                                                           704
                                                                                                                                                                                                                                                                                                           705
                                                                                                                                                                                                                                                                                                           706
                                                                                                                                                                                                                                                                                                           707
                                                                                                                                                                                                                                                                                                           708
                                                                                                                                                                                                                                                                                                           709
                                                                                                                                                                                                                                                                                                           710
                                                                                                                                                                                                                                                                                                           711
                                                                                                                                                                                                                                                                                                           712
                                                                                                                                                                                                                                                                                                           713
                                                                                                                                                                                                                                                                                                           714
                                                                                                                                                                                                                                                                                                           715
                                                                                                                                                                                                                                                                                                           716
                                                                                                                                                                                                                                                                                                           717
                                                                                                                                                                                                                                                                                                           718
                                                                                                                                                                                                                                                                                                           719
                                                                                                                                                                                                                                                                                                           720
                                                                                                                                                                                                                                                                                                           721
                                                                                                                                                                                                                                                                                                           722
                                                                                                                                                                                                                                                                                                           723
                                                                                                                                                                                                                                                                                                           724
                                                                                                                                                                                                                                                                                                           725
                                                                                                                                                                                                                                                                                                           726
                                                                                                                                                                                                                                                                                                           727
                                                                                                                                                                                                                                                                                                           728
                                                                                                                                                                                                                                                                                                           729
                                                                                                                                                                                                                                                                                                           730
                                                                                                                                                                                                                                                                                                           731
                                                                                                                                                                                                                                                                                                           732
                                                                                                                                                                                                                                                                                                           733
                                                                                                                                                                                                                                                                                                           734
                                                                                                                                                                                                                                                                                                           735
                                                                                                                                                                                                                                                                                                           736
                                                                                                                                                                                                                                                                                                           737
                                                                                                                                                                                                                                                                                                           738
                                                                                                                                                                                                                                                                                                           739
                                                                                                                                                                                                                                                                                                           740
                                                                                                                                                                                                                                                                                                           741
                                                                                                                                                                                                                                                                                                           742
                                                                                                                                                                                                                                                                                                           743
                                                                                                                                                                                                                                                                                                           744
                                                                                                                                                                                                                                                                                                           745
                                                                                                                                                                                                                                                                                                           746
                                                                                                                                                                                                                                                                                                           747
                                                                                                                                                                                                                                                                                                           748
                                                                                                                                                                                                                                                                                                           749
                                                                                                                                                                                                                                                                                                           750
                                                                                                                                                                                                                                                                                                           751
                                                                                                                                                                                                                                                                                                           752
                                                                                                                                                                                                                                                                                                           753
                                                                                                                                                                                                                                                                                                           754
                                                                                                                                                                                                                                                                                                           755
                                                                                                                                                                                                                                                                                                           756
                                                                                                                                                                                                                                                                                                           757
                                                                                                                                                                                                                                                                                                           758
                                                                                                                                                                                                                                                                                                           759
                                                                                                                                                                                                                                                                                                           760
                                                                                                                                                                                                                                                                                                           761
                                                                                                                                                                                                                                                                                                           762
                                                                                                                                                                                                                                                                                                           763
                                                                                                                                                                                                                                                                                                           764
                                                                                                                                                                                                                                                                                                           765
                                                                                                                                                                                                                                                                                                           766
                                                                                                                                                                                                                                                                                                           767
                                                                                                                                                                                                                                                                                                           768
                                                                                                                                                                                                                                                                                                           769
                                                                                                                                                                                                                                                                                                           770
                                                                                                                                                                                                                                                                                                           771
                                                                                                                                                                                                                                                                                                           772
                                                                                                                                                                                                                                                                                                           773
                                                                                                                                                                                                                                                                                                           774
                                                                                                                                                                                                                                                                                                           775
                                                                                                                                                                                                                                                                                                           776
                                                                                                                                                                                                                                                                                                           777
                                                                                                                                                                                                                                                                                                           778
                                                                                                                                                                                                                                                                                                           779
                                                                                                                                                                                                                                                                                                           780
                                                                                                                                                                                                                                                                                                           781
                                                                                                                                                                                                                                                                                                           782
                                                                                                                                                                                                                                                                                                           783
                                                                                                                                                                                                                                                                                                           784
                                                                                                                                                                                                                                                                                                           785
                                                                                                                                                                                                                                                                                                           786
                                                                                                                                                                                                                                                                                                           787
                                                                                                                                                                                                                                                                                                           788
                                                                                                                                                                                                                                                                                                           789
                                                                                                                                                                                                                                                                                                           790
                                                                                                                                                                                                                                                                                                           791
                                                                                                                                                                                                                                                                                                           792
                                                                                                                                                                                                                                                                                                           793
                                                                                                                                                                                                                                                                                                           794
                                                                                                                                                                                                                                                                                                           795
                                                                                                                                                                                                                                                                                                           796
                                                                                                                                                                                                                                                                                                           797
                                                                                                                                                                                                                                                                                                           798
                                                                                                                                                                                                                                                                                                           799
                                                                                                                                                                                                                                                                                                           800
                                                                                                                                                                                                                                                                                                           801
                                                                                                                                                                                                                                                                                                           802
                                                                                                                                                                                                                                                                                                           803
                                                                                                                                                                                                                                                                                                           804
                                                                                                                                                                                                                                                                                                           805
                                                                                                                                                                                                                                                                                                           806
                                                                                                                                                                                                                                                                                                           807
                                                                                                                                                                                                                                                                                                           808
                                                                                                                                                                                                                                                                                                           809
                                                                                                                                                                                                                                                                                                           810
                                                                                                                                                                                                                                                                                                           811
                                                                                                                                                                                                                                                                                                           812
                                                                                                                                                                                                                                                                                                           813
                                                                                                                                                                                                                                                                                                           814
                                                                                                                                                                                                                                                                                                           815
                                                                                                                                                                                                                                                                                                           816
                                                                                                                                                                                                                                                                                                           817
                                                                                                                                                                                                                                                                                                           818
                                                                                                                                                                                                                                                                                                           819
                                                                                                                                                                                                                                                                                                           820
                                                                                                                                                                                                                                                                                                           821
                                                                                                                                                                                                                                                                                                           822
                                                                                                                                                                                                                                                                                                           823
                                                                                                                                                                                                                                                                                                           824
                                                                                                                                                                                                                                                                                                           825
                                                                                                                                                                                                                                                                                                           826
                                                                                                                                                                                                                                                                                                           827
                                                                                                                                                                                                                                                                                                           828
                                                                                                                                                                                                                                                                                                           829
                                                                                                                                                                                                                                                                                                           830
                                                                                                                                                                                                                                                                                                           831
                                                                                                                                                                                                                                                                                                           832
                                                                                                                                                                                                                                                                                                           833
                                                                                                                                                                                                                                                                                                           834
                                                                                                                                                                                                                                                                                                           835
                                                                                                                                                                                                                                                                                                           836
                                                                                                                                                                                                                                                                                                           837
                                                                                                                                                                                                                                                                                                           838
                                                                                                                                                                                                                                                                                                           839
                                                                                                                                                                                                                                                                                                           840
                                                                                                                                                                                                                                                                                                           841
                                                                                                                                                                                                                                                                                                           842
                                                                                                                                                                                                                                                                                                           843
                                                                                                                                                                                                                                                                                                           844
                                                                                                                                                                                                                                                                                                           845
                                                                                                                                                                                                                                                                                                           846
                                                                                                                                                                                                                                                                                                           847
                                                                                                                                                                                                                                                                                                           848
                                                                                                                                                                                                                                                                                                           849
                                                                                                                                                                                                                                                                                                           850
                                                                                                                                                                                                                                                                                                           851
                                                                                                                                                                                                                                                                                                           852
                                                                                                                                                                                                                                                                                                           853
                                                                                                                                                                                                                                                                                                           854
                                                                                                                                                                                                                                                                                                           855
                                                                                                                                                                                                                                                                                                           856
                                                                                                                                                                                                                                                                                                           857
                                                                                                                                                                                                                                                                                                           858
                                                                                                                                                                                                                                                                                                           859
                                                                                                                                                                                                                                                                                                           860
                                                                                                                                                                                                                                                                                                           861
                                                                                                                                                                                                                                                                                                           862
                                                                                                                                                                                                                                                                                                           863
                                                                                                                                                                                                                                                                                                           864
                                                                                                                                                                                                                                                                                                           865
                                                                                                                                                                                                                                                                                                           866
                                                                                                                                                                                                                                                                                                           867
                                                                                                                                                                                                                                                                                                           868
                                                                                                                                                                                                                                                                                                           869
                                                                                                                                                                                                                                                                                                           870
                                                                                                                                                                                                                                                                                                           871
                                                                                                                                                                                                                                                                                                           872
                                                                                                                                                                                                                                                                                                           873
                                                                                                                                                                                                                                                                                                           874
                                                                                                                                                                                                                                                                                                           875
                                                                                                                                                                                                                                                                                                           876
                                                                                                                                                                                                                                                                                                           877
                                                                                                                                                                                                                                                                                                           878
                                                                                                                                                                                                                                                                                                           879
                                                                                                                                                                                                                                                                                                           880
                                                                                                                                                                                                                                                                                                           881
                                                                                                                                                                                                                                                                                                           882
                                                                                                                                                                                                                                                                                                           883
                                                                                                                                                                                                                                                                                                           884
                                                                                                                                                                                                                                                                                                           885
                                                                                                                                                                                                                                                                                                           886
                                                                                                                                                                                                                                                                                                           887
                                                                                                                                                                                                                                                                                                           888
                                                                                                                                                                                                                                                                                                           889
                                                                                                                                                                                                                                                                                                           890
                                                                                                                                                                                                                                                                                                           891
                                                                                                                                                                                                                                                                                                           892
                                                                                                                                                                                                                                                                                                           893
                                                                                                                                                                                                                                                                                                           894
                                                                                                                                                                                                                                                                                                           895
                                                                                                                                                                                                                                                                                                           896
                                                                                                                                                                                                                                                                                                           897
                                                                                                                                                                                                                                                                                                           898
                                                                                                                                                                                                                                                                                                           899
                                                                                                                                                                                                                                                                                                           900
                                                                                                                                                                                                                                                                                                           901
                                                                                                                                                                                                                                                                                                           902
                                                                                                                                                                                                                                                                                                           903
                                                                                                                                                                                                                                                                                                           904
                                                                                                                                                                                                                                                                                                           905
                                                                                                                                                                                                                                                                                                           906
                                                                                                                                                                                                                                                                                                           907
                                                                                                                                                                                                                                                                                                           908
                                                                                                                                                                                                                                                                                                           909
                                                                                                                                                                                                                                                                                                           910
                                                                                                                                                                                                                                                                                                           911
                                                                                                                                                                                                                                                                                                           912
                                                                                                                                                                                                                                                                                                           913
                                                                                                                                                                                                                                                                                                           914
                                                                                                                                                                                                                                                                                                           915
                                                                                                                                                                                                                                                                                                           916
                                                                                                                                                                                                                                                                                                           917
                                                                                                                                                                                                                                                                                                           918
                                                                                                                                                                                                                                                                                                           919
                                                                                                                                                                                                                                                                                                           920
                                                                                                                                                                                                                                                                                                           921
                                                                                                                                                                                                                                                                                                           922
                                                                                                                                                                                                                                                                                                           923
                                                                                                                                                                                                                                                                                                           924
                                                                                                                                                                                                                                                                                                           925
                                                                                                                                                                                                                                                                                                           926
                                                                                                                                                                                                                                                                                                           927
                                                                                                                                                                                                                                                                                                           928
                                                                                                                                                                                                                                                                                                           929
                                                                                                                                                                                                                                                                                                           930
                                                                                                                                                                                                                                                                                                           931
                                                                                                                                                                                                                                                                                                           932
                                                                                                                                                                                                                                                                                                           933
                                                                                                                                                                                                                                                                                                           934
                                                                                                                                                                                                                                                                                                           935
                                                                                                                                                                                                                                                                                                           936
                                                                                                                                                                                                                                                                                                           937
                                                                                                                                                                                                                                                                                                           938
                                                                                                                                                                                                                                                                                                           939
                                                                                                                                                                                                                                                                                                           940
                                                                                                                                                                                                                                                                                                           941
                                                                                                                                                                                                                                                                                                           942
                                                                                                                                                                                                                                                                                                           943
                                                                                                                                                                                                                                                                                                           944
                                                                                                                                                                                                                                                                                                           945
                                                                                                                                                                                                                                                                                                           946
                                                                                                                                                                                                                                                                                                           947
                                                                                                                                                                                                                                                                                                           948
                                                                                                                                                                                                                                                                                                           949
                                                                                                                                                                                                                                                                                                           950
                                                                                                                                                                                                                                                                                                           951
                                                                                                                                                                                                                                                                                                           952
                                                                                                                                                                                                                                                                                                           953
                                                                                                                                                                                                                                                                                                           954
                                                                                                                                                                                                                                                                                                           955
                                                                                                                                                                                                                                                                                                           956
                                                                                                                                                                                                                                                                                                           957
                                                                                                                                                                                                                                                                                                           958
                                                                                                                                                                                                                                                                                                           959
                                                                                                                                                                                                                                                                                                           960
                                                                                                                                                                                                                                                                                                           961
                                                                                                                                                                                                                                                                                                           962
                                                                                                                                                                                                                                                                                                           963
                                                                                                                                                                                                                                                                                                           964
                                                                                                                                                                                                                                                                                                           965
                                                                                                                                                                                                                                                                                                           966
                                                                                                                                                                                                                                                                                                           967
                                                                                                                                                                                                                                                                                                           968
                                                                                                                                                                                                                                                                                                           969
                                                                                                                                                                                                                                                                                                           970
                                                                                                                                                                                                                                                                                                           971
                                                                                                                                                                                                                                                                                                           972
                                                                                                                                                                                                                                                                                                           973
                                                                                                                                                                                                                                                                                                           974
                                                                                                                                                                                                                                                                                                           975
                                                                                                                                                                                                                                                                                                           976
                                                                                                                                                                                                                                                                                                           977
                                                                                                                                                                                                                                                                                                           978
                                                                                                                                                                                                                                                                                                           979
                                                                                                                                                                                                                                                                                                           980
                                                                                                                                                                                                                                                                                                           981
                                                                                                                                                                                                                                                                                                           982
                                                                                                                                                                                                                                                                                                           983
                                                                                                                                                                                                                                                                                                           984
                                                                                                                                                                                                                                                                                                           985
                                                                                                                                                                                                                                                                                                           986
                                                                                                                                                                                                                                                                                                           987
                                                                                                                                                                                                                                                                                                           988
                                                                                                                                                                                                                                                                                                           989
                                                                                                                                                                                                                                                                                                           990
                                                                                                                                                                                                                                                                                                           991
                                                                                                                                                                                                                                                                                                           992
                                                                                                                                                                                                                                                                                                           993
                                                                                                                                                                                                                                                                                                           994
                                                                                                                                                                                                                                                                                                           995
                                                                                                                                                                                                                                                                                                           996
                                                                                                                                                                                                                                                                                                           997
                                                                                                                                                                                                                                                                                                           998
                                                                                                                                                                                                                                                                                                           999
                                                                                                                                                                                                                                                                                                          1000
                                                                                                                                                                                                                                                                                                          1001
                                                                                                                                                                                                                                                                                                          1002
                                                                                                                                                                                                                                                                                                          1003
                                                                                                                                                                                                                                                                                                          1004
                                                                                                                                                                                                                                                                                                          1005
                                                                                                                                                                                                                                                                                                          1006
                                                                                                                                                                                                                                                                                                          1007
                                                                                                                                                                                                                                                                                                          1008
                                                                                                                                                                                                                                                                                                          1009
                                                                                                                                                                                                                                                                                                          1010
                                                                                                                                                                                                                                                                                                          1011
                                                                                                                                                                                                                                                                                                          1012
                                                                                                                                                                                                                                                                                                          1013
                                                                                                                                                                                                                                                                                                          1014
                                                                                                                                                                                                                                                                                                          1015
                                                                                                                                                                                                                                                                                                          1016
                                                                                                                                                                                                                                                                                                          1017
                                                                                                                                                                                                                                                                                                          1018
                                                                                                                                                                                                                                                                                                          1019
                                                                                                                                                                                                                                                                                                          1020
                                                                                                                                                                                                                                                                                                          1021
                                                                                                                                                                                                                                                                                                          1022
                                                                                                                                                                                                                                                                                                          1023
                                                                                                                                                                                                                                                                                                          1024
                                                                                                                                                                                                                                                                                                          1025
                                                                                                                                                                                                                                                                                                          1026
                                                                                                                                                                                                                                                                                                          1027
                                                                                                                                                                                                                                                                                                          1028
                                                                                                                                                                                                                                                                                                          1029
                                                                                                                                                                                                                                                                                                          1030
                                                                                                                                                                                                                                                                                                          1031
                                                                                                                                                                                                                                                                                                          1032
                                                                                                                                                                                                                                                                                                          1033
                                                                                                                                                                                                                                                                                                          1034
                                                                                                                                                                                                                                                                                                          1035
                                                                                                                                                                                                                                                                                                          1036
                                                                                                                                                                                                                                                                                                          1037
                                                                                                                                                                                                                                                                                                          1038
                                                                                                                                                                                                                                                                                                          1039
                                                                                                                                                                                                                                                                                                          1040
                                                                                                                                                                                                                                                                                                          1041
                                                                                                                                                                                                                                                                                                          1042
                                                                                                                                                                                                                                                                                                          1043
                                                                                                                                                                                                                                                                                                          1044
                                                                                                                                                                                                                                                                                                          1045
                                                                                                                                                                                                                                                                                                          1046
                                                                                                                                                                                                                                                                                                          1047
                                                                                                                                                                                                                                                                                                          1048
                                                                                                                                                                                                                                                                                                          1049
                                                                                                                                                                                                                                                                                                          1050
                                                                                                                                                                                                                                                                                                          1051
                                                                                                                                                                                                                                                                                                          1052
                                                                                                                                                                                                                                                                                                          1053
                                                                                                                                                                                                                                                                                                          1054
                                                                                                                                                                                                                                                                                                          1055
                                                                                                                                                                                                                                                                                                          1056
                                                                                                                                                                                                                                                                                                          1057
                                                                                                                                                                                                                                                                                                          1058
                                                                                                                                                                                                                                                                                                          1059
                                                                                                                                                                                                                                                                                                          1060
                                                                                                                                                                                                                                                                                                          1061
                                                                                                                                                                                                                                                                                                          1062
                                                                                                                                                                                                                                                                                                          1063
                                                                                                                                                                                                                                                                                                          1064
                                                                                                                                                                                                                                                                                                          1065
                                                                                                                                                                                                                                                                                                          1066
                                                                                                                                                                                                                                                                                                          1067
                                                                                                                                                                                                                                                                                                          1068
                                                                                                                                                                                                                                                                                                          1069
                                                                                                                                                                                                                                                                                                          1070
                                                                                                                                                                                                                                                                                                          1071
                                                                                                                                                                                                                                                                                                          1072
                                                                                                                                                                                                                                                                                                          1073
                                                                                                                                                                                                                                                                                                          1074
                                                                                                                                                                                                                                                                                                          1075
                                                                                                                                                                                                                                                                                                          1076
                                                                                                                                                                                                                                                                                                          1077
                                                                                                                                                                                                                                                                                                          1078
                                                                                                                                                                                                                                                                                                          1079
                                                                                                                                                                                                                                                                                                          1080
                                                                                                                                                                                                                                                                                                          1081
                                                                                                                                                                                                                                                                                                          1082
                                                                                                                                                                                                                                                                                                          1083
                                                                                                                                                                                                                                                                                                          1084
                                                                                                                                                                                                                                                                                                          1085
                                                                                                                                                                                                                                                                                                          1086
                                                                                                                                                                                                                                                                                                          1087
                                                                                                                                                                                                                                                                                                          1088
                                                                                                                                                                                                                                                                                                          1089
                                                                                                                                                                                                                                                                                                          1090
                                                                                                                                                                                                                                                                                                          1091
                                                                                                                                                                                                                                                                                                          1092
                                                                                                                                                                                                                                                                                                          1093
                                                                                                                                                                                                                                                                                                          1094
                                                                                                                                                                                                                                                                                                          1095
                                                                                                                                                                                                                                                                                                          1096
                                                                                                                                                                                                                                                                                                          1097
                                                                                                                                                                                                                                                                                                          1098
                                                                                                                                                                                                                                                                                                          1099
                                                                                                                                                                                                                                                                                                          1100
                                                                                                                                                                                                                                                                                                          1101
                                                                                                                                                                                                                                                                                                          1102
                                                                                                                                                                                                                                                                                                          1103
                                                                                                                                                                                                                                                                                                          1104
                                                                                                                                                                                                                                                                                                          1105
                                                                                                                                                                                                                                                                                                          1106
                                                                                                                                                                                                                                                                                                          1107
                                                                                                                                                                                                                                                                                                          1108
                                                                                                                                                                                                                                                                                                          1109
                                                                                                                                                                                                                                                                                                          1110
                                                                                                                                                                                                                                                                                                          1111
                                                                                                                                                                                                                                                                                                          1112
                                                                                                                                                                                                                                                                                                          1113
                                                                                                                                                                                                                                                                                                          1114
                                                                                                                                                                                                                                                                                                          1115
                                                                                                                                                                                                                                                                                                          1116
                                                                                                                                                                                                                                                                                                          1117
                                                                                                                                                                                                                                                                                                          1118
                                                                                                                                                                                                                                                                                                          1119
                                                                                                                                                                                                                                                                                                          1120
                                                                                                                                                                                                                                                                                                          1121
                                                                                                                                                                                                                                                                                                          1122
                                                                                                                                                                                                                                                                                                          1123
                                                                                                                                                                                                                                                                                                          1124
                                                                                                                                                                                                                                                                                                          1125
                                                                                                                                                                                                                                                                                                          1126
                                                                                                                                                                                                                                                                                                          1127
                                                                                                                                                                                                                                                                                                          1128
                                                                                                                                                                                                                                                                                                          1129
                                                                                                                                                                                                                                                                                                          1130
                                                                                                                                                                                                                                                                                                          1131
                                                                                                                                                                                                                                                                                                          1132
                                                                                                                                                                                                                                                                                                          1133
                                                                                                                                                                                                                                                                                                          1134
                                                                                                                                                                                                                                                                                                          1135
                                                                                                                                                                                                                                                                                                          1136
                                                                                                                                                                                                                                                                                                          1137
                                                                                                                                                                                                                                                                                                          1138
                                                                                                                                                                                                                                                                                                          1139
                                                                                                                                                                                                                                                                                                          1140
                                                                                                                                                                                                                                                                                                          1141
                                                                                                                                                                                                                                                                                                          1142
                                                                                                                                                                                                                                                                                                          1143
                                                                                                                                                                                                                                                                                                          1144
                                                                                                                                                                                                                                                                                                          1145
                                                                                                                                                                                                                                                                                                          1146
                                                                                                                                                                                                                                                                                                          1147
                                                                                                                                                                                                                                                                                                          1148
                                                                                                                                                                                                                                                                                                          1149
                                                                                                                                                                                                                                                                                                          1150
                                                                                                                                                                                                                                                                                                          1151
                                                                                                                                                                                                                                                                                                          1152
                                                                                                                                                                                                                                                                                                          1153
                                                                                                                                                                                                                                                                                                          1154
                                                                                                                                                                                                                                                                                                          1155
                                                                                                                                                                                                                                                                                                          1156
                                                                                                                                                                                                                                                                                                          1157
                                                                                                                                                                                                                                                                                                          1158
                                                                                                                                                                                                                                                                                                          1159
                                                                                                                                                                                                                                                                                                          1160
                                                                                                                                                                                                                                                                                                          1161
                                                                                                                                                                                                                                                                                                          1162
                                                                                                                                                                                                                                                                                                          1163
                                                                                                                                                                                                                                                                                                          1164
                                                                                                                                                                                                                                                                                                          1165
                                                                                                                                                                                                                                                                                                          1166
                                                                                                                                                                                                                                                                                                          1167
                                                                                                                                                                                                                                                                                                          1168
                                                                                                                                                                                                                                                                                                          1169
                                                                                                                                                                                                                                                                                                          1170
                                                                                                                                                                                                                                                                                                          1171
                                                                                                                                                                                                                                                                                                          1172
                                                                                                                                                                                                                                                                                                          1173
                                                                                                                                                                                                                                                                                                          1174
                                                                                                                                                                                                                                                                                                          1175
                                                                                                                                                                                                                                                                                                          1176
                                                                                                                                                                                                                                                                                                          1177
                                                                                                                                                                                                                                                                                                          1178
                                                                                                                                                                                                                                                                                                          1179
                                                                                                                                                                                                                                                                                                          1180
                                                                                                                                                                                                                                                                                                          1181
                                                                                                                                                                                                                                                                                                          1182
                                                                                                                                                                                                                                                                                                          1183
                                                                                                                                                                                                                                                                                                          1184
                                                                                                                                                                                                                                                                                                          1185
                                                                                                                                                                                                                                                                                                          1186
                                                                                                                                                                                                                                                                                                          1187
                                                                                                                                                                                                                                                                                                          1188
                                                                                                                                                                                                                                                                                                          1189
                                                                                                                                                                                                                                                                                                          1190
                                                                                                                                                                                                                                                                                                          1191
                                                                                                                                                                                                                                                                                                          1192
                                                                                                                                                                                                                                                                                                          1193
                                                                                                                                                                                                                                                                                                          1194
                                                                                                                                                                                                                                                                                                          1195
                                                                                                                                                                                                                                                                                                          1196
                                                                                                                                                                                                                                                                                                          1197
                                                                                                                                                                                                                                                                                                          1198
                                                                                                                                                                                                                                                                                                          1199
                                                                                                                                                                                                                                                                                                          1200
                                                                                                                                                                                                                                                                                                          1201
                                                                                                                                                                                                                                                                                                          1202
                                                                                                                                                                                                                                                                                                          1203
                                                                                                                                                                                                                                                                                                          1204
                                                                                                                                                                                                                                                                                                          1205
                                                                                                                                                                                                                                                                                                          1206
                                                                                                                                                                                                                                                                                                          1207
                                                                                                                                                                                                                                                                                                          1208
                                                                                                                                                                                                                                                                                                          1209
                                                                                                                                                                                                                                                                                                          1210
                                                                                                                                                                                                                                                                                                          1211
                                                                                                                                                                                                                                                                                                          1212
                                                                                                                                                                                                                                                                                                          1213
                                                                                                                                                                                                                                                                                                          1214
                                                                                                                                                                                                                                                                                                          1215
                                                                                                                                                                                                                                                                                                          1216
                                                                                                                                                                                                                                                                                                          1217
                                                                                                                                                                                                                                                                                                          1218
                                                                                                                                                                                                                                                                                                          1219
                                                                                                                                                                                                                                                                                                          1220
                                                                                                                                                                                                                                                                                                          1221
                                                                                                                                                                                                                                                                                                          1222
                                                                                                                                                                                                                                                                                                          1223
                                                                                                                                                                                                                                                                                                          1224
                                                                                                                                                                                                                                                                                                          1225
                                                                                                                                                                                                                                                                                                          1226
                                                                                                                                                                                                                                                                                                          1227
                                                                                                                                                                                                                                                                                                          1228
                                                                                                                                                                                                                                                                                                          1229
                                                                                                                                                                                                                                                                                                          1230
                                                                                                                                                                                                                                                                                                          1231
                                                                                                                                                                                                                                                                                                          1232
                                                                                                                                                                                                                                                                                                          1233
                                                                                                                                                                                                                                                                                                          1234
                                                                                                                                                                                                                                                                                                          1235
                                                                                                                                                                                                                                                                                                          1236
                                                                                                                                                                                                                                                                                                          1237
                                                                                                                                                                                                                                                                                                          1238
                                                                                                                                                                                                                                                                                                          class WidgetMixin(core.ObjectMixin, gui.PaintDeviceMixin, _WidgetBase):
                                                                                                                                                                                                                                                                                                              def __init__(self, *args, margin: int | None = None, **kwargs):
                                                                                                                                                                                                                                                                                                                  super().__init__(*args, **kwargs)
                                                                                                                                                                                                                                                                                                                  self.fx = animations.Fx(self)
                                                                                                                                                                                                                                                                                                                  if margin is not None:
                                                                                                                                                                                                                                                                                                                      self.set_margin(margin)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                              def setup_example(cls):
                                                                                                                                                                                                                                                                                                                  return cls()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def _get_map(self):
                                                                                                                                                                                                                                                                                                                  maps = super()._get_map()
                                                                                                                                                                                                                                                                                                                  maps |= {
                                                                                                                                                                                                                                                                                                                      "contextMenuPolicy": constants.CONTEXT_POLICY,
                                                                                                                                                                                                                                                                                                                      "focusPolicy": constants.FOCUS_POLICY,
                                                                                                                                                                                                                                                                                                                      "layoutDirection": constants.LAYOUT_DIRECTION,
                                                                                                                                                                                                                                                                                                                      "windowModality": constants.WINDOW_MODALITY,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  return maps
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_shortcut(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  keysequence: datatypes.KeyCombinationType,
                                                                                                                                                                                                                                                                                                                  *,
                                                                                                                                                                                                                                                                                                                  callback: Callable | None = None,
                                                                                                                                                                                                                                                                                                                  context: constants.ShortcutContextStr = "window",
                                                                                                                                                                                                                                                                                                              ) -> gui.Shortcut:
                                                                                                                                                                                                                                                                                                                  """Add shortcut to widget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Adds as shortcut for given callback and context to this widget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      keysequence: Key sequence
                                                                                                                                                                                                                                                                                                                      callback: Callback for the shortcut
                                                                                                                                                                                                                                                                                                                      context: context for this shortcut
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      shortcut object
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return gui.Shortcut(
                                                                                                                                                                                                                                                                                                                      datatypes.to_keysequence(keysequence),
                                                                                                                                                                                                                                                                                                                      self,
                                                                                                                                                                                                                                                                                                                      callback,
                                                                                                                                                                                                                                                                                                                      context=constants.SHORTCUT_CONTEXT.get_enum_value(context),
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_win_id(self) -> int:
                                                                                                                                                                                                                                                                                                                  return int(self.winId())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def resize(self, *size):
                                                                                                                                                                                                                                                                                                                  if isinstance(size[0], tuple):
                                                                                                                                                                                                                                                                                                                      super().resize(*size[0])
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      super().resize(*size)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_width(self, width: int):
                                                                                                                                                                                                                                                                                                                  self.resize(width, self.height())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_height(self, height: int):
                                                                                                                                                                                                                                                                                                                  self.resize(self.width(), height)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_enabled(self, enabled: bool = True) -> None:
                                                                                                                                                                                                                                                                                                                  self.setEnabled(enabled)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_disabled(self) -> None:
                                                                                                                                                                                                                                                                                                                  self.setEnabled(False)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def insertAction(self, position_or_action: int | gui.QAction, action: gui.QAction):
                                                                                                                                                                                                                                                                                                                  """Extend insertAction to also allow int index."""
                                                                                                                                                                                                                                                                                                                  if isinstance(position_or_action, int):
                                                                                                                                                                                                                                                                                                                      actions = self.actions()
                                                                                                                                                                                                                                                                                                                      if len(actions) == 0 or position_or_action >= len(actions):
                                                                                                                                                                                                                                                                                                                          # Insert as the first action or the last action.
                                                                                                                                                                                                                                                                                                                          return super().addAction(action)
                                                                                                                                                                                                                                                                                                                      position_or_action = actions[position_or_action]
                                                                                                                                                                                                                                                                                                                  super().insertAction(position_or_action, action)
                                                                                                                                                                                                                                                                                                                  return None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_action(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  text: str | gui.Action,
                                                                                                                                                                                                                                                                                                                  *,
                                                                                                                                                                                                                                                                                                                  parent: widgets.QWidget | None = None,
                                                                                                                                                                                                                                                                                                                  data: Any = None,
                                                                                                                                                                                                                                                                                                                  callback: Callable | None = None,
                                                                                                                                                                                                                                                                                                                  **kwargs: Any,
                                                                                                                                                                                                                                                                                                              ) -> gui.Action:
                                                                                                                                                                                                                                                                                                                  """Add an action to the menu.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      text: Label for the action
                                                                                                                                                                                                                                                                                                                      parent: parent
                                                                                                                                                                                                                                                                                                                      data: data for the Action
                                                                                                                                                                                                                                                                                                                      callback: callback to be called when action is triggered
                                                                                                                                                                                                                                                                                                                      kwargs: kwargs passed to action ctor
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      Action added to menu
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if isinstance(text, str):
                                                                                                                                                                                                                                                                                                                      action = gui.Action(
                                                                                                                                                                                                                                                                                                                          parent=parent or self,
                                                                                                                                                                                                                                                                                                                          text=text,
                                                                                                                                                                                                                                                                                                                          callback=callback,
                                                                                                                                                                                                                                                                                                                          **kwargs,
                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      action = text
                                                                                                                                                                                                                                                                                                                      action.setParent(self)
                                                                                                                                                                                                                                                                                                                  self.addAction(action)
                                                                                                                                                                                                                                                                                                                  action.setData(data)
                                                                                                                                                                                                                                                                                                                  return action
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def add_actions(self, actions: Sequence[gui.QAction]):
                                                                                                                                                                                                                                                                                                                  for i in actions:
                                                                                                                                                                                                                                                                                                                      i.setParent(self)
                                                                                                                                                                                                                                                                                                                  self.addActions(actions)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def toggle_fullscreen(self) -> bool:
                                                                                                                                                                                                                                                                                                                  """Toggle between fullscreen and regular size."""
                                                                                                                                                                                                                                                                                                                  if self.isFullScreen():
                                                                                                                                                                                                                                                                                                                      self.showNormal()
                                                                                                                                                                                                                                                                                                                      return False
                                                                                                                                                                                                                                                                                                                  self.showFullScreen()
                                                                                                                                                                                                                                                                                                                  return True
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def toggle_maximized(self) -> bool:
                                                                                                                                                                                                                                                                                                                  """Toggle between maximized and regular size."""
                                                                                                                                                                                                                                                                                                                  if self.isMaximized():
                                                                                                                                                                                                                                                                                                                      self.showNormal()
                                                                                                                                                                                                                                                                                                                      return False
                                                                                                                                                                                                                                                                                                                  self.showMaximized()
                                                                                                                                                                                                                                                                                                                  return True
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def map_to(  # noqa: PLR0911
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  widget: widgets.QWidget | Literal["global", "parent", "window"],
                                                                                                                                                                                                                                                                                                                  pos_or_rect: (
                                                                                                                                                                                                                                                                                                                      datatypes.PointType
                                                                                                                                                                                                                                                                                                                      | datatypes.RectType
                                                                                                                                                                                                                                                                                                                      | datatypes.PointFType
                                                                                                                                                                                                                                                                                                                      | datatypes.RectFType
                                                                                                                                                                                                                                                                                                                  ),
                                                                                                                                                                                                                                                                                                              ) -> core.QRect | core.QRectF | core.QPoint | core.QPointF:
                                                                                                                                                                                                                                                                                                                  """Map a point or rect to a widget, global position or parent.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Arguments:
                                                                                                                                                                                                                                                                                                                      widget: What to map to.
                                                                                                                                                                                                                                                                                                                      pos_or_rect: Point or rect to map.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  match pos_or_rect:
                                                                                                                                                                                                                                                                                                                      case int(), int():
                                                                                                                                                                                                                                                                                                                          pos_or_rect = core.QPoint(*pos_or_rect)
                                                                                                                                                                                                                                                                                                                      case float(), float():
                                                                                                                                                                                                                                                                                                                          pos_or_rect = core.QPointF(*pos_or_rect)
                                                                                                                                                                                                                                                                                                                      case int(), int(), int(), int():
                                                                                                                                                                                                                                                                                                                          pos_or_rect = core.QRect(*pos_or_rect)
                                                                                                                                                                                                                                                                                                                      case float(), float(), float(), float():
                                                                                                                                                                                                                                                                                                                          pos_or_rect = core.QRectF(*pos_or_rect)
                                                                                                                                                                                                                                                                                                                  match pos_or_rect, widget:
                                                                                                                                                                                                                                                                                                                      case core.QRect() | core.QRectF(), widgets.QWidget():
                                                                                                                                                                                                                                                                                                                          top_left = super().mapTo(widget, pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                          bottom_right = super().mapTo(widget, pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                          return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                      case core.QPoint() | core.QPointF(), widgets.QWidget():
                                                                                                                                                                                                                                                                                                                          return super().mapTo(widget, pos_or_rect)
                                                                                                                                                                                                                                                                                                                      case core.QRect() | core.QRectF(), "parent":
                                                                                                                                                                                                                                                                                                                          top_left = super().mapToParent(pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                          bottom_right = super().mapToParent(pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                          return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                      case core.QPoint() | core.QPointF(), "parent":
                                                                                                                                                                                                                                                                                                                          return super().mapToParent(pos_or_rect)
                                                                                                                                                                                                                                                                                                                      case core.QRect() | core.QRectF(), "window":
                                                                                                                                                                                                                                                                                                                          top_left = super().mapTo(self.window(), pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                          bottom_right = super().mapTo(self.window(), pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                          return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                      case core.QPoint() | core.QPointF(), "window":
                                                                                                                                                                                                                                                                                                                          return super().mapTo(self.window(), pos_or_rect)
                                                                                                                                                                                                                                                                                                                      case core.QRect() | core.QRectF(), "global":
                                                                                                                                                                                                                                                                                                                          top_left = super().mapToGlobal(pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                          bottom_right = super().mapToGlobal(pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                          return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                      case core.QPoint() | core.QPointF(), "global":
                                                                                                                                                                                                                                                                                                                          return super().mapToGlobal(pos_or_rect)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise ValueError(pos_or_rect)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def map_from(  # noqa: PLR0911
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  widget: widgets.QWidget | Literal["global", "parent", "window"],
                                                                                                                                                                                                                                                                                                                  pos_or_rect: (
                                                                                                                                                                                                                                                                                                                      datatypes.PointType
                                                                                                                                                                                                                                                                                                                      | datatypes.RectType
                                                                                                                                                                                                                                                                                                                      | datatypes.PointFType
                                                                                                                                                                                                                                                                                                                      | datatypes.RectFType
                                                                                                                                                                                                                                                                                                                  ),
                                                                                                                                                                                                                                                                                                              ) -> core.QRect | core.QRectF | core.QPoint | core.QPointF:
                                                                                                                                                                                                                                                                                                                  """Map a point or rect from a widget, global position or parent.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Arguments:
                                                                                                                                                                                                                                                                                                                      widget: What to map from.
                                                                                                                                                                                                                                                                                                                      pos_or_rect: Point or rect to map.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  match pos_or_rect:
                                                                                                                                                                                                                                                                                                                      case int(), int():
                                                                                                                                                                                                                                                                                                                          pos_or_rect = core.QPoint(*pos_or_rect)
                                                                                                                                                                                                                                                                                                                      case float(), float():
                                                                                                                                                                                                                                                                                                                          pos_or_rect = core.QPointF(*pos_or_rect)
                                                                                                                                                                                                                                                                                                                      case int(), int(), int(), int():
                                                                                                                                                                                                                                                                                                                          pos_or_rect = core.QRect(*pos_or_rect)
                                                                                                                                                                                                                                                                                                                      case float(), float(), float(), float():
                                                                                                                                                                                                                                                                                                                          pos_or_rect = core.QRectF(*pos_or_rect)
                                                                                                                                                                                                                                                                                                                  match pos_or_rect, widget:
                                                                                                                                                                                                                                                                                                                      case core.QRect() | core.QRectF(), widgets.QWidget():
                                                                                                                                                                                                                                                                                                                          top_left = super().mapFrom(widget, pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                          bottom_right = super().mapFrom(widget, pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                          return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                      case core.QPoint() | core.QPointF(), widgets.QWidget():
                                                                                                                                                                                                                                                                                                                          return super().mapFrom(widget, pos_or_rect)
                                                                                                                                                                                                                                                                                                                      case core.QRect() | core.QRectF(), "parent":
                                                                                                                                                                                                                                                                                                                          top_left = super().mapFromParent(pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                          bottom_right = super().mapFromParent(pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                          return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                      case core.QPoint() | core.QPointF(), "parent":
                                                                                                                                                                                                                                                                                                                          return super().mapFromParent(pos_or_rect)
                                                                                                                                                                                                                                                                                                                      case core.QRect() | core.QRectF(), "window":
                                                                                                                                                                                                                                                                                                                          top_left = super().mapFrom(self.window(), pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                          bottom_right = super().mapFrom(self.window(), pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                          return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                      case core.QPoint() | core.QPointF(), "window":
                                                                                                                                                                                                                                                                                                                          return super().mapFrom(self.window(), pos_or_rect)
                                                                                                                                                                                                                                                                                                                      case core.QRect() | core.QRectF(), "global":
                                                                                                                                                                                                                                                                                                                          top_left = super().mapFromGlobal(pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                          bottom_right = super().mapFromGlobal(pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                          return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                      case core.QPoint() | core.QPointF(), "global":
                                                                                                                                                                                                                                                                                                                          return super().mapFromGlobal(pos_or_rect)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise ValueError(pos_or_rect)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def raise_to_top(self):
                                                                                                                                                                                                                                                                                                                  """Brings a widget to top with all means available."""
                                                                                                                                                                                                                                                                                                                  if sys.platform.startswith("win"):
                                                                                                                                                                                                                                                                                                                      from prettyqt.utils.platforms.windows import misc
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                      misc.raise_to_top(self.winId())
                                                                                                                                                                                                                                                                                                                  # state = (self.windowState() & ~Qt.WindowMinimized) | Qt.WindowActive
                                                                                                                                                                                                                                                                                                                  # self.setWindowState(state)
                                                                                                                                                                                                                                                                                                                  self.raise_()
                                                                                                                                                                                                                                                                                                                  self.show()
                                                                                                                                                                                                                                                                                                                  self.activateWindow()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_icon(self, icon: datatypes.IconType):
                                                                                                                                                                                                                                                                                                                  """Set the window icon.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      icon: icon to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  color = gui.guiapplication.get_window_icon_color()
                                                                                                                                                                                                                                                                                                                  icon = iconprovider.get_icon(icon, color=color)
                                                                                                                                                                                                                                                                                                                  super().setWindowIcon(icon)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              setWindowIcon = set_icon  # noqa: N815
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_icon(self) -> gui.Icon | None:
                                                                                                                                                                                                                                                                                                                  """Get the window icon (returns None if not existing)."""
                                                                                                                                                                                                                                                                                                                  icon = super().windowIcon()
                                                                                                                                                                                                                                                                                                                  return None if icon.isNull() else gui.Icon(icon)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def show_tooltip(self, duration: int | None = None):
                                                                                                                                                                                                                                                                                                                  """Show the tooltip of this widget for given time.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  When no duration is given, it will get calculated based on length.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if duration is None:
                                                                                                                                                                                                                                                                                                                      duration = -1  # automatic
                                                                                                                                                                                                                                                                                                                  pos = self.mapToGlobal(core.QPoint(0, 0))
                                                                                                                                                                                                                                                                                                                  widgets.ToolTip.showText(pos, self.toolTip(), msecShowTime=duration)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              # lets be gentle and allow all reasonable signatures for the size setters.
                                                                                                                                                                                                                                                                                                              # tuples as well as passing two args is possible.
                                                                                                                                                                                                                                                                                                              @functools.singledispatchmethod
                                                                                                                                                                                                                                                                                                              def set_min_size(self, size: core.QSize | tuple[int | None, int | None]):
                                                                                                                                                                                                                                                                                                                  match size:
                                                                                                                                                                                                                                                                                                                      case int() | None as x, int() | None as y:
                                                                                                                                                                                                                                                                                                                          super().setMinimumSize(x or 0, y or 0)
                                                                                                                                                                                                                                                                                                                      case core.QSize():
                                                                                                                                                                                                                                                                                                                          super().setMinimumSize(size)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise TypeError(size)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              setMinimumSize = set_min_size  # noqa: N815
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @set_min_size.register
                                                                                                                                                                                                                                                                                                              def _(self, x: int, y: int | None):
                                                                                                                                                                                                                                                                                                                  self.set_min_size((x, y))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @set_min_size.register  # these can be merged when min py version is 3.11
                                                                                                                                                                                                                                                                                                              def _(self, x: None, y: int | None):
                                                                                                                                                                                                                                                                                                                  self.set_min_size((x, y))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @functools.singledispatchmethod
                                                                                                                                                                                                                                                                                                              def set_max_size(self, size: core.QSize | tuple[int | None, int | None]):
                                                                                                                                                                                                                                                                                                                  match size:
                                                                                                                                                                                                                                                                                                                      case int() | None as x, int() | None as y:
                                                                                                                                                                                                                                                                                                                          x = QWIDGETSIZE_MAX if x is None else x
                                                                                                                                                                                                                                                                                                                          y = QWIDGETSIZE_MAX if y is None else y
                                                                                                                                                                                                                                                                                                                          super().setMaximumSize(x, y)
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          super().setMaximumSize(size)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              setMaximumSize = set_min_size  # noqa: N815
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @set_max_size.register
                                                                                                                                                                                                                                                                                                              def _(self, x: int, y: int | None):
                                                                                                                                                                                                                                                                                                                  self.set_max_size((x, y))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @set_max_size.register  # these can be merged when min py version is 3.11
                                                                                                                                                                                                                                                                                                              def _(self, x: None, y: int | None):
                                                                                                                                                                                                                                                                                                                  self.set_max_size((x, y))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_min_width(self, width: int | None):
                                                                                                                                                                                                                                                                                                                  super().setMinimumWidth(width or 0)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              setMinimumWidth = set_min_width  # noqa: N815
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_max_width(self, width: int | None):
                                                                                                                                                                                                                                                                                                                  if width is None:
                                                                                                                                                                                                                                                                                                                      width = QWIDGETSIZE_MAX
                                                                                                                                                                                                                                                                                                                  super().setMaximumWidth(width)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              setMaximumWidth = set_max_width  # noqa: N815
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_min_height(self, height: int | None):
                                                                                                                                                                                                                                                                                                                  super().setMinimumHeight(height or 0)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              setMinimumHeight = set_min_height  # noqa: N815
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_max_height(self, height: int | None):
                                                                                                                                                                                                                                                                                                                  if height is None:
                                                                                                                                                                                                                                                                                                                      height = QWIDGETSIZE_MAX
                                                                                                                                                                                                                                                                                                                  super().setMaximumHeight(height)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              setMaximumHeight = set_max_height  # noqa: N815
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def setWindowTitle(self, title: str):
                                                                                                                                                                                                                                                                                                                  if not self.objectName() and widgets.application.is_debug():
                                                                                                                                                                                                                                                                                                                      self.setObjectName(title)
                                                                                                                                                                                                                                                                                                                  super().setWindowTitle(title)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_title(self, title: str):
                                                                                                                                                                                                                                                                                                                  self.setWindowTitle(title)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_title(self) -> str:
                                                                                                                                                                                                                                                                                                                  return self.windowTitle()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_tooltip(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  tooltip: str | datatypes.PathType,
                                                                                                                                                                                                                                                                                                                  *,
                                                                                                                                                                                                                                                                                                                  size: datatypes.SizeType | None = None,
                                                                                                                                                                                                                                                                                                                  rich_text: bool = False,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set a tooltip for this widget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  In image can get displayed by passing a PathLike object.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if isinstance(tooltip, os.PathLike):
                                                                                                                                                                                                                                                                                                                      path = os.fspath(tooltip)
                                                                                                                                                                                                                                                                                                                      if size is None:
                                                                                                                                                                                                                                                                                                                          tooltip = f"<img src={path!r}>"
                                                                                                                                                                                                                                                                                                                      else:
                                                                                                                                                                                                                                                                                                                          qsize = datatypes.to_size(size)
                                                                                                                                                                                                                                                                                                                          w, h = qsize.width(), qsize.height()
                                                                                                                                                                                                                                                                                                                          tooltip = f'<img src={path!r} width="{w}" height="{h}">'
                                                                                                                                                                                                                                                                                                                  tooltip = tooltip.replace("\n", "<br/>")
                                                                                                                                                                                                                                                                                                                  if rich_text:
                                                                                                                                                                                                                                                                                                                      tooltip = f"<html>{html.escape(tooltip)}</html>"
                                                                                                                                                                                                                                                                                                                  super().setToolTip(tooltip)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_font(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  font_name: gui.QFont | str | None = None,
                                                                                                                                                                                                                                                                                                                  *,
                                                                                                                                                                                                                                                                                                                  font_size: int | None = None,
                                                                                                                                                                                                                                                                                                                  weight: int | None = None,
                                                                                                                                                                                                                                                                                                                  italic: bool = False,
                                                                                                                                                                                                                                                                                                              ) -> gui.QFont:
                                                                                                                                                                                                                                                                                                                  """Set the font for this widget."""
                                                                                                                                                                                                                                                                                                                  if isinstance(font_name, gui.QFont):
                                                                                                                                                                                                                                                                                                                      super().setFont(font_name)
                                                                                                                                                                                                                                                                                                                      return font_name
                                                                                                                                                                                                                                                                                                                  if font_size is None:
                                                                                                                                                                                                                                                                                                                      font_size = -1
                                                                                                                                                                                                                                                                                                                  if weight is None:
                                                                                                                                                                                                                                                                                                                      weight = -1
                                                                                                                                                                                                                                                                                                                  if font_name is None:
                                                                                                                                                                                                                                                                                                                      font_name = self.font().family()
                                                                                                                                                                                                                                                                                                                  font = gui.Font(font_name, font_size, weight, italic)
                                                                                                                                                                                                                                                                                                                  super().setFont(font)
                                                                                                                                                                                                                                                                                                                  return font
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_font(self) -> gui.Font:
                                                                                                                                                                                                                                                                                                                  return gui.Font(self.font())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_foreground_role(self) -> gui.palette.RoleStr:
                                                                                                                                                                                                                                                                                                                  """Set foreground role for this widget."""
                                                                                                                                                                                                                                                                                                                  return gui.palette.ROLE.inverse[self.foregroundRole()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_foreground_role(self, role: gui.palette.RoleStr | gui.Palette.ColorRole):
                                                                                                                                                                                                                                                                                                                  """Set foreground role for this widget."""
                                                                                                                                                                                                                                                                                                                  self.setForegroundRole(gui.palette.ROLE.get_enum_value(role))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_background_role(self) -> gui.palette.RoleStr:
                                                                                                                                                                                                                                                                                                                  """Get background role for this widget."""
                                                                                                                                                                                                                                                                                                                  return gui.palette.ROLE.inverse[self.backgroundRole()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_background_role(self, role: gui.palette.RoleStr | gui.Palette.ColorRole):
                                                                                                                                                                                                                                                                                                                  """Get foreground role for this widget."""
                                                                                                                                                                                                                                                                                                                  self.setBackgroundRole(gui.palette.ROLE.get_enum_value(role))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_window_flags(self, *flags: constants.WindowTypeStr, append: bool = False):
                                                                                                                                                                                                                                                                                                                  result = constants.WINDOW_TYPE.merge_flags(flags)
                                                                                                                                                                                                                                                                                                                  if append:
                                                                                                                                                                                                                                                                                                                      result = result | self.windowFlags()
                                                                                                                                                                                                                                                                                                                  self.setWindowFlags(result)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_flags(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  *,
                                                                                                                                                                                                                                                                                                                  minimize: bool | None = None,
                                                                                                                                                                                                                                                                                                                  maximize: bool | None = None,
                                                                                                                                                                                                                                                                                                                  close: bool | None = None,
                                                                                                                                                                                                                                                                                                                  stay_on_top: bool | None = None,
                                                                                                                                                                                                                                                                                                                  frameless: bool | None = None,
                                                                                                                                                                                                                                                                                                                  window: bool | None = None,
                                                                                                                                                                                                                                                                                                                  dialog: bool | None = None,
                                                                                                                                                                                                                                                                                                                  tooltip: bool | None = None,
                                                                                                                                                                                                                                                                                                                  tool: bool | None = None,
                                                                                                                                                                                                                                                                                                                  customize: bool | None = None,
                                                                                                                                                                                                                                                                                                                  cover: bool | None = None,
                                                                                                                                                                                                                                                                                                                  window_title: bool | None = None,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set window flags.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Arguments:
                                                                                                                                                                                                                                                                                                                      minimize: set WindowMinimizeButtonHint flag
                                                                                                                                                                                                                                                                                                                      maximize: set WindowMaximizeButtonHint flag
                                                                                                                                                                                                                                                                                                                      close: set WindowCloseButtonHint flag
                                                                                                                                                                                                                                                                                                                      stay_on_top: set WindowStaysOnTopHint flag
                                                                                                                                                                                                                                                                                                                      frameless: set FramelessWindowHint flag
                                                                                                                                                                                                                                                                                                                      window: set Window flag
                                                                                                                                                                                                                                                                                                                      dialog: set Dialog flag
                                                                                                                                                                                                                                                                                                                      tooltip: set ToolTip flag
                                                                                                                                                                                                                                                                                                                      tool: set Tool flag
                                                                                                                                                                                                                                                                                                                      customize: set CustomizeWindowHint flag
                                                                                                                                                                                                                                                                                                                      cover: set CoverWindow flag
                                                                                                                                                                                                                                                                                                                      window_title: set WindowTitleHint flag
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  flags = {
                                                                                                                                                                                                                                                                                                                      constants.WindowType.WindowMinimizeButtonHint: minimize,
                                                                                                                                                                                                                                                                                                                      constants.WindowType.WindowMaximizeButtonHint: maximize,
                                                                                                                                                                                                                                                                                                                      constants.WindowType.WindowCloseButtonHint: close,
                                                                                                                                                                                                                                                                                                                      constants.WindowType.WindowStaysOnTopHint: stay_on_top,
                                                                                                                                                                                                                                                                                                                      constants.WindowType.FramelessWindowHint: frameless,
                                                                                                                                                                                                                                                                                                                      constants.WindowType.Window: window,
                                                                                                                                                                                                                                                                                                                      constants.WindowType.Dialog: dialog,
                                                                                                                                                                                                                                                                                                                      constants.WindowType.ToolTip: tooltip,
                                                                                                                                                                                                                                                                                                                      constants.WindowType.Tool: tool,
                                                                                                                                                                                                                                                                                                                      constants.WindowType.CustomizeWindowHint: customize,
                                                                                                                                                                                                                                                                                                                      constants.WindowType.CoverWindow: cover,
                                                                                                                                                                                                                                                                                                                      constants.WindowType.WindowTitleHint: window_title,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  for k, v in flags.items():
                                                                                                                                                                                                                                                                                                                      if v is not None:
                                                                                                                                                                                                                                                                                                                          self.setWindowFlag(k, v)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_attributes(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  *,
                                                                                                                                                                                                                                                                                                                  accept_drops: bool | None = None,
                                                                                                                                                                                                                                                                                                                  always_show_tooltips: bool | None = None,
                                                                                                                                                                                                                                                                                                                  custom_whats_this: bool | None = None,
                                                                                                                                                                                                                                                                                                                  delete_on_close: bool | None = None,
                                                                                                                                                                                                                                                                                                                  disabled: bool | None = None,
                                                                                                                                                                                                                                                                                                                  dont_show_on_screen: bool | None = None,
                                                                                                                                                                                                                                                                                                                  force_disabled: bool | None = None,
                                                                                                                                                                                                                                                                                                                  force_updates_disabled: bool | None = None,
                                                                                                                                                                                                                                                                                                                  hover: bool | None = None,
                                                                                                                                                                                                                                                                                                                  input_method_enabled: bool | None = None,
                                                                                                                                                                                                                                                                                                                  keyboard_focus_change: bool | None = None,
                                                                                                                                                                                                                                                                                                                  key_compression: bool | None = None,
                                                                                                                                                                                                                                                                                                                  layout_on_entire_rect: bool | None = None,
                                                                                                                                                                                                                                                                                                                  layout_uses_widget_rect: bool | None = None,
                                                                                                                                                                                                                                                                                                                  mapped: bool | None = None,
                                                                                                                                                                                                                                                                                                                  mouse_no_mask: bool | None = None,
                                                                                                                                                                                                                                                                                                                  mouse_tracking: bool | None = None,
                                                                                                                                                                                                                                                                                                                  moved: bool | None = None,
                                                                                                                                                                                                                                                                                                                  no_child_events_for_parent: bool | None = None,
                                                                                                                                                                                                                                                                                                                  no_child_events_from_children: bool | None = None,
                                                                                                                                                                                                                                                                                                                  no_mouse_replay: bool | None = None,
                                                                                                                                                                                                                                                                                                                  no_mouse_propagation: bool | None = None,
                                                                                                                                                                                                                                                                                                                  transparent_for_mouse_events: bool | None = None,
                                                                                                                                                                                                                                                                                                                  no_system_background: bool | None = None,
                                                                                                                                                                                                                                                                                                                  opaque_paint_event: bool | None = None,
                                                                                                                                                                                                                                                                                                                  outside_ws_range: bool | None = None,
                                                                                                                                                                                                                                                                                                                  paint_on_screen: bool | None = None,
                                                                                                                                                                                                                                                                                                                  paint_unclipped: bool | None = None,
                                                                                                                                                                                                                                                                                                                  pending_move_event: bool | None = None,
                                                                                                                                                                                                                                                                                                                  pending_resize_egent: bool | None = None,
                                                                                                                                                                                                                                                                                                                  quit_on_close: bool | None = None,
                                                                                                                                                                                                                                                                                                                  resized: bool | None = None,
                                                                                                                                                                                                                                                                                                                  right_to_left: bool | None = None,
                                                                                                                                                                                                                                                                                                                  set_cursor: bool | None = None,
                                                                                                                                                                                                                                                                                                                  set_font: bool | None = None,
                                                                                                                                                                                                                                                                                                                  set_palette: bool | None = None,
                                                                                                                                                                                                                                                                                                                  set_style: bool | None = None,
                                                                                                                                                                                                                                                                                                                  static_contents: bool | None = None,
                                                                                                                                                                                                                                                                                                                  style_sheet: bool | None = None,
                                                                                                                                                                                                                                                                                                                  style_sheet_target: bool | None = None,
                                                                                                                                                                                                                                                                                                                  tablet_tracking: bool | None = None,
                                                                                                                                                                                                                                                                                                                  translucent_background: bool | None = None,
                                                                                                                                                                                                                                                                                                                  under_mouse: bool | None = None,
                                                                                                                                                                                                                                                                                                                  updates_disabled: bool | None = None,
                                                                                                                                                                                                                                                                                                                  window_modified: bool | None = None,
                                                                                                                                                                                                                                                                                                                  window_propagation: bool | None = None,
                                                                                                                                                                                                                                                                                                                  mac_always_show_tool_window: bool | None = None,
                                                                                                                                                                                                                                                                                                                  set_locale: bool | None = None,
                                                                                                                                                                                                                                                                                                                  styled_background: bool | None = None,
                                                                                                                                                                                                                                                                                                                  show_without_activating: bool | None = None,
                                                                                                                                                                                                                                                                                                                  native_window: bool | None = None,
                                                                                                                                                                                                                                                                                                                  dont_create_native_ancestors: bool | None = None,
                                                                                                                                                                                                                                                                                                                  accept_touch_events: bool | None = None,
                                                                                                                                                                                                                                                                                                                  touch_pad_single_touch_events: bool | None = None,
                                                                                                                                                                                                                                                                                                                  always_stack_on_top: bool | None = None,
                                                                                                                                                                                                                                                                                                                  contents_margins_respects_safe_area: bool | None = None,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set window attributes.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Attributes:
                                                                                                                                                                                                                                                                                                                      accept_drops: set AcceptDrops attribute
                                                                                                                                                                                                                                                                                                                      always_show_tooltips: set AlwaysShowToolTips attribute
                                                                                                                                                                                                                                                                                                                      custom_whats_this: set CustomWhatsThis attribute
                                                                                                                                                                                                                                                                                                                      delete_on_close: set DeleteOnClose attribute
                                                                                                                                                                                                                                                                                                                      disabled: set Disabled attribute
                                                                                                                                                                                                                                                                                                                      dont_show_on_screen: set DontShowOnScreen attribute
                                                                                                                                                                                                                                                                                                                      force_disabled: set ForceDisabled attribute
                                                                                                                                                                                                                                                                                                                      force_updates_disabled: set ForceUpdatesDisabled attribute
                                                                                                                                                                                                                                                                                                                      hover: set Hover attribute
                                                                                                                                                                                                                                                                                                                      input_method_enabled: set InputMethodEnabled attribute
                                                                                                                                                                                                                                                                                                                      keyboard_focus_change: set KeyboardFocusChange attribute
                                                                                                                                                                                                                                                                                                                      key_compression: set KeyCompression attribute
                                                                                                                                                                                                                                                                                                                      layout_on_entire_rect: set LayoutOnEntireRect attribute
                                                                                                                                                                                                                                                                                                                      layout_uses_widget_rect: set LayoutUsesWidgetRect attribute
                                                                                                                                                                                                                                                                                                                      mapped: set Mapped attribute
                                                                                                                                                                                                                                                                                                                      mouse_no_mask: set MouseNoMask attribute
                                                                                                                                                                                                                                                                                                                      mouse_tracking: set MouseTracking attribute
                                                                                                                                                                                                                                                                                                                      moved: set Moved attribute
                                                                                                                                                                                                                                                                                                                      no_child_events_for_parent: set NoChildEventsForParent attribute
                                                                                                                                                                                                                                                                                                                      no_child_events_from_children: set NoChildEventsFromChildren attribute
                                                                                                                                                                                                                                                                                                                      no_mouse_replay: set NoMouseReplay attribute
                                                                                                                                                                                                                                                                                                                      no_mouse_propagation: set NoMousePropagation attribute
                                                                                                                                                                                                                                                                                                                      transparent_for_mouse_events: set TransparentForMouseEvents attribute
                                                                                                                                                                                                                                                                                                                      no_system_background: set NoSystemBackground attribute
                                                                                                                                                                                                                                                                                                                      opaque_paint_event: set OpaquePaintEvent attribute
                                                                                                                                                                                                                                                                                                                      outside_ws_range: set OutsideWSRange attribute
                                                                                                                                                                                                                                                                                                                      paint_on_screen: set PaintOnScreen attribute
                                                                                                                                                                                                                                                                                                                      paint_unclipped: set PaintUnclipped attribute
                                                                                                                                                                                                                                                                                                                      pending_move_event: set PendingMoveEvent attribute
                                                                                                                                                                                                                                                                                                                      pending_resize_egent: set PendingResizeEvent attribute
                                                                                                                                                                                                                                                                                                                      quit_on_close: set QuitOnClose attribute
                                                                                                                                                                                                                                                                                                                      resized: set Resized attribute
                                                                                                                                                                                                                                                                                                                      right_to_left: set RightToLeft attribute
                                                                                                                                                                                                                                                                                                                      set_cursor: set SetCursor attribute
                                                                                                                                                                                                                                                                                                                      set_font: set SetFont attribute
                                                                                                                                                                                                                                                                                                                      set_palette: set SetPalette attribute
                                                                                                                                                                                                                                                                                                                      set_style: set SetStyle attribute
                                                                                                                                                                                                                                                                                                                      static_contents: set StaticContents attribute
                                                                                                                                                                                                                                                                                                                      style_sheet: set StyleSheet attribute
                                                                                                                                                                                                                                                                                                                      style_sheet_target: set StyleSheetTarget attribute
                                                                                                                                                                                                                                                                                                                      tablet_tracking: set TabletTracking attribute
                                                                                                                                                                                                                                                                                                                      translucent_background: set TranslucentBackground attribute
                                                                                                                                                                                                                                                                                                                      under_mouse: set UnderMouse attribute
                                                                                                                                                                                                                                                                                                                      updates_disabled: set UpdatesDisabled attribute
                                                                                                                                                                                                                                                                                                                      window_modified: set WindowModified attribute
                                                                                                                                                                                                                                                                                                                      window_propagation: set WindowPropagation attribute
                                                                                                                                                                                                                                                                                                                      mac_always_show_tool_window: set MacAlwaysShowToolWindow attribute
                                                                                                                                                                                                                                                                                                                      set_locale: set SetLocale attribute
                                                                                                                                                                                                                                                                                                                      styled_background: set StyledBackground attribute
                                                                                                                                                                                                                                                                                                                      show_without_activating: set ShowWithoutActivating attribute
                                                                                                                                                                                                                                                                                                                      native_window: set NativeWindow attribute
                                                                                                                                                                                                                                                                                                                      dont_create_native_ancestors: set DontCreateNativeAncestors attribute
                                                                                                                                                                                                                                                                                                                      accept_touch_events: set AcceptTouchEvents attribute
                                                                                                                                                                                                                                                                                                                      touch_pad_single_touch_events: set TouchPadAcceptSingleTouchEvents attribute
                                                                                                                                                                                                                                                                                                                      always_stack_on_top: set AlwaysStackOnTop attribute
                                                                                                                                                                                                                                                                                                                      contents_margins_respects_safe_area: set ContentsMarginsRespectsSafeArea
                                                                                                                                                                                                                                                                                                                                                           attribute
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  Attr = constants.WidgetAttribute  # noqa: N806
                                                                                                                                                                                                                                                                                                                  flags = {
                                                                                                                                                                                                                                                                                                                      Attr.WA_AcceptDrops: accept_drops,
                                                                                                                                                                                                                                                                                                                      Attr.WA_AlwaysShowToolTips: always_show_tooltips,
                                                                                                                                                                                                                                                                                                                      Attr.WA_CustomWhatsThis: custom_whats_this,
                                                                                                                                                                                                                                                                                                                      Attr.WA_DeleteOnClose: delete_on_close,
                                                                                                                                                                                                                                                                                                                      Attr.WA_Disabled: disabled,
                                                                                                                                                                                                                                                                                                                      Attr.WA_DontShowOnScreen: dont_show_on_screen,
                                                                                                                                                                                                                                                                                                                      Attr.WA_ForceDisabled: force_disabled,
                                                                                                                                                                                                                                                                                                                      Attr.WA_ForceUpdatesDisabled: force_updates_disabled,
                                                                                                                                                                                                                                                                                                                      Attr.WA_Hover: hover,
                                                                                                                                                                                                                                                                                                                      Attr.WA_InputMethodEnabled: input_method_enabled,
                                                                                                                                                                                                                                                                                                                      Attr.WA_KeyboardFocusChange: keyboard_focus_change,
                                                                                                                                                                                                                                                                                                                      Attr.WA_KeyCompression: key_compression,
                                                                                                                                                                                                                                                                                                                      Attr.WA_LayoutOnEntireRect: layout_on_entire_rect,
                                                                                                                                                                                                                                                                                                                      Attr.WA_LayoutUsesWidgetRect: layout_uses_widget_rect,
                                                                                                                                                                                                                                                                                                                      Attr.WA_Mapped: mapped,
                                                                                                                                                                                                                                                                                                                      Attr.WA_MouseNoMask: mouse_no_mask,
                                                                                                                                                                                                                                                                                                                      Attr.WA_MouseTracking: mouse_tracking,
                                                                                                                                                                                                                                                                                                                      Attr.WA_Moved: moved,
                                                                                                                                                                                                                                                                                                                      Attr.WA_NoChildEventsForParent: no_child_events_for_parent,
                                                                                                                                                                                                                                                                                                                      Attr.WA_NoChildEventsFromChildren: no_child_events_from_children,
                                                                                                                                                                                                                                                                                                                      Attr.WA_NoMouseReplay: no_mouse_replay,
                                                                                                                                                                                                                                                                                                                      Attr.WA_NoMousePropagation: no_mouse_propagation,
                                                                                                                                                                                                                                                                                                                      Attr.WA_TransparentForMouseEvents: transparent_for_mouse_events,
                                                                                                                                                                                                                                                                                                                      Attr.WA_NoSystemBackground: no_system_background,
                                                                                                                                                                                                                                                                                                                      Attr.WA_OpaquePaintEvent: opaque_paint_event,
                                                                                                                                                                                                                                                                                                                      Attr.WA_OutsideWSRange: outside_ws_range,
                                                                                                                                                                                                                                                                                                                      Attr.WA_PaintOnScreen: paint_on_screen,
                                                                                                                                                                                                                                                                                                                      Attr.WA_PaintUnclipped: paint_unclipped,
                                                                                                                                                                                                                                                                                                                      Attr.WA_PendingMoveEvent: pending_move_event,
                                                                                                                                                                                                                                                                                                                      Attr.WA_PendingResizeEvent: pending_resize_egent,
                                                                                                                                                                                                                                                                                                                      Attr.WA_QuitOnClose: quit_on_close,
                                                                                                                                                                                                                                                                                                                      Attr.WA_Resized: resized,
                                                                                                                                                                                                                                                                                                                      Attr.WA_RightToLeft: right_to_left,
                                                                                                                                                                                                                                                                                                                      Attr.WA_SetCursor: set_cursor,
                                                                                                                                                                                                                                                                                                                      Attr.WA_SetFont: set_font,
                                                                                                                                                                                                                                                                                                                      Attr.WA_SetPalette: set_palette,
                                                                                                                                                                                                                                                                                                                      Attr.WA_SetStyle: set_style,
                                                                                                                                                                                                                                                                                                                      Attr.WA_StaticContents: static_contents,
                                                                                                                                                                                                                                                                                                                      Attr.WA_StyleSheet: style_sheet,
                                                                                                                                                                                                                                                                                                                      Attr.WA_StyleSheetTarget: style_sheet_target,
                                                                                                                                                                                                                                                                                                                      Attr.WA_TabletTracking: tablet_tracking,
                                                                                                                                                                                                                                                                                                                      Attr.WA_TranslucentBackground: translucent_background,
                                                                                                                                                                                                                                                                                                                      Attr.WA_UnderMouse: under_mouse,
                                                                                                                                                                                                                                                                                                                      Attr.WA_UpdatesDisabled: updates_disabled,
                                                                                                                                                                                                                                                                                                                      Attr.WA_WindowModified: window_modified,
                                                                                                                                                                                                                                                                                                                      Attr.WA_WindowPropagation: window_propagation,
                                                                                                                                                                                                                                                                                                                      Attr.WA_MacAlwaysShowToolWindow: mac_always_show_tool_window,
                                                                                                                                                                                                                                                                                                                      Attr.WA_SetLocale: set_locale,
                                                                                                                                                                                                                                                                                                                      Attr.WA_StyledBackground: styled_background,
                                                                                                                                                                                                                                                                                                                      Attr.WA_ShowWithoutActivating: show_without_activating,
                                                                                                                                                                                                                                                                                                                      Attr.WA_NativeWindow: native_window,
                                                                                                                                                                                                                                                                                                                      Attr.WA_DontCreateNativeAncestors: dont_create_native_ancestors,
                                                                                                                                                                                                                                                                                                                      Attr.WA_AcceptTouchEvents: accept_touch_events,
                                                                                                                                                                                                                                                                                                                      Attr.WA_TouchPadAcceptSingleTouchEvents: touch_pad_single_touch_events,
                                                                                                                                                                                                                                                                                                                      Attr.WA_AlwaysStackOnTop: always_stack_on_top,
                                                                                                                                                                                                                                                                                                                      Attr.WA_ContentsMarginsRespectsSafeArea: contents_margins_respects_safe_area,
                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                  for k, v in flags.items():
                                                                                                                                                                                                                                                                                                                      if v is not None:
                                                                                                                                                                                                                                                                                                                          self.setAttribute(k, v)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_modality(
                                                                                                                                                                                                                                                                                                                  self, modality: constants.WindowModalityStr | constants.WindowModality
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set modality for the dialog.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      modality: modality for the main window
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setWindowModality(constants.WINDOW_MODALITY.get_enum_value(modality))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_modality(self) -> constants.WindowModalityStr:
                                                                                                                                                                                                                                                                                                                  """Get the current modality modes as a string.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      modality mode
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.WINDOW_MODALITY.inverse[self.windowModality()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_size_policy(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  horizontal: (
                                                                                                                                                                                                                                                                                                                      widgets.sizepolicy.SizePolicyStr | widgets.QSizePolicy.Policy | None
                                                                                                                                                                                                                                                                                                                  ) = None,
                                                                                                                                                                                                                                                                                                                  vertical: (
                                                                                                                                                                                                                                                                                                                      widgets.sizepolicy.SizePolicyStr | widgets.QSizePolicy.Policy | None
                                                                                                                                                                                                                                                                                                                  ) = None,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the size policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      horizontal: horizontal size policy
                                                                                                                                                                                                                                                                                                                      vertical: vertical size policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  sp = self.get_size_policy()
                                                                                                                                                                                                                                                                                                                  if horizontal is not None:
                                                                                                                                                                                                                                                                                                                      sp.set_horizontal_policy(horizontal)
                                                                                                                                                                                                                                                                                                                  if vertical is not None:
                                                                                                                                                                                                                                                                                                                      sp.set_vertical_policy(vertical)
                                                                                                                                                                                                                                                                                                                  self.setSizePolicy(sp)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_size_policy(self) -> widgets.SizePolicy:
                                                                                                                                                                                                                                                                                                                  """Get size policy."""
                                                                                                                                                                                                                                                                                                                  qpol = self.sizePolicy()
                                                                                                                                                                                                                                                                                                                  if isinstance(qpol, widgets.SizePolicy):
                                                                                                                                                                                                                                                                                                                      return qpol
                                                                                                                                                                                                                                                                                                                  return widgets.SizePolicy.clone(qpol)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_palette(self) -> gui.Palette:
                                                                                                                                                                                                                                                                                                                  return gui.Palette(self.palette())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_background_color(self, color: datatypes.ColorType):
                                                                                                                                                                                                                                                                                                                  col_str = "" if color is None else colors.get_color(color).name()
                                                                                                                                                                                                                                                                                                                  with self.edit_stylesheet() as ss:
                                                                                                                                                                                                                                                                                                                      ss.backgroundColor.setValue(col_str)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @contextlib.contextmanager
                                                                                                                                                                                                                                                                                                              def grab_mouse_events(
                                                                                                                                                                                                                                                                                                                  self, cursor_shape: constants.CursorShapeStr | None = None
                                                                                                                                                                                                                                                                                                              ) -> Generator[None]:
                                                                                                                                                                                                                                                                                                                  """Context manager to grab mouse events."""
                                                                                                                                                                                                                                                                                                                  if cursor_shape is not None:
                                                                                                                                                                                                                                                                                                                      self.grabMouse(constants.CURSOR_SHAPE[cursor_shape])
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.grabMouse()
                                                                                                                                                                                                                                                                                                                  yield None
                                                                                                                                                                                                                                                                                                                  self.releaseMouse()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @contextlib.contextmanager
                                                                                                                                                                                                                                                                                                              def grab_keyboard_events(self) -> Generator[None]:
                                                                                                                                                                                                                                                                                                                  """Context manager to grab keyboard events."""
                                                                                                                                                                                                                                                                                                                  self.grabKeyboard()
                                                                                                                                                                                                                                                                                                                  yield None
                                                                                                                                                                                                                                                                                                                  self.releaseKeyboard()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @contextlib.contextmanager
                                                                                                                                                                                                                                                                                                              def updates_off(self) -> Generator[None]:
                                                                                                                                                                                                                                                                                                                  """Context manager to turn off updates for this widget."""
                                                                                                                                                                                                                                                                                                                  updates = self.updatesEnabled()
                                                                                                                                                                                                                                                                                                                  self.setUpdatesEnabled(False)
                                                                                                                                                                                                                                                                                                                  yield None
                                                                                                                                                                                                                                                                                                                  self.setUpdatesEnabled(updates)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @contextlib.contextmanager
                                                                                                                                                                                                                                                                                                              def edit_stylesheet(self) -> Generator[qstylizer.style.StyleSheet]:
                                                                                                                                                                                                                                                                                                                  """Context manager to edit the stylesheet (using qstylizer)."""
                                                                                                                                                                                                                                                                                                                  ss = self.get_stylesheet()
                                                                                                                                                                                                                                                                                                                  yield ss
                                                                                                                                                                                                                                                                                                                  self.set_stylesheet(ss)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_stylesheet(
                                                                                                                                                                                                                                                                                                                  self, ss: str | qstylizer.style.StyleSheet | datatypes.PathType | None
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set stylesheet for this widget."""
                                                                                                                                                                                                                                                                                                                  match ss:
                                                                                                                                                                                                                                                                                                                      case None:
                                                                                                                                                                                                                                                                                                                          ss = ""
                                                                                                                                                                                                                                                                                                                      case str():
                                                                                                                                                                                                                                                                                                                          pass
                                                                                                                                                                                                                                                                                                                      case os.PathLike():
                                                                                                                                                                                                                                                                                                                          ss = pathlib.Path(ss).read_text("utf-8")
                                                                                                                                                                                                                                                                                                                      case qstylizer.style.StyleSheet():
                                                                                                                                                                                                                                                                                                                          ss = str(ss)
                                                                                                                                                                                                                                                                                                                  self.setStyleSheet(ss)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_stylesheet(self) -> qstylizer.style.StyleSheet:
                                                                                                                                                                                                                                                                                                                  """Get current stylesheet."""
                                                                                                                                                                                                                                                                                                                  try:
                                                                                                                                                                                                                                                                                                                      return qstylizer.parser.parse(self.styleSheet())
                                                                                                                                                                                                                                                                                                                  except ValueError:
                                                                                                                                                                                                                                                                                                                      return qstylizer.style.StyleSheet()
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @contextlib.contextmanager
                                                                                                                                                                                                                                                                                                              def edit_palette(self) -> Generator[gui.Palette]:
                                                                                                                                                                                                                                                                                                                  """Context manager to edit the palette of the widget."""
                                                                                                                                                                                                                                                                                                                  palette = gui.Palette(self.palette())
                                                                                                                                                                                                                                                                                                                  yield palette
                                                                                                                                                                                                                                                                                                                  self.setPalette(palette)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @contextlib.contextmanager
                                                                                                                                                                                                                                                                                                              def edit_font(self) -> Generator[gui.Font]:
                                                                                                                                                                                                                                                                                                                  """Context manager to edit the font of the widget."""
                                                                                                                                                                                                                                                                                                                  font = gui.Font(self.font())
                                                                                                                                                                                                                                                                                                                  yield font
                                                                                                                                                                                                                                                                                                                  self.setFont(font)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_context_menu_policy(
                                                                                                                                                                                                                                                                                                                  self, policy: constants.ContextPolicyStr | constants.ContextMenuPolicy
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set contextmenu policy for given item view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      policy: contextmenu policy to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setContextMenuPolicy(constants.CONTEXT_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_context_menu_policy(self) -> constants.ContextPolicyStr:
                                                                                                                                                                                                                                                                                                                  """Return current contextmenu policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      contextmenu policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.CONTEXT_POLICY.inverse[self.contextMenuPolicy()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_window_state(self, state: constants.WindowStateStr | constants.WindowState):
                                                                                                                                                                                                                                                                                                                  """Set window state for given item view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      state: window state to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setWindowState(constants.WINDOW_STATES.get_enum_value(state))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_window_state(self) -> constants.WindowStateStr:
                                                                                                                                                                                                                                                                                                                  """Return current window state.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      window state
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.WINDOW_STATES.inverse[self.windowState()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_custom_menu(self, method: Callable):
                                                                                                                                                                                                                                                                                                                  self.set_context_menu_policy("custom")
                                                                                                                                                                                                                                                                                                                  self.customContextMenuRequested.connect(method)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @property
                                                                                                                                                                                                                                                                                                              def box(self) -> widgets.Layout:
                                                                                                                                                                                                                                                                                                                  # set_layout() always installs a prettyqt layout
                                                                                                                                                                                                                                                                                                                  return cast("widgets.Layout", self.layout())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @box.setter
                                                                                                                                                                                                                                                                                                              def box(self, layout: widgets.Layout):
                                                                                                                                                                                                                                                                                                                  self.set_layout(layout)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def set_layout(
                                                                                                                                                                                                                                                                                                                  self, layout: Literal["horizontal"], *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                              ) -> widgets.HBoxLayout:
                                                                                                                                                                                                                                                                                                                  pass
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def set_layout(
                                                                                                                                                                                                                                                                                                                  self, layout: Literal["vertical"], *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                              ) -> widgets.VBoxLayout:
                                                                                                                                                                                                                                                                                                                  pass
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def set_layout(
                                                                                                                                                                                                                                                                                                                  self, layout: Literal["grid"], *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                              ) -> widgets.GridLayout:
                                                                                                                                                                                                                                                                                                                  pass
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def set_layout(
                                                                                                                                                                                                                                                                                                                  self, layout: Literal["border"], *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                              ) -> custom_widgets.BorderLayout:
                                                                                                                                                                                                                                                                                                                  pass
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def set_layout(
                                                                                                                                                                                                                                                                                                                  self, layout: Literal["flow"], *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                              ) -> custom_widgets.FlowLayout:
                                                                                                                                                                                                                                                                                                                  pass
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def set_layout(
                                                                                                                                                                                                                                                                                                                  self, layout: Literal["form"], *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                              ) -> widgets.FormLayout:
                                                                                                                                                                                                                                                                                                                  pass
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def set_layout(
                                                                                                                                                                                                                                                                                                                  self, layout: Literal["stacked"], *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                              ) -> widgets.StackedLayout:
                                                                                                                                                                                                                                                                                                                  pass
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              @overload
                                                                                                                                                                                                                                                                                                              def set_layout(
                                                                                                                                                                                                                                                                                                                  self, layout: widgets.QLayout, *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                              ) -> widgets.QLayout:
                                                                                                                                                                                                                                                                                                                  pass
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_layout(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  layout: LayoutStr | widgets.QLayout,
                                                                                                                                                                                                                                                                                                                  *,
                                                                                                                                                                                                                                                                                                                  margin: int | None = None,
                                                                                                                                                                                                                                                                                                                  **kwargs: datatypes.VariantType,
                                                                                                                                                                                                                                                                                                              ) -> widgets.QLayout:
                                                                                                                                                                                                                                                                                                                  """Quick way to set a layout.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Sets layout to given layout, also allows setting margin and spacing.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      layout: Layout to set
                                                                                                                                                                                                                                                                                                                      margin: margin to use in pixels
                                                                                                                                                                                                                                                                                                                      kwargs: keyword arguments passed to layout
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      Layout
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  from prettyqt import custom_widgets
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  match layout:
                                                                                                                                                                                                                                                                                                                      case "horizontal":
                                                                                                                                                                                                                                                                                                                          layout = widgets.HBoxLayout(**kwargs)
                                                                                                                                                                                                                                                                                                                      case "vertical":
                                                                                                                                                                                                                                                                                                                          layout = widgets.VBoxLayout(**kwargs)
                                                                                                                                                                                                                                                                                                                      case "grid":
                                                                                                                                                                                                                                                                                                                          layout = widgets.GridLayout(**kwargs)
                                                                                                                                                                                                                                                                                                                      case "form":
                                                                                                                                                                                                                                                                                                                          layout = widgets.FormLayout(**kwargs)
                                                                                                                                                                                                                                                                                                                      case "stacked":
                                                                                                                                                                                                                                                                                                                          layout = widgets.StackedLayout(**kwargs)
                                                                                                                                                                                                                                                                                                                      case "flow":
                                                                                                                                                                                                                                                                                                                          layout = custom_widgets.FlowLayout(**kwargs)
                                                                                                                                                                                                                                                                                                                      case "border":
                                                                                                                                                                                                                                                                                                                          layout = custom_widgets.BorderLayout(**kwargs)
                                                                                                                                                                                                                                                                                                                      case widgets.QLayout():
                                                                                                                                                                                                                                                                                                                          layout = layout
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          msg = f"Invalid Layout {layout}"
                                                                                                                                                                                                                                                                                                                          raise ValueError(msg)
                                                                                                                                                                                                                                                                                                                  self.setLayout(layout)
                                                                                                                                                                                                                                                                                                                  if margin is not None:
                                                                                                                                                                                                                                                                                                                      layout.setContentsMargins(margin, margin, margin, margin)
                                                                                                                                                                                                                                                                                                                  return layout
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def position_on(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  where: PositionPossibilityType,
                                                                                                                                                                                                                                                                                                                  how: Literal[
                                                                                                                                                                                                                                                                                                                      "center",
                                                                                                                                                                                                                                                                                                                      "top",
                                                                                                                                                                                                                                                                                                                      "left",
                                                                                                                                                                                                                                                                                                                      "bottom",
                                                                                                                                                                                                                                                                                                                      "right",
                                                                                                                                                                                                                                                                                                                      "top_left",
                                                                                                                                                                                                                                                                                                                      "top_right",
                                                                                                                                                                                                                                                                                                                      "bottom_left",
                                                                                                                                                                                                                                                                                                                      "bottom_right",
                                                                                                                                                                                                                                                                                                                  ] = "center",
                                                                                                                                                                                                                                                                                                                  *,
                                                                                                                                                                                                                                                                                                                  scale_ratio: float | None = None,
                                                                                                                                                                                                                                                                                                                  x_offset: int = 0,
                                                                                                                                                                                                                                                                                                                  y_offset: int = 0,
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Position widget on another widget / window / screen.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Arguments:
                                                                                                                                                                                                                                                                                                                      where: where to positin on
                                                                                                                                                                                                                                                                                                                      how: How to align
                                                                                                                                                                                                                                                                                                                      scale_ratio: Resize to scale_ratio * target size
                                                                                                                                                                                                                                                                                                                      x_offset: additional x offset for final position
                                                                                                                                                                                                                                                                                                                      y_offset: additional y offset for final position
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  do_scale = True
                                                                                                                                                                                                                                                                                                                  match where:
                                                                                                                                                                                                                                                                                                                      case "mouse":
                                                                                                                                                                                                                                                                                                                          geom = core.Rect(gui.Cursor.pos(), gui.Cursor.pos())
                                                                                                                                                                                                                                                                                                                          do_scale = False
                                                                                                                                                                                                                                                                                                                      case core.QPoint():
                                                                                                                                                                                                                                                                                                                          geom = core.Rect(where, where)
                                                                                                                                                                                                                                                                                                                          do_scale = False
                                                                                                                                                                                                                                                                                                                      case (int(), int()):
                                                                                                                                                                                                                                                                                                                          p = core.Point(*where)
                                                                                                                                                                                                                                                                                                                          geom = core.Rect(p, p)
                                                                                                                                                                                                                                                                                                                          do_scale = False
                                                                                                                                                                                                                                                                                                                      case (int(), int(), int(), int()):
                                                                                                                                                                                                                                                                                                                          geom = core.Rect(*where)
                                                                                                                                                                                                                                                                                                                      case "parent":
                                                                                                                                                                                                                                                                                                                          if (parent := self.parentWidget()) is None:
                                                                                                                                                                                                                                                                                                                              raise ValueError(where)
                                                                                                                                                                                                                                                                                                                          geom = parent.frameGeometry()
                                                                                                                                                                                                                                                                                                                      case "window":
                                                                                                                                                                                                                                                                                                                          geom = self.window().frameGeometry()
                                                                                                                                                                                                                                                                                                                      case widgets.QWidget():
                                                                                                                                                                                                                                                                                                                          geom = where.frameGeometry()
                                                                                                                                                                                                                                                                                                                      case core.QRect():
                                                                                                                                                                                                                                                                                                                          geom = where
                                                                                                                                                                                                                                                                                                                      case "screen":
                                                                                                                                                                                                                                                                                                                          geom = gui.GuiApplication.primaryScreen().geometry()
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise ValueError(where)
                                                                                                                                                                                                                                                                                                                  if scale_ratio is not None and do_scale:
                                                                                                                                                                                                                                                                                                                      self.resize(
                                                                                                                                                                                                                                                                                                                          int(geom.width() * scale_ratio),
                                                                                                                                                                                                                                                                                                                          int(geom.height() * scale_ratio),
                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                                  own_geo = self.frameGeometry()
                                                                                                                                                                                                                                                                                                                  match how:
                                                                                                                                                                                                                                                                                                                      case "center":
                                                                                                                                                                                                                                                                                                                          new = geom.center()
                                                                                                                                                                                                                                                                                                                      case "top":
                                                                                                                                                                                                                                                                                                                          new = core.Point(geom.center().x(), geom.top() + own_geo.height() // 2)
                                                                                                                                                                                                                                                                                                                      case "bottom":
                                                                                                                                                                                                                                                                                                                          new = core.Point(geom.center().x(), geom.bottom() - own_geo.height() // 2)
                                                                                                                                                                                                                                                                                                                      case "left":
                                                                                                                                                                                                                                                                                                                          new = core.Point(geom.left() + own_geo.width() // 2, geom.center().y())
                                                                                                                                                                                                                                                                                                                      case "right":
                                                                                                                                                                                                                                                                                                                          new = core.Point(geom.right() - own_geo.width() // 2, geom.center().y())
                                                                                                                                                                                                                                                                                                                      case "top_right":
                                                                                                                                                                                                                                                                                                                          new = core.Point(
                                                                                                                                                                                                                                                                                                                              geom.right() - own_geo.width() // 2,
                                                                                                                                                                                                                                                                                                                              geom.top() + own_geo.height() // 2,
                                                                                                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                                                                                                      case "top_left":
                                                                                                                                                                                                                                                                                                                          new = core.Point(
                                                                                                                                                                                                                                                                                                                              geom.left() + own_geo.width() // 2,
                                                                                                                                                                                                                                                                                                                              geom.top() + own_geo.height() // 2,
                                                                                                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                                                                                                      case "bottom_right":
                                                                                                                                                                                                                                                                                                                          new = core.Point(
                                                                                                                                                                                                                                                                                                                              geom.right() - own_geo.width() // 2,
                                                                                                                                                                                                                                                                                                                              geom.bottom() - own_geo.height() // 2,
                                                                                                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                                                                                                      case "bottom_left":
                                                                                                                                                                                                                                                                                                                          new = core.Point(
                                                                                                                                                                                                                                                                                                                              geom.left() + own_geo.width() // 2,
                                                                                                                                                                                                                                                                                                                              geom.bottom() - own_geo.height() // 2,
                                                                                                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                                                                                                                      case _:
                                                                                                                                                                                                                                                                                                                          raise ValueError(how)
                                                                                                                                                                                                                                                                                                                  new = core.Point(new.x() + x_offset, new.y() + y_offset)
                                                                                                                                                                                                                                                                                                                  own_geo.moveCenter(new)
                                                                                                                                                                                                                                                                                                                  self.move(own_geo.topLeft())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_cursor(
                                                                                                                                                                                                                                                                                                                  self, cursor: constants.CursorShapeStr | constants.CursorShape | gui.QCursor
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set the cursor for this widget."""
                                                                                                                                                                                                                                                                                                                  if isinstance(cursor, gui.QCursor):
                                                                                                                                                                                                                                                                                                                      curs = cursor
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      curs = gui.Cursor(constants.CURSOR_SHAPE.get_enum_value(cursor))
                                                                                                                                                                                                                                                                                                                  self.setCursor(curs)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_focus_policy(self, policy: constants.FocusPolicyStr | constants.FocusPolicy):
                                                                                                                                                                                                                                                                                                                  """Set the way the widget accepts keyboard focus.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      policy (str): Focus policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setFocusPolicy(constants.FOCUS_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_focus_policy(self) -> constants.FocusPolicyStr:
                                                                                                                                                                                                                                                                                                                  """Return waay the widget accepts keyboard focus.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      str: Focus policy
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.FOCUS_POLICY.inverse[self.focusPolicy()]
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_focus(self, reason: constants.FocusReasonStr | None = None):
                                                                                                                                                                                                                                                                                                                  if reason is None:
                                                                                                                                                                                                                                                                                                                      self.setFocus()
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.setFocus(constants.FOCUS_REASONS[reason])
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_font_size(self, size: int):
                                                                                                                                                                                                                                                                                                                  font = self.font()
                                                                                                                                                                                                                                                                                                                  font.setPointSize(size)
                                                                                                                                                                                                                                                                                                                  self.setFont(font)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_font_metrics(self) -> gui.FontMetrics:
                                                                                                                                                                                                                                                                                                                  return gui.FontMetrics(self.fontMetrics())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_font_info(self) -> gui.FontInfo:
                                                                                                                                                                                                                                                                                                                  return gui.FontInfo(self.fontInfo())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_margin(self, margin: datatypes.MarginsType):
                                                                                                                                                                                                                                                                                                                  """Set content margins for the widget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Arguments:
                                                                                                                                                                                                                                                                                                                      margin: margins to use
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  self.setContentsMargins(datatypes.to_margins(margin))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def raise_dock(self) -> bool:
                                                                                                                                                                                                                                                                                                                  w = self.find_parent(widgets.QDockWidget)
                                                                                                                                                                                                                                                                                                                  if w is None:
                                                                                                                                                                                                                                                                                                                      return False
                                                                                                                                                                                                                                                                                                                  w.setVisible(True)
                                                                                                                                                                                                                                                                                                                  w.raise_()
                                                                                                                                                                                                                                                                                                                  return True
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_mask(
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  area: datatypes.RectType | gui.QRegion | gui.QBitmap | None,
                                                                                                                                                                                                                                                                                                                  typ: gui.region.RegionTypeStr = "rectangle",
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set mask of the widget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Arguments:
                                                                                                                                                                                                                                                                                                                      area: Mask area
                                                                                                                                                                                                                                                                                                                      typ: type of region (only used if area is a QRegion)
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  match area:
                                                                                                                                                                                                                                                                                                                      case None:
                                                                                                                                                                                                                                                                                                                          self.clearMask()
                                                                                                                                                                                                                                                                                                                          return
                                                                                                                                                                                                                                                                                                                      case (int(), int(), int(), int()):
                                                                                                                                                                                                                                                                                                                          area = gui.Region(*area, gui.region.REGION_TYPE[typ])
                                                                                                                                                                                                                                                                                                                      case core.QRect():
                                                                                                                                                                                                                                                                                                                          area = gui.Region(area, gui.region.REGION_TYPE[typ])
                                                                                                                                                                                                                                                                                                                  self.setMask(area)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_window_file_path(self, path: datatypes.PathType):
                                                                                                                                                                                                                                                                                                                  self.setWindowFilePath(os.fspath(path))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_window_file_path(self) -> pathlib.Path | None:
                                                                                                                                                                                                                                                                                                                  path = self.windowFilePath()
                                                                                                                                                                                                                                                                                                                  return pathlib.Path(path) if path else None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_image(self) -> gui.QPixmap:
                                                                                                                                                                                                                                                                                                                  """Get a pixmap for the widget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Implements a workaround to also include QOpenGlWidgets.
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  from prettyqt.qt import QtOpenGLWidgets
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  image = self.grab()
                                                                                                                                                                                                                                                                                                                  with gui.Painter(image) as painter:
                                                                                                                                                                                                                                                                                                                      painter.set_composition_mode("source_atop")
                                                                                                                                                                                                                                                                                                                      for gl_widget in self.find_children(QtOpenGLWidgets.QOpenGLWidget):
                                                                                                                                                                                                                                                                                                                          d = gl_widget.mapToGlobal(core.Point()) - self.mapToGlobal(core.Point())
                                                                                                                                                                                                                                                                                                                          painter.drawImage(d, gl_widget.grabFramebuffer())
                                                                                                                                                                                                                                                                                                                  return image
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_screen(self) -> gui.Screen | None:
                                                                                                                                                                                                                                                                                                                  window = self.window().windowHandle()
                                                                                                                                                                                                                                                                                                                  return None if window is None else gui.Screen(window.screen())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def delete_children(self):
                                                                                                                                                                                                                                                                                                                  """Delete all children of the specified QObject."""
                                                                                                                                                                                                                                                                                                                  if (clear := getattr(self, "clear", None)) is not None:
                                                                                                                                                                                                                                                                                                                      return clear()
                                                                                                                                                                                                                                                                                                                  if (layout := self.layout()) is None:
                                                                                                                                                                                                                                                                                                                      return None
                                                                                                                                                                                                                                                                                                                  while layout.count():
                                                                                                                                                                                                                                                                                                                      item = layout.takeAt(0)
                                                                                                                                                                                                                                                                                                                      if item is not None and (widget := item.widget()) is not None:
                                                                                                                                                                                                                                                                                                                          widget.deleteLater()
                                                                                                                                                                                                                                                                                                                  return None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_cursor(self) -> gui.Cursor:
                                                                                                                                                                                                                                                                                                                  return gui.Cursor(self.cursor())
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_style(self, style: str | widgets.QStyle):
                                                                                                                                                                                                                                                                                                                  """Set widget style."""
                                                                                                                                                                                                                                                                                                                  if isinstance(style, str):
                                                                                                                                                                                                                                                                                                                      style = widgets.QStyleFactory.create(style)
                                                                                                                                                                                                                                                                                                                  self.setStyle(style)
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def child_at(self, *args, typ: type[widgets.QWidget] | None = None):
                                                                                                                                                                                                                                                                                                                  """Get child widget at position. If type is given, search parents recursively."""
                                                                                                                                                                                                                                                                                                                  child: core.QObject | None = super().childAt(*args)
                                                                                                                                                                                                                                                                                                                  if typ is None or isinstance(child, typ):
                                                                                                                                                                                                                                                                                                                      return child
                                                                                                                                                                                                                                                                                                                  while child is not None and (child := child.parent()) is not None:
                                                                                                                                                                                                                                                                                                                      if isinstance(child, typ):
                                                                                                                                                                                                                                                                                                                          return child
                                                                                                                                                                                                                                                                                                                  return None
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def set_layout_direction(
                                                                                                                                                                                                                                                                                                                  self, direction: constants.LayoutDirectionStr | constants.LayoutDirection | None
                                                                                                                                                                                                                                                                                                              ):
                                                                                                                                                                                                                                                                                                                  """Set layout direction.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Args:
                                                                                                                                                                                                                                                                                                                      direction: layout direction
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  if direction is None:
                                                                                                                                                                                                                                                                                                                      self.unsetLayoutDirection()
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      self.setLayoutDirection(constants.LAYOUT_DIRECTION.get_enum_value(direction))
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              def get_layout_direction(self) -> constants.LayoutDirectionStr:
                                                                                                                                                                                                                                                                                                                  """Get the current layout direction.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  Returns:
                                                                                                                                                                                                                                                                                                                      layout direction
                                                                                                                                                                                                                                                                                                                  """
                                                                                                                                                                                                                                                                                                                  return constants.LAYOUT_DIRECTION.inverse[self.layoutDirection()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          add_action(text: str | gui.Action, *, parent: widgets.QWidget | None = None, data: Any = None, callback: Callable | None = None, **kwargs: Any) -> gui.Action

                                                                                                                                                                                                                                                                                                          Add an action to the menu.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          text str | Action

                                                                                                                                                                                                                                                                                                          Label for the action

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          parent QWidget | None

                                                                                                                                                                                                                                                                                                          parent

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          data Any

                                                                                                                                                                                                                                                                                                          data for the Action

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          callback Callable | None

                                                                                                                                                                                                                                                                                                          callback to be called when action is triggered

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          kwargs Any

                                                                                                                                                                                                                                                                                                          kwargs passed to action ctor

                                                                                                                                                                                                                                                                                                          {}

                                                                                                                                                                                                                                                                                                          Returns: Action added to menu

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def add_action(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              text: str | gui.Action,
                                                                                                                                                                                                                                                                                                              *,
                                                                                                                                                                                                                                                                                                              parent: widgets.QWidget | None = None,
                                                                                                                                                                                                                                                                                                              data: Any = None,
                                                                                                                                                                                                                                                                                                              callback: Callable | None = None,
                                                                                                                                                                                                                                                                                                              **kwargs: Any,
                                                                                                                                                                                                                                                                                                          ) -> gui.Action:
                                                                                                                                                                                                                                                                                                              """Add an action to the menu.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  text: Label for the action
                                                                                                                                                                                                                                                                                                                  parent: parent
                                                                                                                                                                                                                                                                                                                  data: data for the Action
                                                                                                                                                                                                                                                                                                                  callback: callback to be called when action is triggered
                                                                                                                                                                                                                                                                                                                  kwargs: kwargs passed to action ctor
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  Action added to menu
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if isinstance(text, str):
                                                                                                                                                                                                                                                                                                                  action = gui.Action(
                                                                                                                                                                                                                                                                                                                      parent=parent or self,
                                                                                                                                                                                                                                                                                                                      text=text,
                                                                                                                                                                                                                                                                                                                      callback=callback,
                                                                                                                                                                                                                                                                                                                      **kwargs,
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                  action = text
                                                                                                                                                                                                                                                                                                                  action.setParent(self)
                                                                                                                                                                                                                                                                                                              self.addAction(action)
                                                                                                                                                                                                                                                                                                              action.setData(data)
                                                                                                                                                                                                                                                                                                              return action
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          add_shortcut(keysequence: datatypes.KeyCombinationType, *, callback: Callable | None = None, context: constants.ShortcutContextStr = 'window') -> gui.Shortcut

                                                                                                                                                                                                                                                                                                          Add shortcut to widget.

                                                                                                                                                                                                                                                                                                          Adds as shortcut for given callback and context to this widget.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          keysequence KeyCombinationType

                                                                                                                                                                                                                                                                                                          Key sequence

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          callback Callable | None

                                                                                                                                                                                                                                                                                                          Callback for the shortcut

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          context ShortcutContextStr

                                                                                                                                                                                                                                                                                                          context for this shortcut

                                                                                                                                                                                                                                                                                                          'window'
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def add_shortcut(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              keysequence: datatypes.KeyCombinationType,
                                                                                                                                                                                                                                                                                                              *,
                                                                                                                                                                                                                                                                                                              callback: Callable | None = None,
                                                                                                                                                                                                                                                                                                              context: constants.ShortcutContextStr = "window",
                                                                                                                                                                                                                                                                                                          ) -> gui.Shortcut:
                                                                                                                                                                                                                                                                                                              """Add shortcut to widget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Adds as shortcut for given callback and context to this widget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  keysequence: Key sequence
                                                                                                                                                                                                                                                                                                                  callback: Callback for the shortcut
                                                                                                                                                                                                                                                                                                                  context: context for this shortcut
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  shortcut object
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return gui.Shortcut(
                                                                                                                                                                                                                                                                                                                  datatypes.to_keysequence(keysequence),
                                                                                                                                                                                                                                                                                                                  self,
                                                                                                                                                                                                                                                                                                                  callback,
                                                                                                                                                                                                                                                                                                                  context=constants.SHORTCUT_CONTEXT.get_enum_value(context),
                                                                                                                                                                                                                                                                                                              )
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          child_at(*args, typ: type[widgets.QWidget] | None = None)

                                                                                                                                                                                                                                                                                                          Get child widget at position. If type is given, search parents recursively.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def child_at(self, *args, typ: type[widgets.QWidget] | None = None):
                                                                                                                                                                                                                                                                                                              """Get child widget at position. If type is given, search parents recursively."""
                                                                                                                                                                                                                                                                                                              child: core.QObject | None = super().childAt(*args)
                                                                                                                                                                                                                                                                                                              if typ is None or isinstance(child, typ):
                                                                                                                                                                                                                                                                                                                  return child
                                                                                                                                                                                                                                                                                                              while child is not None and (child := child.parent()) is not None:
                                                                                                                                                                                                                                                                                                                  if isinstance(child, typ):
                                                                                                                                                                                                                                                                                                                      return child
                                                                                                                                                                                                                                                                                                              return None
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          delete_children()

                                                                                                                                                                                                                                                                                                          Delete all children of the specified QObject.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def delete_children(self):
                                                                                                                                                                                                                                                                                                              """Delete all children of the specified QObject."""
                                                                                                                                                                                                                                                                                                              if (clear := getattr(self, "clear", None)) is not None:
                                                                                                                                                                                                                                                                                                                  return clear()
                                                                                                                                                                                                                                                                                                              if (layout := self.layout()) is None:
                                                                                                                                                                                                                                                                                                                  return None
                                                                                                                                                                                                                                                                                                              while layout.count():
                                                                                                                                                                                                                                                                                                                  item = layout.takeAt(0)
                                                                                                                                                                                                                                                                                                                  if item is not None and (widget := item.widget()) is not None:
                                                                                                                                                                                                                                                                                                                      widget.deleteLater()
                                                                                                                                                                                                                                                                                                              return None
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          edit_font() -> Generator[gui.Font]

                                                                                                                                                                                                                                                                                                          Context manager to edit the font of the widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          @contextlib.contextmanager
                                                                                                                                                                                                                                                                                                          def edit_font(self) -> Generator[gui.Font]:
                                                                                                                                                                                                                                                                                                              """Context manager to edit the font of the widget."""
                                                                                                                                                                                                                                                                                                              font = gui.Font(self.font())
                                                                                                                                                                                                                                                                                                              yield font
                                                                                                                                                                                                                                                                                                              self.setFont(font)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          edit_palette() -> Generator[gui.Palette]

                                                                                                                                                                                                                                                                                                          Context manager to edit the palette of the widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          @contextlib.contextmanager
                                                                                                                                                                                                                                                                                                          def edit_palette(self) -> Generator[gui.Palette]:
                                                                                                                                                                                                                                                                                                              """Context manager to edit the palette of the widget."""
                                                                                                                                                                                                                                                                                                              palette = gui.Palette(self.palette())
                                                                                                                                                                                                                                                                                                              yield palette
                                                                                                                                                                                                                                                                                                              self.setPalette(palette)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          edit_stylesheet() -> Generator[qstylizer.style.StyleSheet]

                                                                                                                                                                                                                                                                                                          Context manager to edit the stylesheet (using qstylizer).

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          @contextlib.contextmanager
                                                                                                                                                                                                                                                                                                          def edit_stylesheet(self) -> Generator[qstylizer.style.StyleSheet]:
                                                                                                                                                                                                                                                                                                              """Context manager to edit the stylesheet (using qstylizer)."""
                                                                                                                                                                                                                                                                                                              ss = self.get_stylesheet()
                                                                                                                                                                                                                                                                                                              yield ss
                                                                                                                                                                                                                                                                                                              self.set_stylesheet(ss)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_background_role() -> gui.palette.RoleStr

                                                                                                                                                                                                                                                                                                          Get background role for this widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def get_background_role(self) -> gui.palette.RoleStr:
                                                                                                                                                                                                                                                                                                              """Get background role for this widget."""
                                                                                                                                                                                                                                                                                                              return gui.palette.ROLE.inverse[self.backgroundRole()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_context_menu_policy() -> constants.ContextPolicyStr

                                                                                                                                                                                                                                                                                                          Return current contextmenu policy.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def get_context_menu_policy(self) -> constants.ContextPolicyStr:
                                                                                                                                                                                                                                                                                                              """Return current contextmenu policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  contextmenu policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.CONTEXT_POLICY.inverse[self.contextMenuPolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_focus_policy() -> constants.FocusPolicyStr

                                                                                                                                                                                                                                                                                                          Return waay the widget accepts keyboard focus.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def get_focus_policy(self) -> constants.FocusPolicyStr:
                                                                                                                                                                                                                                                                                                              """Return waay the widget accepts keyboard focus.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  str: Focus policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.FOCUS_POLICY.inverse[self.focusPolicy()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_foreground_role() -> gui.palette.RoleStr

                                                                                                                                                                                                                                                                                                          Set foreground role for this widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def get_foreground_role(self) -> gui.palette.RoleStr:
                                                                                                                                                                                                                                                                                                              """Set foreground role for this widget."""
                                                                                                                                                                                                                                                                                                              return gui.palette.ROLE.inverse[self.foregroundRole()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_icon() -> gui.Icon | None

                                                                                                                                                                                                                                                                                                          Get the window icon (returns None if not existing).

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def get_icon(self) -> gui.Icon | None:
                                                                                                                                                                                                                                                                                                              """Get the window icon (returns None if not existing)."""
                                                                                                                                                                                                                                                                                                              icon = super().windowIcon()
                                                                                                                                                                                                                                                                                                              return None if icon.isNull() else gui.Icon(icon)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_image() -> gui.QPixmap

                                                                                                                                                                                                                                                                                                          Get a pixmap for the widget.

                                                                                                                                                                                                                                                                                                          Implements a workaround to also include QOpenGlWidgets.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def get_image(self) -> gui.QPixmap:
                                                                                                                                                                                                                                                                                                              """Get a pixmap for the widget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Implements a workaround to also include QOpenGlWidgets.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              from prettyqt.qt import QtOpenGLWidgets
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              image = self.grab()
                                                                                                                                                                                                                                                                                                              with gui.Painter(image) as painter:
                                                                                                                                                                                                                                                                                                                  painter.set_composition_mode("source_atop")
                                                                                                                                                                                                                                                                                                                  for gl_widget in self.find_children(QtOpenGLWidgets.QOpenGLWidget):
                                                                                                                                                                                                                                                                                                                      d = gl_widget.mapToGlobal(core.Point()) - self.mapToGlobal(core.Point())
                                                                                                                                                                                                                                                                                                                      painter.drawImage(d, gl_widget.grabFramebuffer())
                                                                                                                                                                                                                                                                                                              return image
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_layout_direction() -> constants.LayoutDirectionStr

                                                                                                                                                                                                                                                                                                          Get the current layout direction.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def get_layout_direction(self) -> constants.LayoutDirectionStr:
                                                                                                                                                                                                                                                                                                              """Get the current layout direction.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  layout direction
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.LAYOUT_DIRECTION.inverse[self.layoutDirection()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_modality() -> constants.WindowModalityStr

                                                                                                                                                                                                                                                                                                          Get the current modality modes as a string.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def get_modality(self) -> constants.WindowModalityStr:
                                                                                                                                                                                                                                                                                                              """Get the current modality modes as a string.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  modality mode
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.WINDOW_MODALITY.inverse[self.windowModality()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_size_policy() -> widgets.SizePolicy

                                                                                                                                                                                                                                                                                                          Get size policy.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def get_size_policy(self) -> widgets.SizePolicy:
                                                                                                                                                                                                                                                                                                              """Get size policy."""
                                                                                                                                                                                                                                                                                                              qpol = self.sizePolicy()
                                                                                                                                                                                                                                                                                                              if isinstance(qpol, widgets.SizePolicy):
                                                                                                                                                                                                                                                                                                                  return qpol
                                                                                                                                                                                                                                                                                                              return widgets.SizePolicy.clone(qpol)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_stylesheet() -> qstylizer.style.StyleSheet

                                                                                                                                                                                                                                                                                                          Get current stylesheet.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def get_stylesheet(self) -> qstylizer.style.StyleSheet:
                                                                                                                                                                                                                                                                                                              """Get current stylesheet."""
                                                                                                                                                                                                                                                                                                              try:
                                                                                                                                                                                                                                                                                                                  return qstylizer.parser.parse(self.styleSheet())
                                                                                                                                                                                                                                                                                                              except ValueError:
                                                                                                                                                                                                                                                                                                                  return qstylizer.style.StyleSheet()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          get_window_state() -> constants.WindowStateStr

                                                                                                                                                                                                                                                                                                          Return current window state.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def get_window_state(self) -> constants.WindowStateStr:
                                                                                                                                                                                                                                                                                                              """Return current window state.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  window state
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              return constants.WINDOW_STATES.inverse[self.windowState()]
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          grab_keyboard_events() -> Generator[None]

                                                                                                                                                                                                                                                                                                          Context manager to grab keyboard events.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          @contextlib.contextmanager
                                                                                                                                                                                                                                                                                                          def grab_keyboard_events(self) -> Generator[None]:
                                                                                                                                                                                                                                                                                                              """Context manager to grab keyboard events."""
                                                                                                                                                                                                                                                                                                              self.grabKeyboard()
                                                                                                                                                                                                                                                                                                              yield None
                                                                                                                                                                                                                                                                                                              self.releaseKeyboard()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          grab_mouse_events(cursor_shape: constants.CursorShapeStr | None = None) -> Generator[None]

                                                                                                                                                                                                                                                                                                          Context manager to grab mouse events.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          @contextlib.contextmanager
                                                                                                                                                                                                                                                                                                          def grab_mouse_events(
                                                                                                                                                                                                                                                                                                              self, cursor_shape: constants.CursorShapeStr | None = None
                                                                                                                                                                                                                                                                                                          ) -> Generator[None]:
                                                                                                                                                                                                                                                                                                              """Context manager to grab mouse events."""
                                                                                                                                                                                                                                                                                                              if cursor_shape is not None:
                                                                                                                                                                                                                                                                                                                  self.grabMouse(constants.CURSOR_SHAPE[cursor_shape])
                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                  self.grabMouse()
                                                                                                                                                                                                                                                                                                              yield None
                                                                                                                                                                                                                                                                                                              self.releaseMouse()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          insertAction(position_or_action: int | gui.QAction, action: gui.QAction)

                                                                                                                                                                                                                                                                                                          Extend insertAction to also allow int index.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def insertAction(self, position_or_action: int | gui.QAction, action: gui.QAction):
                                                                                                                                                                                                                                                                                                              """Extend insertAction to also allow int index."""
                                                                                                                                                                                                                                                                                                              if isinstance(position_or_action, int):
                                                                                                                                                                                                                                                                                                                  actions = self.actions()
                                                                                                                                                                                                                                                                                                                  if len(actions) == 0 or position_or_action >= len(actions):
                                                                                                                                                                                                                                                                                                                      # Insert as the first action or the last action.
                                                                                                                                                                                                                                                                                                                      return super().addAction(action)
                                                                                                                                                                                                                                                                                                                  position_or_action = actions[position_or_action]
                                                                                                                                                                                                                                                                                                              super().insertAction(position_or_action, action)
                                                                                                                                                                                                                                                                                                              return None
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          map_from(widget: widgets.QWidget | Literal['global', 'parent', 'window'], pos_or_rect: datatypes.PointType | datatypes.RectType | datatypes.PointFType | datatypes.RectFType) -> core.QRect | core.QRectF | core.QPoint | core.QPointF

                                                                                                                                                                                                                                                                                                          Map a point or rect from a widget, global position or parent.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          widget QWidget | Literal['global', 'parent', 'window']

                                                                                                                                                                                                                                                                                                          What to map from.

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          pos_or_rect PointType | RectType | PointFType | RectFType

                                                                                                                                                                                                                                                                                                          Point or rect to map.

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def map_from(  # noqa: PLR0911
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              widget: widgets.QWidget | Literal["global", "parent", "window"],
                                                                                                                                                                                                                                                                                                              pos_or_rect: (
                                                                                                                                                                                                                                                                                                                  datatypes.PointType
                                                                                                                                                                                                                                                                                                                  | datatypes.RectType
                                                                                                                                                                                                                                                                                                                  | datatypes.PointFType
                                                                                                                                                                                                                                                                                                                  | datatypes.RectFType
                                                                                                                                                                                                                                                                                                              ),
                                                                                                                                                                                                                                                                                                          ) -> core.QRect | core.QRectF | core.QPoint | core.QPointF:
                                                                                                                                                                                                                                                                                                              """Map a point or rect from a widget, global position or parent.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Arguments:
                                                                                                                                                                                                                                                                                                                  widget: What to map from.
                                                                                                                                                                                                                                                                                                                  pos_or_rect: Point or rect to map.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              match pos_or_rect:
                                                                                                                                                                                                                                                                                                                  case int(), int():
                                                                                                                                                                                                                                                                                                                      pos_or_rect = core.QPoint(*pos_or_rect)
                                                                                                                                                                                                                                                                                                                  case float(), float():
                                                                                                                                                                                                                                                                                                                      pos_or_rect = core.QPointF(*pos_or_rect)
                                                                                                                                                                                                                                                                                                                  case int(), int(), int(), int():
                                                                                                                                                                                                                                                                                                                      pos_or_rect = core.QRect(*pos_or_rect)
                                                                                                                                                                                                                                                                                                                  case float(), float(), float(), float():
                                                                                                                                                                                                                                                                                                                      pos_or_rect = core.QRectF(*pos_or_rect)
                                                                                                                                                                                                                                                                                                              match pos_or_rect, widget:
                                                                                                                                                                                                                                                                                                                  case core.QRect() | core.QRectF(), widgets.QWidget():
                                                                                                                                                                                                                                                                                                                      top_left = super().mapFrom(widget, pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                      bottom_right = super().mapFrom(widget, pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                      return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                  case core.QPoint() | core.QPointF(), widgets.QWidget():
                                                                                                                                                                                                                                                                                                                      return super().mapFrom(widget, pos_or_rect)
                                                                                                                                                                                                                                                                                                                  case core.QRect() | core.QRectF(), "parent":
                                                                                                                                                                                                                                                                                                                      top_left = super().mapFromParent(pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                      bottom_right = super().mapFromParent(pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                      return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                  case core.QPoint() | core.QPointF(), "parent":
                                                                                                                                                                                                                                                                                                                      return super().mapFromParent(pos_or_rect)
                                                                                                                                                                                                                                                                                                                  case core.QRect() | core.QRectF(), "window":
                                                                                                                                                                                                                                                                                                                      top_left = super().mapFrom(self.window(), pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                      bottom_right = super().mapFrom(self.window(), pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                      return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                  case core.QPoint() | core.QPointF(), "window":
                                                                                                                                                                                                                                                                                                                      return super().mapFrom(self.window(), pos_or_rect)
                                                                                                                                                                                                                                                                                                                  case core.QRect() | core.QRectF(), "global":
                                                                                                                                                                                                                                                                                                                      top_left = super().mapFromGlobal(pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                      bottom_right = super().mapFromGlobal(pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                      return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                  case core.QPoint() | core.QPointF(), "global":
                                                                                                                                                                                                                                                                                                                      return super().mapFromGlobal(pos_or_rect)
                                                                                                                                                                                                                                                                                                                  case _:
                                                                                                                                                                                                                                                                                                                      raise ValueError(pos_or_rect)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          map_to(widget: widgets.QWidget | Literal['global', 'parent', 'window'], pos_or_rect: datatypes.PointType | datatypes.RectType | datatypes.PointFType | datatypes.RectFType) -> core.QRect | core.QRectF | core.QPoint | core.QPointF

                                                                                                                                                                                                                                                                                                          Map a point or rect to a widget, global position or parent.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          widget QWidget | Literal['global', 'parent', 'window']

                                                                                                                                                                                                                                                                                                          What to map to.

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          pos_or_rect PointType | RectType | PointFType | RectFType

                                                                                                                                                                                                                                                                                                          Point or rect to map.

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def map_to(  # noqa: PLR0911
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              widget: widgets.QWidget | Literal["global", "parent", "window"],
                                                                                                                                                                                                                                                                                                              pos_or_rect: (
                                                                                                                                                                                                                                                                                                                  datatypes.PointType
                                                                                                                                                                                                                                                                                                                  | datatypes.RectType
                                                                                                                                                                                                                                                                                                                  | datatypes.PointFType
                                                                                                                                                                                                                                                                                                                  | datatypes.RectFType
                                                                                                                                                                                                                                                                                                              ),
                                                                                                                                                                                                                                                                                                          ) -> core.QRect | core.QRectF | core.QPoint | core.QPointF:
                                                                                                                                                                                                                                                                                                              """Map a point or rect to a widget, global position or parent.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Arguments:
                                                                                                                                                                                                                                                                                                                  widget: What to map to.
                                                                                                                                                                                                                                                                                                                  pos_or_rect: Point or rect to map.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              match pos_or_rect:
                                                                                                                                                                                                                                                                                                                  case int(), int():
                                                                                                                                                                                                                                                                                                                      pos_or_rect = core.QPoint(*pos_or_rect)
                                                                                                                                                                                                                                                                                                                  case float(), float():
                                                                                                                                                                                                                                                                                                                      pos_or_rect = core.QPointF(*pos_or_rect)
                                                                                                                                                                                                                                                                                                                  case int(), int(), int(), int():
                                                                                                                                                                                                                                                                                                                      pos_or_rect = core.QRect(*pos_or_rect)
                                                                                                                                                                                                                                                                                                                  case float(), float(), float(), float():
                                                                                                                                                                                                                                                                                                                      pos_or_rect = core.QRectF(*pos_or_rect)
                                                                                                                                                                                                                                                                                                              match pos_or_rect, widget:
                                                                                                                                                                                                                                                                                                                  case core.QRect() | core.QRectF(), widgets.QWidget():
                                                                                                                                                                                                                                                                                                                      top_left = super().mapTo(widget, pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                      bottom_right = super().mapTo(widget, pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                      return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                  case core.QPoint() | core.QPointF(), widgets.QWidget():
                                                                                                                                                                                                                                                                                                                      return super().mapTo(widget, pos_or_rect)
                                                                                                                                                                                                                                                                                                                  case core.QRect() | core.QRectF(), "parent":
                                                                                                                                                                                                                                                                                                                      top_left = super().mapToParent(pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                      bottom_right = super().mapToParent(pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                      return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                  case core.QPoint() | core.QPointF(), "parent":
                                                                                                                                                                                                                                                                                                                      return super().mapToParent(pos_or_rect)
                                                                                                                                                                                                                                                                                                                  case core.QRect() | core.QRectF(), "window":
                                                                                                                                                                                                                                                                                                                      top_left = super().mapTo(self.window(), pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                      bottom_right = super().mapTo(self.window(), pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                      return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                  case core.QPoint() | core.QPointF(), "window":
                                                                                                                                                                                                                                                                                                                      return super().mapTo(self.window(), pos_or_rect)
                                                                                                                                                                                                                                                                                                                  case core.QRect() | core.QRectF(), "global":
                                                                                                                                                                                                                                                                                                                      top_left = super().mapToGlobal(pos_or_rect.topLeft())
                                                                                                                                                                                                                                                                                                                      bottom_right = super().mapToGlobal(pos_or_rect.bottomRight())
                                                                                                                                                                                                                                                                                                                      return _rect_like(pos_or_rect, top_left, bottom_right)
                                                                                                                                                                                                                                                                                                                  case core.QPoint() | core.QPointF(), "global":
                                                                                                                                                                                                                                                                                                                      return super().mapToGlobal(pos_or_rect)
                                                                                                                                                                                                                                                                                                                  case _:
                                                                                                                                                                                                                                                                                                                      raise ValueError(pos_or_rect)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          position_on(where: PositionPossibilityType, how: Literal['center', 'top', 'left', 'bottom', 'right', 'top_left', 'top_right', 'bottom_left', 'bottom_right'] = 'center', *, scale_ratio: float | None = None, x_offset: int = 0, y_offset: int = 0)

                                                                                                                                                                                                                                                                                                          Position widget on another widget / window / screen.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          where PositionPossibilityType

                                                                                                                                                                                                                                                                                                          where to positin on

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          how Literal['center', 'top', 'left', 'bottom', 'right', 'top_left', 'top_right', 'bottom_left', 'bottom_right']

                                                                                                                                                                                                                                                                                                          How to align

                                                                                                                                                                                                                                                                                                          'center'
                                                                                                                                                                                                                                                                                                          scale_ratio float | None

                                                                                                                                                                                                                                                                                                          Resize to scale_ratio * target size

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          x_offset int

                                                                                                                                                                                                                                                                                                          additional x offset for final position

                                                                                                                                                                                                                                                                                                          0
                                                                                                                                                                                                                                                                                                          y_offset int

                                                                                                                                                                                                                                                                                                          additional y offset for final position

                                                                                                                                                                                                                                                                                                          0
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def position_on(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              where: PositionPossibilityType,
                                                                                                                                                                                                                                                                                                              how: Literal[
                                                                                                                                                                                                                                                                                                                  "center",
                                                                                                                                                                                                                                                                                                                  "top",
                                                                                                                                                                                                                                                                                                                  "left",
                                                                                                                                                                                                                                                                                                                  "bottom",
                                                                                                                                                                                                                                                                                                                  "right",
                                                                                                                                                                                                                                                                                                                  "top_left",
                                                                                                                                                                                                                                                                                                                  "top_right",
                                                                                                                                                                                                                                                                                                                  "bottom_left",
                                                                                                                                                                                                                                                                                                                  "bottom_right",
                                                                                                                                                                                                                                                                                                              ] = "center",
                                                                                                                                                                                                                                                                                                              *,
                                                                                                                                                                                                                                                                                                              scale_ratio: float | None = None,
                                                                                                                                                                                                                                                                                                              x_offset: int = 0,
                                                                                                                                                                                                                                                                                                              y_offset: int = 0,
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Position widget on another widget / window / screen.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Arguments:
                                                                                                                                                                                                                                                                                                                  where: where to positin on
                                                                                                                                                                                                                                                                                                                  how: How to align
                                                                                                                                                                                                                                                                                                                  scale_ratio: Resize to scale_ratio * target size
                                                                                                                                                                                                                                                                                                                  x_offset: additional x offset for final position
                                                                                                                                                                                                                                                                                                                  y_offset: additional y offset for final position
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              do_scale = True
                                                                                                                                                                                                                                                                                                              match where:
                                                                                                                                                                                                                                                                                                                  case "mouse":
                                                                                                                                                                                                                                                                                                                      geom = core.Rect(gui.Cursor.pos(), gui.Cursor.pos())
                                                                                                                                                                                                                                                                                                                      do_scale = False
                                                                                                                                                                                                                                                                                                                  case core.QPoint():
                                                                                                                                                                                                                                                                                                                      geom = core.Rect(where, where)
                                                                                                                                                                                                                                                                                                                      do_scale = False
                                                                                                                                                                                                                                                                                                                  case (int(), int()):
                                                                                                                                                                                                                                                                                                                      p = core.Point(*where)
                                                                                                                                                                                                                                                                                                                      geom = core.Rect(p, p)
                                                                                                                                                                                                                                                                                                                      do_scale = False
                                                                                                                                                                                                                                                                                                                  case (int(), int(), int(), int()):
                                                                                                                                                                                                                                                                                                                      geom = core.Rect(*where)
                                                                                                                                                                                                                                                                                                                  case "parent":
                                                                                                                                                                                                                                                                                                                      if (parent := self.parentWidget()) is None:
                                                                                                                                                                                                                                                                                                                          raise ValueError(where)
                                                                                                                                                                                                                                                                                                                      geom = parent.frameGeometry()
                                                                                                                                                                                                                                                                                                                  case "window":
                                                                                                                                                                                                                                                                                                                      geom = self.window().frameGeometry()
                                                                                                                                                                                                                                                                                                                  case widgets.QWidget():
                                                                                                                                                                                                                                                                                                                      geom = where.frameGeometry()
                                                                                                                                                                                                                                                                                                                  case core.QRect():
                                                                                                                                                                                                                                                                                                                      geom = where
                                                                                                                                                                                                                                                                                                                  case "screen":
                                                                                                                                                                                                                                                                                                                      geom = gui.GuiApplication.primaryScreen().geometry()
                                                                                                                                                                                                                                                                                                                  case _:
                                                                                                                                                                                                                                                                                                                      raise ValueError(where)
                                                                                                                                                                                                                                                                                                              if scale_ratio is not None and do_scale:
                                                                                                                                                                                                                                                                                                                  self.resize(
                                                                                                                                                                                                                                                                                                                      int(geom.width() * scale_ratio),
                                                                                                                                                                                                                                                                                                                      int(geom.height() * scale_ratio),
                                                                                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                                                                                              own_geo = self.frameGeometry()
                                                                                                                                                                                                                                                                                                              match how:
                                                                                                                                                                                                                                                                                                                  case "center":
                                                                                                                                                                                                                                                                                                                      new = geom.center()
                                                                                                                                                                                                                                                                                                                  case "top":
                                                                                                                                                                                                                                                                                                                      new = core.Point(geom.center().x(), geom.top() + own_geo.height() // 2)
                                                                                                                                                                                                                                                                                                                  case "bottom":
                                                                                                                                                                                                                                                                                                                      new = core.Point(geom.center().x(), geom.bottom() - own_geo.height() // 2)
                                                                                                                                                                                                                                                                                                                  case "left":
                                                                                                                                                                                                                                                                                                                      new = core.Point(geom.left() + own_geo.width() // 2, geom.center().y())
                                                                                                                                                                                                                                                                                                                  case "right":
                                                                                                                                                                                                                                                                                                                      new = core.Point(geom.right() - own_geo.width() // 2, geom.center().y())
                                                                                                                                                                                                                                                                                                                  case "top_right":
                                                                                                                                                                                                                                                                                                                      new = core.Point(
                                                                                                                                                                                                                                                                                                                          geom.right() - own_geo.width() // 2,
                                                                                                                                                                                                                                                                                                                          geom.top() + own_geo.height() // 2,
                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                                  case "top_left":
                                                                                                                                                                                                                                                                                                                      new = core.Point(
                                                                                                                                                                                                                                                                                                                          geom.left() + own_geo.width() // 2,
                                                                                                                                                                                                                                                                                                                          geom.top() + own_geo.height() // 2,
                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                                  case "bottom_right":
                                                                                                                                                                                                                                                                                                                      new = core.Point(
                                                                                                                                                                                                                                                                                                                          geom.right() - own_geo.width() // 2,
                                                                                                                                                                                                                                                                                                                          geom.bottom() - own_geo.height() // 2,
                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                                  case "bottom_left":
                                                                                                                                                                                                                                                                                                                      new = core.Point(
                                                                                                                                                                                                                                                                                                                          geom.left() + own_geo.width() // 2,
                                                                                                                                                                                                                                                                                                                          geom.bottom() - own_geo.height() // 2,
                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                                  case _:
                                                                                                                                                                                                                                                                                                                      raise ValueError(how)
                                                                                                                                                                                                                                                                                                              new = core.Point(new.x() + x_offset, new.y() + y_offset)
                                                                                                                                                                                                                                                                                                              own_geo.moveCenter(new)
                                                                                                                                                                                                                                                                                                              self.move(own_geo.topLeft())
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          raise_to_top()

                                                                                                                                                                                                                                                                                                          Brings a widget to top with all means available.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def raise_to_top(self):
                                                                                                                                                                                                                                                                                                              """Brings a widget to top with all means available."""
                                                                                                                                                                                                                                                                                                              if sys.platform.startswith("win"):
                                                                                                                                                                                                                                                                                                                  from prettyqt.utils.platforms.windows import misc
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                  misc.raise_to_top(self.winId())
                                                                                                                                                                                                                                                                                                              # state = (self.windowState() & ~Qt.WindowMinimized) | Qt.WindowActive
                                                                                                                                                                                                                                                                                                              # self.setWindowState(state)
                                                                                                                                                                                                                                                                                                              self.raise_()
                                                                                                                                                                                                                                                                                                              self.show()
                                                                                                                                                                                                                                                                                                              self.activateWindow()
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_attributes(*, accept_drops: bool | None = None, always_show_tooltips: bool | None = None, custom_whats_this: bool | None = None, delete_on_close: bool | None = None, disabled: bool | None = None, dont_show_on_screen: bool | None = None, force_disabled: bool | None = None, force_updates_disabled: bool | None = None, hover: bool | None = None, input_method_enabled: bool | None = None, keyboard_focus_change: bool | None = None, key_compression: bool | None = None, layout_on_entire_rect: bool | None = None, layout_uses_widget_rect: bool | None = None, mapped: bool | None = None, mouse_no_mask: bool | None = None, mouse_tracking: bool | None = None, moved: bool | None = None, no_child_events_for_parent: bool | None = None, no_child_events_from_children: bool | None = None, no_mouse_replay: bool | None = None, no_mouse_propagation: bool | None = None, transparent_for_mouse_events: bool | None = None, no_system_background: bool | None = None, opaque_paint_event: bool | None = None, outside_ws_range: bool | None = None, paint_on_screen: bool | None = None, paint_unclipped: bool | None = None, pending_move_event: bool | None = None, pending_resize_egent: bool | None = None, quit_on_close: bool | None = None, resized: bool | None = None, right_to_left: bool | None = None, set_cursor: bool | None = None, set_font: bool | None = None, set_palette: bool | None = None, set_style: bool | None = None, static_contents: bool | None = None, style_sheet: bool | None = None, style_sheet_target: bool | None = None, tablet_tracking: bool | None = None, translucent_background: bool | None = None, under_mouse: bool | None = None, updates_disabled: bool | None = None, window_modified: bool | None = None, window_propagation: bool | None = None, mac_always_show_tool_window: bool | None = None, set_locale: bool | None = None, styled_background: bool | None = None, show_without_activating: bool | None = None, native_window: bool | None = None, dont_create_native_ancestors: bool | None = None, accept_touch_events: bool | None = None, touch_pad_single_touch_events: bool | None = None, always_stack_on_top: bool | None = None, contents_margins_respects_safe_area: bool | None = None)

                                                                                                                                                                                                                                                                                                          Set window attributes.

                                                                                                                                                                                                                                                                                                          Attributes:

                                                                                                                                                                                                                                                                                                          Name Type Description
                                                                                                                                                                                                                                                                                                          accept_drops

                                                                                                                                                                                                                                                                                                          set AcceptDrops attribute

                                                                                                                                                                                                                                                                                                          always_show_tooltips

                                                                                                                                                                                                                                                                                                          set AlwaysShowToolTips attribute

                                                                                                                                                                                                                                                                                                          custom_whats_this

                                                                                                                                                                                                                                                                                                          set CustomWhatsThis attribute

                                                                                                                                                                                                                                                                                                          delete_on_close

                                                                                                                                                                                                                                                                                                          set DeleteOnClose attribute

                                                                                                                                                                                                                                                                                                          disabled

                                                                                                                                                                                                                                                                                                          set Disabled attribute

                                                                                                                                                                                                                                                                                                          dont_show_on_screen

                                                                                                                                                                                                                                                                                                          set DontShowOnScreen attribute

                                                                                                                                                                                                                                                                                                          force_disabled

                                                                                                                                                                                                                                                                                                          set ForceDisabled attribute

                                                                                                                                                                                                                                                                                                          force_updates_disabled

                                                                                                                                                                                                                                                                                                          set ForceUpdatesDisabled attribute

                                                                                                                                                                                                                                                                                                          hover

                                                                                                                                                                                                                                                                                                          set Hover attribute

                                                                                                                                                                                                                                                                                                          input_method_enabled

                                                                                                                                                                                                                                                                                                          set InputMethodEnabled attribute

                                                                                                                                                                                                                                                                                                          keyboard_focus_change

                                                                                                                                                                                                                                                                                                          set KeyboardFocusChange attribute

                                                                                                                                                                                                                                                                                                          key_compression

                                                                                                                                                                                                                                                                                                          set KeyCompression attribute

                                                                                                                                                                                                                                                                                                          layout_on_entire_rect

                                                                                                                                                                                                                                                                                                          set LayoutOnEntireRect attribute

                                                                                                                                                                                                                                                                                                          layout_uses_widget_rect

                                                                                                                                                                                                                                                                                                          set LayoutUsesWidgetRect attribute

                                                                                                                                                                                                                                                                                                          mapped

                                                                                                                                                                                                                                                                                                          set Mapped attribute

                                                                                                                                                                                                                                                                                                          mouse_no_mask

                                                                                                                                                                                                                                                                                                          set MouseNoMask attribute

                                                                                                                                                                                                                                                                                                          mouse_tracking

                                                                                                                                                                                                                                                                                                          set MouseTracking attribute

                                                                                                                                                                                                                                                                                                          moved

                                                                                                                                                                                                                                                                                                          set Moved attribute

                                                                                                                                                                                                                                                                                                          no_child_events_for_parent

                                                                                                                                                                                                                                                                                                          set NoChildEventsForParent attribute

                                                                                                                                                                                                                                                                                                          no_child_events_from_children

                                                                                                                                                                                                                                                                                                          set NoChildEventsFromChildren attribute

                                                                                                                                                                                                                                                                                                          no_mouse_replay

                                                                                                                                                                                                                                                                                                          set NoMouseReplay attribute

                                                                                                                                                                                                                                                                                                          no_mouse_propagation

                                                                                                                                                                                                                                                                                                          set NoMousePropagation attribute

                                                                                                                                                                                                                                                                                                          transparent_for_mouse_events

                                                                                                                                                                                                                                                                                                          set TransparentForMouseEvents attribute

                                                                                                                                                                                                                                                                                                          no_system_background

                                                                                                                                                                                                                                                                                                          set NoSystemBackground attribute

                                                                                                                                                                                                                                                                                                          opaque_paint_event

                                                                                                                                                                                                                                                                                                          set OpaquePaintEvent attribute

                                                                                                                                                                                                                                                                                                          outside_ws_range

                                                                                                                                                                                                                                                                                                          set OutsideWSRange attribute

                                                                                                                                                                                                                                                                                                          paint_on_screen

                                                                                                                                                                                                                                                                                                          set PaintOnScreen attribute

                                                                                                                                                                                                                                                                                                          paint_unclipped

                                                                                                                                                                                                                                                                                                          set PaintUnclipped attribute

                                                                                                                                                                                                                                                                                                          pending_move_event

                                                                                                                                                                                                                                                                                                          set PendingMoveEvent attribute

                                                                                                                                                                                                                                                                                                          pending_resize_egent

                                                                                                                                                                                                                                                                                                          set PendingResizeEvent attribute

                                                                                                                                                                                                                                                                                                          quit_on_close

                                                                                                                                                                                                                                                                                                          set QuitOnClose attribute

                                                                                                                                                                                                                                                                                                          resized

                                                                                                                                                                                                                                                                                                          set Resized attribute

                                                                                                                                                                                                                                                                                                          right_to_left

                                                                                                                                                                                                                                                                                                          set RightToLeft attribute

                                                                                                                                                                                                                                                                                                          set_cursor

                                                                                                                                                                                                                                                                                                          set SetCursor attribute

                                                                                                                                                                                                                                                                                                          set_font

                                                                                                                                                                                                                                                                                                          set SetFont attribute

                                                                                                                                                                                                                                                                                                          set_palette

                                                                                                                                                                                                                                                                                                          set SetPalette attribute

                                                                                                                                                                                                                                                                                                          set_style

                                                                                                                                                                                                                                                                                                          set SetStyle attribute

                                                                                                                                                                                                                                                                                                          static_contents

                                                                                                                                                                                                                                                                                                          set StaticContents attribute

                                                                                                                                                                                                                                                                                                          style_sheet

                                                                                                                                                                                                                                                                                                          set StyleSheet attribute

                                                                                                                                                                                                                                                                                                          style_sheet_target

                                                                                                                                                                                                                                                                                                          set StyleSheetTarget attribute

                                                                                                                                                                                                                                                                                                          tablet_tracking

                                                                                                                                                                                                                                                                                                          set TabletTracking attribute

                                                                                                                                                                                                                                                                                                          translucent_background

                                                                                                                                                                                                                                                                                                          set TranslucentBackground attribute

                                                                                                                                                                                                                                                                                                          under_mouse

                                                                                                                                                                                                                                                                                                          set UnderMouse attribute

                                                                                                                                                                                                                                                                                                          updates_disabled

                                                                                                                                                                                                                                                                                                          set UpdatesDisabled attribute

                                                                                                                                                                                                                                                                                                          window_modified

                                                                                                                                                                                                                                                                                                          set WindowModified attribute

                                                                                                                                                                                                                                                                                                          window_propagation

                                                                                                                                                                                                                                                                                                          set WindowPropagation attribute

                                                                                                                                                                                                                                                                                                          mac_always_show_tool_window

                                                                                                                                                                                                                                                                                                          set MacAlwaysShowToolWindow attribute

                                                                                                                                                                                                                                                                                                          set_locale

                                                                                                                                                                                                                                                                                                          set SetLocale attribute

                                                                                                                                                                                                                                                                                                          styled_background

                                                                                                                                                                                                                                                                                                          set StyledBackground attribute

                                                                                                                                                                                                                                                                                                          show_without_activating

                                                                                                                                                                                                                                                                                                          set ShowWithoutActivating attribute

                                                                                                                                                                                                                                                                                                          native_window

                                                                                                                                                                                                                                                                                                          set NativeWindow attribute

                                                                                                                                                                                                                                                                                                          dont_create_native_ancestors

                                                                                                                                                                                                                                                                                                          set DontCreateNativeAncestors attribute

                                                                                                                                                                                                                                                                                                          accept_touch_events

                                                                                                                                                                                                                                                                                                          set AcceptTouchEvents attribute

                                                                                                                                                                                                                                                                                                          touch_pad_single_touch_events

                                                                                                                                                                                                                                                                                                          set TouchPadAcceptSingleTouchEvents attribute

                                                                                                                                                                                                                                                                                                          always_stack_on_top

                                                                                                                                                                                                                                                                                                          set AlwaysStackOnTop attribute

                                                                                                                                                                                                                                                                                                          contents_margins_respects_safe_area

                                                                                                                                                                                                                                                                                                          set ContentsMarginsRespectsSafeArea attribute

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_attributes(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              *,
                                                                                                                                                                                                                                                                                                              accept_drops: bool | None = None,
                                                                                                                                                                                                                                                                                                              always_show_tooltips: bool | None = None,
                                                                                                                                                                                                                                                                                                              custom_whats_this: bool | None = None,
                                                                                                                                                                                                                                                                                                              delete_on_close: bool | None = None,
                                                                                                                                                                                                                                                                                                              disabled: bool | None = None,
                                                                                                                                                                                                                                                                                                              dont_show_on_screen: bool | None = None,
                                                                                                                                                                                                                                                                                                              force_disabled: bool | None = None,
                                                                                                                                                                                                                                                                                                              force_updates_disabled: bool | None = None,
                                                                                                                                                                                                                                                                                                              hover: bool | None = None,
                                                                                                                                                                                                                                                                                                              input_method_enabled: bool | None = None,
                                                                                                                                                                                                                                                                                                              keyboard_focus_change: bool | None = None,
                                                                                                                                                                                                                                                                                                              key_compression: bool | None = None,
                                                                                                                                                                                                                                                                                                              layout_on_entire_rect: bool | None = None,
                                                                                                                                                                                                                                                                                                              layout_uses_widget_rect: bool | None = None,
                                                                                                                                                                                                                                                                                                              mapped: bool | None = None,
                                                                                                                                                                                                                                                                                                              mouse_no_mask: bool | None = None,
                                                                                                                                                                                                                                                                                                              mouse_tracking: bool | None = None,
                                                                                                                                                                                                                                                                                                              moved: bool | None = None,
                                                                                                                                                                                                                                                                                                              no_child_events_for_parent: bool | None = None,
                                                                                                                                                                                                                                                                                                              no_child_events_from_children: bool | None = None,
                                                                                                                                                                                                                                                                                                              no_mouse_replay: bool | None = None,
                                                                                                                                                                                                                                                                                                              no_mouse_propagation: bool | None = None,
                                                                                                                                                                                                                                                                                                              transparent_for_mouse_events: bool | None = None,
                                                                                                                                                                                                                                                                                                              no_system_background: bool | None = None,
                                                                                                                                                                                                                                                                                                              opaque_paint_event: bool | None = None,
                                                                                                                                                                                                                                                                                                              outside_ws_range: bool | None = None,
                                                                                                                                                                                                                                                                                                              paint_on_screen: bool | None = None,
                                                                                                                                                                                                                                                                                                              paint_unclipped: bool | None = None,
                                                                                                                                                                                                                                                                                                              pending_move_event: bool | None = None,
                                                                                                                                                                                                                                                                                                              pending_resize_egent: bool | None = None,
                                                                                                                                                                                                                                                                                                              quit_on_close: bool | None = None,
                                                                                                                                                                                                                                                                                                              resized: bool | None = None,
                                                                                                                                                                                                                                                                                                              right_to_left: bool | None = None,
                                                                                                                                                                                                                                                                                                              set_cursor: bool | None = None,
                                                                                                                                                                                                                                                                                                              set_font: bool | None = None,
                                                                                                                                                                                                                                                                                                              set_palette: bool | None = None,
                                                                                                                                                                                                                                                                                                              set_style: bool | None = None,
                                                                                                                                                                                                                                                                                                              static_contents: bool | None = None,
                                                                                                                                                                                                                                                                                                              style_sheet: bool | None = None,
                                                                                                                                                                                                                                                                                                              style_sheet_target: bool | None = None,
                                                                                                                                                                                                                                                                                                              tablet_tracking: bool | None = None,
                                                                                                                                                                                                                                                                                                              translucent_background: bool | None = None,
                                                                                                                                                                                                                                                                                                              under_mouse: bool | None = None,
                                                                                                                                                                                                                                                                                                              updates_disabled: bool | None = None,
                                                                                                                                                                                                                                                                                                              window_modified: bool | None = None,
                                                                                                                                                                                                                                                                                                              window_propagation: bool | None = None,
                                                                                                                                                                                                                                                                                                              mac_always_show_tool_window: bool | None = None,
                                                                                                                                                                                                                                                                                                              set_locale: bool | None = None,
                                                                                                                                                                                                                                                                                                              styled_background: bool | None = None,
                                                                                                                                                                                                                                                                                                              show_without_activating: bool | None = None,
                                                                                                                                                                                                                                                                                                              native_window: bool | None = None,
                                                                                                                                                                                                                                                                                                              dont_create_native_ancestors: bool | None = None,
                                                                                                                                                                                                                                                                                                              accept_touch_events: bool | None = None,
                                                                                                                                                                                                                                                                                                              touch_pad_single_touch_events: bool | None = None,
                                                                                                                                                                                                                                                                                                              always_stack_on_top: bool | None = None,
                                                                                                                                                                                                                                                                                                              contents_margins_respects_safe_area: bool | None = None,
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set window attributes.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Attributes:
                                                                                                                                                                                                                                                                                                                  accept_drops: set AcceptDrops attribute
                                                                                                                                                                                                                                                                                                                  always_show_tooltips: set AlwaysShowToolTips attribute
                                                                                                                                                                                                                                                                                                                  custom_whats_this: set CustomWhatsThis attribute
                                                                                                                                                                                                                                                                                                                  delete_on_close: set DeleteOnClose attribute
                                                                                                                                                                                                                                                                                                                  disabled: set Disabled attribute
                                                                                                                                                                                                                                                                                                                  dont_show_on_screen: set DontShowOnScreen attribute
                                                                                                                                                                                                                                                                                                                  force_disabled: set ForceDisabled attribute
                                                                                                                                                                                                                                                                                                                  force_updates_disabled: set ForceUpdatesDisabled attribute
                                                                                                                                                                                                                                                                                                                  hover: set Hover attribute
                                                                                                                                                                                                                                                                                                                  input_method_enabled: set InputMethodEnabled attribute
                                                                                                                                                                                                                                                                                                                  keyboard_focus_change: set KeyboardFocusChange attribute
                                                                                                                                                                                                                                                                                                                  key_compression: set KeyCompression attribute
                                                                                                                                                                                                                                                                                                                  layout_on_entire_rect: set LayoutOnEntireRect attribute
                                                                                                                                                                                                                                                                                                                  layout_uses_widget_rect: set LayoutUsesWidgetRect attribute
                                                                                                                                                                                                                                                                                                                  mapped: set Mapped attribute
                                                                                                                                                                                                                                                                                                                  mouse_no_mask: set MouseNoMask attribute
                                                                                                                                                                                                                                                                                                                  mouse_tracking: set MouseTracking attribute
                                                                                                                                                                                                                                                                                                                  moved: set Moved attribute
                                                                                                                                                                                                                                                                                                                  no_child_events_for_parent: set NoChildEventsForParent attribute
                                                                                                                                                                                                                                                                                                                  no_child_events_from_children: set NoChildEventsFromChildren attribute
                                                                                                                                                                                                                                                                                                                  no_mouse_replay: set NoMouseReplay attribute
                                                                                                                                                                                                                                                                                                                  no_mouse_propagation: set NoMousePropagation attribute
                                                                                                                                                                                                                                                                                                                  transparent_for_mouse_events: set TransparentForMouseEvents attribute
                                                                                                                                                                                                                                                                                                                  no_system_background: set NoSystemBackground attribute
                                                                                                                                                                                                                                                                                                                  opaque_paint_event: set OpaquePaintEvent attribute
                                                                                                                                                                                                                                                                                                                  outside_ws_range: set OutsideWSRange attribute
                                                                                                                                                                                                                                                                                                                  paint_on_screen: set PaintOnScreen attribute
                                                                                                                                                                                                                                                                                                                  paint_unclipped: set PaintUnclipped attribute
                                                                                                                                                                                                                                                                                                                  pending_move_event: set PendingMoveEvent attribute
                                                                                                                                                                                                                                                                                                                  pending_resize_egent: set PendingResizeEvent attribute
                                                                                                                                                                                                                                                                                                                  quit_on_close: set QuitOnClose attribute
                                                                                                                                                                                                                                                                                                                  resized: set Resized attribute
                                                                                                                                                                                                                                                                                                                  right_to_left: set RightToLeft attribute
                                                                                                                                                                                                                                                                                                                  set_cursor: set SetCursor attribute
                                                                                                                                                                                                                                                                                                                  set_font: set SetFont attribute
                                                                                                                                                                                                                                                                                                                  set_palette: set SetPalette attribute
                                                                                                                                                                                                                                                                                                                  set_style: set SetStyle attribute
                                                                                                                                                                                                                                                                                                                  static_contents: set StaticContents attribute
                                                                                                                                                                                                                                                                                                                  style_sheet: set StyleSheet attribute
                                                                                                                                                                                                                                                                                                                  style_sheet_target: set StyleSheetTarget attribute
                                                                                                                                                                                                                                                                                                                  tablet_tracking: set TabletTracking attribute
                                                                                                                                                                                                                                                                                                                  translucent_background: set TranslucentBackground attribute
                                                                                                                                                                                                                                                                                                                  under_mouse: set UnderMouse attribute
                                                                                                                                                                                                                                                                                                                  updates_disabled: set UpdatesDisabled attribute
                                                                                                                                                                                                                                                                                                                  window_modified: set WindowModified attribute
                                                                                                                                                                                                                                                                                                                  window_propagation: set WindowPropagation attribute
                                                                                                                                                                                                                                                                                                                  mac_always_show_tool_window: set MacAlwaysShowToolWindow attribute
                                                                                                                                                                                                                                                                                                                  set_locale: set SetLocale attribute
                                                                                                                                                                                                                                                                                                                  styled_background: set StyledBackground attribute
                                                                                                                                                                                                                                                                                                                  show_without_activating: set ShowWithoutActivating attribute
                                                                                                                                                                                                                                                                                                                  native_window: set NativeWindow attribute
                                                                                                                                                                                                                                                                                                                  dont_create_native_ancestors: set DontCreateNativeAncestors attribute
                                                                                                                                                                                                                                                                                                                  accept_touch_events: set AcceptTouchEvents attribute
                                                                                                                                                                                                                                                                                                                  touch_pad_single_touch_events: set TouchPadAcceptSingleTouchEvents attribute
                                                                                                                                                                                                                                                                                                                  always_stack_on_top: set AlwaysStackOnTop attribute
                                                                                                                                                                                                                                                                                                                  contents_margins_respects_safe_area: set ContentsMarginsRespectsSafeArea
                                                                                                                                                                                                                                                                                                                                                       attribute
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              Attr = constants.WidgetAttribute  # noqa: N806
                                                                                                                                                                                                                                                                                                              flags = {
                                                                                                                                                                                                                                                                                                                  Attr.WA_AcceptDrops: accept_drops,
                                                                                                                                                                                                                                                                                                                  Attr.WA_AlwaysShowToolTips: always_show_tooltips,
                                                                                                                                                                                                                                                                                                                  Attr.WA_CustomWhatsThis: custom_whats_this,
                                                                                                                                                                                                                                                                                                                  Attr.WA_DeleteOnClose: delete_on_close,
                                                                                                                                                                                                                                                                                                                  Attr.WA_Disabled: disabled,
                                                                                                                                                                                                                                                                                                                  Attr.WA_DontShowOnScreen: dont_show_on_screen,
                                                                                                                                                                                                                                                                                                                  Attr.WA_ForceDisabled: force_disabled,
                                                                                                                                                                                                                                                                                                                  Attr.WA_ForceUpdatesDisabled: force_updates_disabled,
                                                                                                                                                                                                                                                                                                                  Attr.WA_Hover: hover,
                                                                                                                                                                                                                                                                                                                  Attr.WA_InputMethodEnabled: input_method_enabled,
                                                                                                                                                                                                                                                                                                                  Attr.WA_KeyboardFocusChange: keyboard_focus_change,
                                                                                                                                                                                                                                                                                                                  Attr.WA_KeyCompression: key_compression,
                                                                                                                                                                                                                                                                                                                  Attr.WA_LayoutOnEntireRect: layout_on_entire_rect,
                                                                                                                                                                                                                                                                                                                  Attr.WA_LayoutUsesWidgetRect: layout_uses_widget_rect,
                                                                                                                                                                                                                                                                                                                  Attr.WA_Mapped: mapped,
                                                                                                                                                                                                                                                                                                                  Attr.WA_MouseNoMask: mouse_no_mask,
                                                                                                                                                                                                                                                                                                                  Attr.WA_MouseTracking: mouse_tracking,
                                                                                                                                                                                                                                                                                                                  Attr.WA_Moved: moved,
                                                                                                                                                                                                                                                                                                                  Attr.WA_NoChildEventsForParent: no_child_events_for_parent,
                                                                                                                                                                                                                                                                                                                  Attr.WA_NoChildEventsFromChildren: no_child_events_from_children,
                                                                                                                                                                                                                                                                                                                  Attr.WA_NoMouseReplay: no_mouse_replay,
                                                                                                                                                                                                                                                                                                                  Attr.WA_NoMousePropagation: no_mouse_propagation,
                                                                                                                                                                                                                                                                                                                  Attr.WA_TransparentForMouseEvents: transparent_for_mouse_events,
                                                                                                                                                                                                                                                                                                                  Attr.WA_NoSystemBackground: no_system_background,
                                                                                                                                                                                                                                                                                                                  Attr.WA_OpaquePaintEvent: opaque_paint_event,
                                                                                                                                                                                                                                                                                                                  Attr.WA_OutsideWSRange: outside_ws_range,
                                                                                                                                                                                                                                                                                                                  Attr.WA_PaintOnScreen: paint_on_screen,
                                                                                                                                                                                                                                                                                                                  Attr.WA_PaintUnclipped: paint_unclipped,
                                                                                                                                                                                                                                                                                                                  Attr.WA_PendingMoveEvent: pending_move_event,
                                                                                                                                                                                                                                                                                                                  Attr.WA_PendingResizeEvent: pending_resize_egent,
                                                                                                                                                                                                                                                                                                                  Attr.WA_QuitOnClose: quit_on_close,
                                                                                                                                                                                                                                                                                                                  Attr.WA_Resized: resized,
                                                                                                                                                                                                                                                                                                                  Attr.WA_RightToLeft: right_to_left,
                                                                                                                                                                                                                                                                                                                  Attr.WA_SetCursor: set_cursor,
                                                                                                                                                                                                                                                                                                                  Attr.WA_SetFont: set_font,
                                                                                                                                                                                                                                                                                                                  Attr.WA_SetPalette: set_palette,
                                                                                                                                                                                                                                                                                                                  Attr.WA_SetStyle: set_style,
                                                                                                                                                                                                                                                                                                                  Attr.WA_StaticContents: static_contents,
                                                                                                                                                                                                                                                                                                                  Attr.WA_StyleSheet: style_sheet,
                                                                                                                                                                                                                                                                                                                  Attr.WA_StyleSheetTarget: style_sheet_target,
                                                                                                                                                                                                                                                                                                                  Attr.WA_TabletTracking: tablet_tracking,
                                                                                                                                                                                                                                                                                                                  Attr.WA_TranslucentBackground: translucent_background,
                                                                                                                                                                                                                                                                                                                  Attr.WA_UnderMouse: under_mouse,
                                                                                                                                                                                                                                                                                                                  Attr.WA_UpdatesDisabled: updates_disabled,
                                                                                                                                                                                                                                                                                                                  Attr.WA_WindowModified: window_modified,
                                                                                                                                                                                                                                                                                                                  Attr.WA_WindowPropagation: window_propagation,
                                                                                                                                                                                                                                                                                                                  Attr.WA_MacAlwaysShowToolWindow: mac_always_show_tool_window,
                                                                                                                                                                                                                                                                                                                  Attr.WA_SetLocale: set_locale,
                                                                                                                                                                                                                                                                                                                  Attr.WA_StyledBackground: styled_background,
                                                                                                                                                                                                                                                                                                                  Attr.WA_ShowWithoutActivating: show_without_activating,
                                                                                                                                                                                                                                                                                                                  Attr.WA_NativeWindow: native_window,
                                                                                                                                                                                                                                                                                                                  Attr.WA_DontCreateNativeAncestors: dont_create_native_ancestors,
                                                                                                                                                                                                                                                                                                                  Attr.WA_AcceptTouchEvents: accept_touch_events,
                                                                                                                                                                                                                                                                                                                  Attr.WA_TouchPadAcceptSingleTouchEvents: touch_pad_single_touch_events,
                                                                                                                                                                                                                                                                                                                  Attr.WA_AlwaysStackOnTop: always_stack_on_top,
                                                                                                                                                                                                                                                                                                                  Attr.WA_ContentsMarginsRespectsSafeArea: contents_margins_respects_safe_area,
                                                                                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                                                                                              for k, v in flags.items():
                                                                                                                                                                                                                                                                                                                  if v is not None:
                                                                                                                                                                                                                                                                                                                      self.setAttribute(k, v)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_background_role(role: gui.palette.RoleStr | gui.Palette.ColorRole)

                                                                                                                                                                                                                                                                                                          Get foreground role for this widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_background_role(self, role: gui.palette.RoleStr | gui.Palette.ColorRole):
                                                                                                                                                                                                                                                                                                              """Get foreground role for this widget."""
                                                                                                                                                                                                                                                                                                              self.setBackgroundRole(gui.palette.ROLE.get_enum_value(role))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_context_menu_policy(policy: constants.ContextPolicyStr | constants.ContextMenuPolicy)

                                                                                                                                                                                                                                                                                                          Set contextmenu policy for given item view.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          policy ContextPolicyStr | ContextMenuPolicy

                                                                                                                                                                                                                                                                                                          contextmenu policy to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_context_menu_policy(
                                                                                                                                                                                                                                                                                                              self, policy: constants.ContextPolicyStr | constants.ContextMenuPolicy
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set contextmenu policy for given item view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  policy: contextmenu policy to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setContextMenuPolicy(constants.CONTEXT_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_cursor(cursor: constants.CursorShapeStr | constants.CursorShape | gui.QCursor)

                                                                                                                                                                                                                                                                                                          Set the cursor for this widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_cursor(
                                                                                                                                                                                                                                                                                                              self, cursor: constants.CursorShapeStr | constants.CursorShape | gui.QCursor
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the cursor for this widget."""
                                                                                                                                                                                                                                                                                                              if isinstance(cursor, gui.QCursor):
                                                                                                                                                                                                                                                                                                                  curs = cursor
                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                  curs = gui.Cursor(constants.CURSOR_SHAPE.get_enum_value(cursor))
                                                                                                                                                                                                                                                                                                              self.setCursor(curs)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_flags(*, minimize: bool | None = None, maximize: bool | None = None, close: bool | None = None, stay_on_top: bool | None = None, frameless: bool | None = None, window: bool | None = None, dialog: bool | None = None, tooltip: bool | None = None, tool: bool | None = None, customize: bool | None = None, cover: bool | None = None, window_title: bool | None = None)

                                                                                                                                                                                                                                                                                                          Set window flags.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          minimize bool | None

                                                                                                                                                                                                                                                                                                          set WindowMinimizeButtonHint flag

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          maximize bool | None

                                                                                                                                                                                                                                                                                                          set WindowMaximizeButtonHint flag

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          close bool | None

                                                                                                                                                                                                                                                                                                          set WindowCloseButtonHint flag

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          stay_on_top bool | None

                                                                                                                                                                                                                                                                                                          set WindowStaysOnTopHint flag

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          frameless bool | None

                                                                                                                                                                                                                                                                                                          set FramelessWindowHint flag

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          window bool | None

                                                                                                                                                                                                                                                                                                          set Window flag

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          dialog bool | None

                                                                                                                                                                                                                                                                                                          set Dialog flag

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          tooltip bool | None

                                                                                                                                                                                                                                                                                                          set ToolTip flag

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          tool bool | None

                                                                                                                                                                                                                                                                                                          set Tool flag

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          customize bool | None

                                                                                                                                                                                                                                                                                                          set CustomizeWindowHint flag

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          cover bool | None

                                                                                                                                                                                                                                                                                                          set CoverWindow flag

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          window_title bool | None

                                                                                                                                                                                                                                                                                                          set WindowTitleHint flag

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_flags(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              *,
                                                                                                                                                                                                                                                                                                              minimize: bool | None = None,
                                                                                                                                                                                                                                                                                                              maximize: bool | None = None,
                                                                                                                                                                                                                                                                                                              close: bool | None = None,
                                                                                                                                                                                                                                                                                                              stay_on_top: bool | None = None,
                                                                                                                                                                                                                                                                                                              frameless: bool | None = None,
                                                                                                                                                                                                                                                                                                              window: bool | None = None,
                                                                                                                                                                                                                                                                                                              dialog: bool | None = None,
                                                                                                                                                                                                                                                                                                              tooltip: bool | None = None,
                                                                                                                                                                                                                                                                                                              tool: bool | None = None,
                                                                                                                                                                                                                                                                                                              customize: bool | None = None,
                                                                                                                                                                                                                                                                                                              cover: bool | None = None,
                                                                                                                                                                                                                                                                                                              window_title: bool | None = None,
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set window flags.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Arguments:
                                                                                                                                                                                                                                                                                                                  minimize: set WindowMinimizeButtonHint flag
                                                                                                                                                                                                                                                                                                                  maximize: set WindowMaximizeButtonHint flag
                                                                                                                                                                                                                                                                                                                  close: set WindowCloseButtonHint flag
                                                                                                                                                                                                                                                                                                                  stay_on_top: set WindowStaysOnTopHint flag
                                                                                                                                                                                                                                                                                                                  frameless: set FramelessWindowHint flag
                                                                                                                                                                                                                                                                                                                  window: set Window flag
                                                                                                                                                                                                                                                                                                                  dialog: set Dialog flag
                                                                                                                                                                                                                                                                                                                  tooltip: set ToolTip flag
                                                                                                                                                                                                                                                                                                                  tool: set Tool flag
                                                                                                                                                                                                                                                                                                                  customize: set CustomizeWindowHint flag
                                                                                                                                                                                                                                                                                                                  cover: set CoverWindow flag
                                                                                                                                                                                                                                                                                                                  window_title: set WindowTitleHint flag
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              flags = {
                                                                                                                                                                                                                                                                                                                  constants.WindowType.WindowMinimizeButtonHint: minimize,
                                                                                                                                                                                                                                                                                                                  constants.WindowType.WindowMaximizeButtonHint: maximize,
                                                                                                                                                                                                                                                                                                                  constants.WindowType.WindowCloseButtonHint: close,
                                                                                                                                                                                                                                                                                                                  constants.WindowType.WindowStaysOnTopHint: stay_on_top,
                                                                                                                                                                                                                                                                                                                  constants.WindowType.FramelessWindowHint: frameless,
                                                                                                                                                                                                                                                                                                                  constants.WindowType.Window: window,
                                                                                                                                                                                                                                                                                                                  constants.WindowType.Dialog: dialog,
                                                                                                                                                                                                                                                                                                                  constants.WindowType.ToolTip: tooltip,
                                                                                                                                                                                                                                                                                                                  constants.WindowType.Tool: tool,
                                                                                                                                                                                                                                                                                                                  constants.WindowType.CustomizeWindowHint: customize,
                                                                                                                                                                                                                                                                                                                  constants.WindowType.CoverWindow: cover,
                                                                                                                                                                                                                                                                                                                  constants.WindowType.WindowTitleHint: window_title,
                                                                                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                                                                                              for k, v in flags.items():
                                                                                                                                                                                                                                                                                                                  if v is not None:
                                                                                                                                                                                                                                                                                                                      self.setWindowFlag(k, v)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_focus_policy(policy: constants.FocusPolicyStr | constants.FocusPolicy)

                                                                                                                                                                                                                                                                                                          Set the way the widget accepts keyboard focus.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          policy str

                                                                                                                                                                                                                                                                                                          Focus policy

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_focus_policy(self, policy: constants.FocusPolicyStr | constants.FocusPolicy):
                                                                                                                                                                                                                                                                                                              """Set the way the widget accepts keyboard focus.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  policy (str): Focus policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setFocusPolicy(constants.FOCUS_POLICY.get_enum_value(policy))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_font(font_name: gui.QFont | str | None = None, *, font_size: int | None = None, weight: int | None = None, italic: bool = False) -> gui.QFont

                                                                                                                                                                                                                                                                                                          Set the font for this widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_font(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              font_name: gui.QFont | str | None = None,
                                                                                                                                                                                                                                                                                                              *,
                                                                                                                                                                                                                                                                                                              font_size: int | None = None,
                                                                                                                                                                                                                                                                                                              weight: int | None = None,
                                                                                                                                                                                                                                                                                                              italic: bool = False,
                                                                                                                                                                                                                                                                                                          ) -> gui.QFont:
                                                                                                                                                                                                                                                                                                              """Set the font for this widget."""
                                                                                                                                                                                                                                                                                                              if isinstance(font_name, gui.QFont):
                                                                                                                                                                                                                                                                                                                  super().setFont(font_name)
                                                                                                                                                                                                                                                                                                                  return font_name
                                                                                                                                                                                                                                                                                                              if font_size is None:
                                                                                                                                                                                                                                                                                                                  font_size = -1
                                                                                                                                                                                                                                                                                                              if weight is None:
                                                                                                                                                                                                                                                                                                                  weight = -1
                                                                                                                                                                                                                                                                                                              if font_name is None:
                                                                                                                                                                                                                                                                                                                  font_name = self.font().family()
                                                                                                                                                                                                                                                                                                              font = gui.Font(font_name, font_size, weight, italic)
                                                                                                                                                                                                                                                                                                              super().setFont(font)
                                                                                                                                                                                                                                                                                                              return font
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_foreground_role(role: gui.palette.RoleStr | gui.Palette.ColorRole)

                                                                                                                                                                                                                                                                                                          Set foreground role for this widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_foreground_role(self, role: gui.palette.RoleStr | gui.Palette.ColorRole):
                                                                                                                                                                                                                                                                                                              """Set foreground role for this widget."""
                                                                                                                                                                                                                                                                                                              self.setForegroundRole(gui.palette.ROLE.get_enum_value(role))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_icon(icon: datatypes.IconType)

                                                                                                                                                                                                                                                                                                          Set the window icon.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          icon IconType

                                                                                                                                                                                                                                                                                                          icon to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_icon(self, icon: datatypes.IconType):
                                                                                                                                                                                                                                                                                                              """Set the window icon.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  icon: icon to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              color = gui.guiapplication.get_window_icon_color()
                                                                                                                                                                                                                                                                                                              icon = iconprovider.get_icon(icon, color=color)
                                                                                                                                                                                                                                                                                                              super().setWindowIcon(icon)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_layout(layout: LayoutStr | widgets.QLayout, *, margin: int | None = None, **kwargs: datatypes.VariantType) -> widgets.QLayout

                                                                                                                                                                                                                                                                                                          set_layout(
                                                                                                                                                                                                                                                                                                              layout: Literal["horizontal"], *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                          ) -> widgets.HBoxLayout
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                          set_layout(
                                                                                                                                                                                                                                                                                                              layout: Literal["vertical"], *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                          ) -> widgets.VBoxLayout
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                          set_layout(
                                                                                                                                                                                                                                                                                                              layout: Literal["grid"], *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                          ) -> widgets.GridLayout
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                          set_layout(
                                                                                                                                                                                                                                                                                                              layout: Literal["border"], *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                          ) -> custom_widgets.BorderLayout
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                          set_layout(
                                                                                                                                                                                                                                                                                                              layout: Literal["flow"], *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                          ) -> custom_widgets.FlowLayout
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                          set_layout(
                                                                                                                                                                                                                                                                                                              layout: Literal["form"], *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                          ) -> widgets.FormLayout
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                          set_layout(
                                                                                                                                                                                                                                                                                                              layout: Literal["stacked"], *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                          ) -> widgets.StackedLayout
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                          set_layout(
                                                                                                                                                                                                                                                                                                              layout: widgets.QLayout, *, margin: int | None = None, **kwargs
                                                                                                                                                                                                                                                                                                          ) -> widgets.QLayout
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Quick way to set a layout.

                                                                                                                                                                                                                                                                                                          Sets layout to given layout, also allows setting margin and spacing.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          layout LayoutStr | QLayout

                                                                                                                                                                                                                                                                                                          Layout to set

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          margin int | None

                                                                                                                                                                                                                                                                                                          margin to use in pixels

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          kwargs VariantType

                                                                                                                                                                                                                                                                                                          keyword arguments passed to layout

                                                                                                                                                                                                                                                                                                          {}
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_layout(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              layout: LayoutStr | widgets.QLayout,
                                                                                                                                                                                                                                                                                                              *,
                                                                                                                                                                                                                                                                                                              margin: int | None = None,
                                                                                                                                                                                                                                                                                                              **kwargs: datatypes.VariantType,
                                                                                                                                                                                                                                                                                                          ) -> widgets.QLayout:
                                                                                                                                                                                                                                                                                                              """Quick way to set a layout.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Sets layout to given layout, also allows setting margin and spacing.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  layout: Layout to set
                                                                                                                                                                                                                                                                                                                  margin: margin to use in pixels
                                                                                                                                                                                                                                                                                                                  kwargs: keyword arguments passed to layout
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Returns:
                                                                                                                                                                                                                                                                                                                  Layout
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              from prettyqt import custom_widgets
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              match layout:
                                                                                                                                                                                                                                                                                                                  case "horizontal":
                                                                                                                                                                                                                                                                                                                      layout = widgets.HBoxLayout(**kwargs)
                                                                                                                                                                                                                                                                                                                  case "vertical":
                                                                                                                                                                                                                                                                                                                      layout = widgets.VBoxLayout(**kwargs)
                                                                                                                                                                                                                                                                                                                  case "grid":
                                                                                                                                                                                                                                                                                                                      layout = widgets.GridLayout(**kwargs)
                                                                                                                                                                                                                                                                                                                  case "form":
                                                                                                                                                                                                                                                                                                                      layout = widgets.FormLayout(**kwargs)
                                                                                                                                                                                                                                                                                                                  case "stacked":
                                                                                                                                                                                                                                                                                                                      layout = widgets.StackedLayout(**kwargs)
                                                                                                                                                                                                                                                                                                                  case "flow":
                                                                                                                                                                                                                                                                                                                      layout = custom_widgets.FlowLayout(**kwargs)
                                                                                                                                                                                                                                                                                                                  case "border":
                                                                                                                                                                                                                                                                                                                      layout = custom_widgets.BorderLayout(**kwargs)
                                                                                                                                                                                                                                                                                                                  case widgets.QLayout():
                                                                                                                                                                                                                                                                                                                      layout = layout
                                                                                                                                                                                                                                                                                                                  case _:
                                                                                                                                                                                                                                                                                                                      msg = f"Invalid Layout {layout}"
                                                                                                                                                                                                                                                                                                                      raise ValueError(msg)
                                                                                                                                                                                                                                                                                                              self.setLayout(layout)
                                                                                                                                                                                                                                                                                                              if margin is not None:
                                                                                                                                                                                                                                                                                                                  layout.setContentsMargins(margin, margin, margin, margin)
                                                                                                                                                                                                                                                                                                              return layout
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_layout_direction(direction: constants.LayoutDirectionStr | constants.LayoutDirection | None)

                                                                                                                                                                                                                                                                                                          Set layout direction.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          direction LayoutDirectionStr | LayoutDirection | None

                                                                                                                                                                                                                                                                                                          layout direction

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_layout_direction(
                                                                                                                                                                                                                                                                                                              self, direction: constants.LayoutDirectionStr | constants.LayoutDirection | None
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set layout direction.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  direction: layout direction
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if direction is None:
                                                                                                                                                                                                                                                                                                                  self.unsetLayoutDirection()
                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                  self.setLayoutDirection(constants.LAYOUT_DIRECTION.get_enum_value(direction))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_margin(margin: datatypes.MarginsType)

                                                                                                                                                                                                                                                                                                          Set content margins for the widget.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          margin MarginsType

                                                                                                                                                                                                                                                                                                          margins to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_margin(self, margin: datatypes.MarginsType):
                                                                                                                                                                                                                                                                                                              """Set content margins for the widget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Arguments:
                                                                                                                                                                                                                                                                                                                  margin: margins to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setContentsMargins(datatypes.to_margins(margin))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_mask(area: datatypes.RectType | gui.QRegion | gui.QBitmap | None, typ: gui.region.RegionTypeStr = 'rectangle')

                                                                                                                                                                                                                                                                                                          Set mask of the widget.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          area RectType | QRegion | QBitmap | None

                                                                                                                                                                                                                                                                                                          Mask area

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          typ RegionTypeStr

                                                                                                                                                                                                                                                                                                          type of region (only used if area is a QRegion)

                                                                                                                                                                                                                                                                                                          'rectangle'
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_mask(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              area: datatypes.RectType | gui.QRegion | gui.QBitmap | None,
                                                                                                                                                                                                                                                                                                              typ: gui.region.RegionTypeStr = "rectangle",
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set mask of the widget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Arguments:
                                                                                                                                                                                                                                                                                                                  area: Mask area
                                                                                                                                                                                                                                                                                                                  typ: type of region (only used if area is a QRegion)
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              match area:
                                                                                                                                                                                                                                                                                                                  case None:
                                                                                                                                                                                                                                                                                                                      self.clearMask()
                                                                                                                                                                                                                                                                                                                      return
                                                                                                                                                                                                                                                                                                                  case (int(), int(), int(), int()):
                                                                                                                                                                                                                                                                                                                      area = gui.Region(*area, gui.region.REGION_TYPE[typ])
                                                                                                                                                                                                                                                                                                                  case core.QRect():
                                                                                                                                                                                                                                                                                                                      area = gui.Region(area, gui.region.REGION_TYPE[typ])
                                                                                                                                                                                                                                                                                                              self.setMask(area)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_modality(modality: constants.WindowModalityStr | constants.WindowModality)

                                                                                                                                                                                                                                                                                                          Set modality for the dialog.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          modality WindowModalityStr | WindowModality

                                                                                                                                                                                                                                                                                                          modality for the main window

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_modality(
                                                                                                                                                                                                                                                                                                              self, modality: constants.WindowModalityStr | constants.WindowModality
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set modality for the dialog.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  modality: modality for the main window
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setWindowModality(constants.WINDOW_MODALITY.get_enum_value(modality))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_size_policy(horizontal: widgets.sizepolicy.SizePolicyStr | widgets.QSizePolicy.Policy | None = None, vertical: widgets.sizepolicy.SizePolicyStr | widgets.QSizePolicy.Policy | None = None)

                                                                                                                                                                                                                                                                                                          Set the size policy.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          horizontal SizePolicyStr | Policy | None

                                                                                                                                                                                                                                                                                                          horizontal size policy

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          vertical SizePolicyStr | Policy | None

                                                                                                                                                                                                                                                                                                          vertical size policy

                                                                                                                                                                                                                                                                                                          None
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_size_policy(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              horizontal: (
                                                                                                                                                                                                                                                                                                                  widgets.sizepolicy.SizePolicyStr | widgets.QSizePolicy.Policy | None
                                                                                                                                                                                                                                                                                                              ) = None,
                                                                                                                                                                                                                                                                                                              vertical: (
                                                                                                                                                                                                                                                                                                                  widgets.sizepolicy.SizePolicyStr | widgets.QSizePolicy.Policy | None
                                                                                                                                                                                                                                                                                                              ) = None,
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set the size policy.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  horizontal: horizontal size policy
                                                                                                                                                                                                                                                                                                                  vertical: vertical size policy
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              sp = self.get_size_policy()
                                                                                                                                                                                                                                                                                                              if horizontal is not None:
                                                                                                                                                                                                                                                                                                                  sp.set_horizontal_policy(horizontal)
                                                                                                                                                                                                                                                                                                              if vertical is not None:
                                                                                                                                                                                                                                                                                                                  sp.set_vertical_policy(vertical)
                                                                                                                                                                                                                                                                                                              self.setSizePolicy(sp)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_style(style: str | widgets.QStyle)

                                                                                                                                                                                                                                                                                                          Set widget style.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_style(self, style: str | widgets.QStyle):
                                                                                                                                                                                                                                                                                                              """Set widget style."""
                                                                                                                                                                                                                                                                                                              if isinstance(style, str):
                                                                                                                                                                                                                                                                                                                  style = widgets.QStyleFactory.create(style)
                                                                                                                                                                                                                                                                                                              self.setStyle(style)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_stylesheet(ss: str | qstylizer.style.StyleSheet | datatypes.PathType | None)

                                                                                                                                                                                                                                                                                                          Set stylesheet for this widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_stylesheet(
                                                                                                                                                                                                                                                                                                              self, ss: str | qstylizer.style.StyleSheet | datatypes.PathType | None
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set stylesheet for this widget."""
                                                                                                                                                                                                                                                                                                              match ss:
                                                                                                                                                                                                                                                                                                                  case None:
                                                                                                                                                                                                                                                                                                                      ss = ""
                                                                                                                                                                                                                                                                                                                  case str():
                                                                                                                                                                                                                                                                                                                      pass
                                                                                                                                                                                                                                                                                                                  case os.PathLike():
                                                                                                                                                                                                                                                                                                                      ss = pathlib.Path(ss).read_text("utf-8")
                                                                                                                                                                                                                                                                                                                  case qstylizer.style.StyleSheet():
                                                                                                                                                                                                                                                                                                                      ss = str(ss)
                                                                                                                                                                                                                                                                                                              self.setStyleSheet(ss)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_tooltip(tooltip: str | datatypes.PathType, *, size: datatypes.SizeType | None = None, rich_text: bool = False)

                                                                                                                                                                                                                                                                                                          Set a tooltip for this widget.

                                                                                                                                                                                                                                                                                                          In image can get displayed by passing a PathLike object.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_tooltip(
                                                                                                                                                                                                                                                                                                              self,
                                                                                                                                                                                                                                                                                                              tooltip: str | datatypes.PathType,
                                                                                                                                                                                                                                                                                                              *,
                                                                                                                                                                                                                                                                                                              size: datatypes.SizeType | None = None,
                                                                                                                                                                                                                                                                                                              rich_text: bool = False,
                                                                                                                                                                                                                                                                                                          ):
                                                                                                                                                                                                                                                                                                              """Set a tooltip for this widget.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              In image can get displayed by passing a PathLike object.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if isinstance(tooltip, os.PathLike):
                                                                                                                                                                                                                                                                                                                  path = os.fspath(tooltip)
                                                                                                                                                                                                                                                                                                                  if size is None:
                                                                                                                                                                                                                                                                                                                      tooltip = f"<img src={path!r}>"
                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                      qsize = datatypes.to_size(size)
                                                                                                                                                                                                                                                                                                                      w, h = qsize.width(), qsize.height()
                                                                                                                                                                                                                                                                                                                      tooltip = f'<img src={path!r} width="{w}" height="{h}">'
                                                                                                                                                                                                                                                                                                              tooltip = tooltip.replace("\n", "<br/>")
                                                                                                                                                                                                                                                                                                              if rich_text:
                                                                                                                                                                                                                                                                                                                  tooltip = f"<html>{html.escape(tooltip)}</html>"
                                                                                                                                                                                                                                                                                                              super().setToolTip(tooltip)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          set_window_state(state: constants.WindowStateStr | constants.WindowState)

                                                                                                                                                                                                                                                                                                          Set window state for given item view.

                                                                                                                                                                                                                                                                                                          Parameters:

                                                                                                                                                                                                                                                                                                          Name Type Description Default
                                                                                                                                                                                                                                                                                                          state WindowStateStr | WindowState

                                                                                                                                                                                                                                                                                                          window state to use

                                                                                                                                                                                                                                                                                                          required
                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def set_window_state(self, state: constants.WindowStateStr | constants.WindowState):
                                                                                                                                                                                                                                                                                                              """Set window state for given item view.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              Args:
                                                                                                                                                                                                                                                                                                                  state: window state to use
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              self.setWindowState(constants.WINDOW_STATES.get_enum_value(state))
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          show_tooltip(duration: int | None = None)

                                                                                                                                                                                                                                                                                                          Show the tooltip of this widget for given time.

                                                                                                                                                                                                                                                                                                          When no duration is given, it will get calculated based on length.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def show_tooltip(self, duration: int | None = None):
                                                                                                                                                                                                                                                                                                              """Show the tooltip of this widget for given time.
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              When no duration is given, it will get calculated based on length.
                                                                                                                                                                                                                                                                                                              """
                                                                                                                                                                                                                                                                                                              if duration is None:
                                                                                                                                                                                                                                                                                                                  duration = -1  # automatic
                                                                                                                                                                                                                                                                                                              pos = self.mapToGlobal(core.QPoint(0, 0))
                                                                                                                                                                                                                                                                                                              widgets.ToolTip.showText(pos, self.toolTip(), msecShowTime=duration)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          toggle_fullscreen() -> bool

                                                                                                                                                                                                                                                                                                          Toggle between fullscreen and regular size.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def toggle_fullscreen(self) -> bool:
                                                                                                                                                                                                                                                                                                              """Toggle between fullscreen and regular size."""
                                                                                                                                                                                                                                                                                                              if self.isFullScreen():
                                                                                                                                                                                                                                                                                                                  self.showNormal()
                                                                                                                                                                                                                                                                                                                  return False
                                                                                                                                                                                                                                                                                                              self.showFullScreen()
                                                                                                                                                                                                                                                                                                              return True
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          toggle_maximized() -> bool

                                                                                                                                                                                                                                                                                                          Toggle between maximized and regular size.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          def toggle_maximized(self) -> bool:
                                                                                                                                                                                                                                                                                                              """Toggle between maximized and regular size."""
                                                                                                                                                                                                                                                                                                              if self.isMaximized():
                                                                                                                                                                                                                                                                                                                  self.showNormal()
                                                                                                                                                                                                                                                                                                                  return False
                                                                                                                                                                                                                                                                                                              self.showMaximized()
                                                                                                                                                                                                                                                                                                              return True
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          updates_off() -> Generator[None]

                                                                                                                                                                                                                                                                                                          Context manager to turn off updates for this widget.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/widget.py
                                                                                                                                                                                                                                                                                                          @contextlib.contextmanager
                                                                                                                                                                                                                                                                                                          def updates_off(self) -> Generator[None]:
                                                                                                                                                                                                                                                                                                              """Context manager to turn off updates for this widget."""
                                                                                                                                                                                                                                                                                                              updates = self.updatesEnabled()
                                                                                                                                                                                                                                                                                                              self.setUpdatesEnabled(False)
                                                                                                                                                                                                                                                                                                              yield None
                                                                                                                                                                                                                                                                                                              self.setUpdatesEnabled(updates)
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          Wizard

                                                                                                                                                                                                                                                                                                          Bases: WizardMixin, QWizard

                                                                                                                                                                                                                                                                                                          Framework for wizards.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/wizard.py
                                                                                                                                                                                                                                                                                                          class Wizard(WizardMixin, widgets.QWizard):
                                                                                                                                                                                                                                                                                                              """Framework for wizards."""
                                                                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                                                                          WizardPage

                                                                                                                                                                                                                                                                                                          Bases: WizardPageMixin, QWizardPage

                                                                                                                                                                                                                                                                                                          The base class for wizard pages.

                                                                                                                                                                                                                                                                                                          Source code in prettyqt/widgets/wizardpage.py
                                                                                                                                                                                                                                                                                                          class WizardPage(WizardPageMixin, widgets.QWizardPage):
                                                                                                                                                                                                                                                                                                              """The base class for wizard pages."""