QWidget

The QWidget class is the base class of all user interface objects. More

Inheritance diagram of PySide6.QtWidgets.QWidget

Inherited by: QWizardPage, QToolBar, QTabWidget, QTabBar, QStatusBar, QSplitterHandle, QSplashScreen, QSizeGrip, QRubberBand, QProgressBar, QMenuBar, QMenu, QMdiSubWindow, QMainWindow, QLineEdit, QKeySequenceEdit, QGroupBox, QFrame, QToolBox, QStackedWidget, QSplitter, QLabel, QLCDNumber, QAbstractScrollArea, QTextEdit, QTextBrowser, QScrollArea, QPlainTextEdit, QMdiArea, QGraphicsView, QAbstractItemView, QTreeView, QTreeWidget, QHelpContentWidget, QTableView, QTableWidget, QListView, QUndoView, QListWidget, QHelpIndexWidget, QHeaderView, QColumnView, QFocusFrame, QDockWidget, QDialogButtonBox, QDialog, QWizard, QProgressDialog, QMessageBox, QInputDialog, QFontDialog, QErrorMessage, QColorDialog, QPrintPreviewDialog, QPageSetupDialog, QAbstractPrintDialog, QPrintDialog, QComboBox, QFontComboBox, QCalendarWidget, QAbstractSpinBox, QSpinBox, QDoubleSpinBox, QDateTimeEdit, QTimeEdit, QDateEdit, QAbstractSlider, QSlider, QScrollBar, QDial, QAbstractButton, QToolButton, QRadioButton, QPushButton, QCommandLinkButton, QCheckBox, QSvgWidget, QQuickWidget, QPrintPreviewWidget, QOpenGLWidget, QHelpSearchResultWidget, QHelpSearchQueryWidget, QHelpFilterSettingsWidget, QDesignerWidgetBoxInterface, QDesignerPropertyEditorInterface, QDesignerObjectInspectorInterface, QDesignerFormWindowInterface, QDesignerActionEditorInterface, QFileDialog, QChartView

Synopsis

Functions

Virtual functions

Static functions

Detailed Description

The widget is the atom of the user interface: it receives mouse, keyboard and other events from the window system, and paints a representation of itself on the screen. Every widget is rectangular, and they are sorted in a Z-order. A widget is clipped by its parent and by the widgets in front of it.

A widget that is not embedded in a parent widget is called a window. Usually, windows have a frame and a title bar, although it is also possible to create windows without such decoration using suitable window flags . In Qt, QMainWindow and the various subclasses of QDialog are the most common window types.

Every widget’s constructor accepts one or two standard arguments:

  1. QWidget *parent = nullptr is the parent of the new widget. If it is None (the default), the new widget will be a window. If not, it will be a child of parent, and be constrained by parent’s geometry (unless you specify Window as window flag).

  2. Qt::WindowFlags f = { } (where available) sets the window flags; the default is suitable for almost all widgets, but to get, for example, a window without a window system frame, you must use special flags.

QWidget has many member functions, but some of them have little direct functionality; for example, QWidget has a font property, but never uses this itself. There are many subclasses which provide real functionality, such as QLabel , QPushButton , QListWidget , and QTabWidget .

Top-Level and Child Widgets

A widget without a parent widget is always an independent window (top-level widget). For these widgets, setWindowTitle() and setWindowIcon() set the title bar and icon respectively.

Non-window widgets are child widgets, displayed within their parent widgets. Most widgets in Qt are mainly useful as child widgets. For example, it is possible to display a button as a top-level window, but most people prefer to put their buttons inside other widgets, such as QDialog .

../../_images/parent-child-widgets.png

The diagram above shows a QGroupBox widget being used to hold various child widgets in a layout provided by QGridLayout . The QLabel child widgets have been outlined to indicate their full sizes.

If you want to use a QWidget to hold child widgets you will usually want to add a layout to the parent QWidget . See Layout Management for more information.

Composite Widgets

When a widget is used as a container to group a number of child widgets, it is known as a composite widget. These can be created by constructing a widget with the required visual properties - a QFrame , for example - and adding child widgets to it, usually managed by a layout. The above diagram shows such a composite widget that was created using Qt Designer.

Composite widgets can also be created by subclassing a standard widget, such as QWidget or QFrame , and adding the necessary layout and child widgets in the constructor of the subclass. Many of the examples provided with Qt use this approach, and it is also covered in the Qt Tutorials .

Custom Widgets and Painting

Since QWidget is a subclass of QPaintDevice , subclasses can be used to display custom content that is composed using a series of painting operations with an instance of the QPainter class. This approach contrasts with the canvas-style approach used by the Graphics View Framework where items are added to a scene by the application and are rendered by the framework itself.

Each widget performs all painting operations from within its function. This is called whenever the widget needs to be redrawn, either as a result of some external change or when requested by the application.

The Analog Clock example shows how a simple widget can handle paint events.

Size Hints and Size Policies

When implementing a new widget, it is almost always useful to reimplement sizeHint() to provide a reasonable default size for the widget and to set the correct size policy with setSizePolicy() .

By default, composite widgets which do not provide a size hint will be sized according to the space requirements of their child widgets.

The size policy lets you supply good default behavior for the layout management system, so that other widgets can contain and manage yours easily. The default size policy indicates that the size hint represents the preferred size of the widget, and this is often good enough for many widgets.

Note

The size of top-level widgets are constrained to 2/3 of the desktop’s height and width. You can resize() the widget manually if these bounds are inadequate.

Events

Widgets respond to events that are typically caused by user actions. Qt delivers events to widgets by calling specific event handler functions with instances of QEvent subclasses containing information about each event.

If your widget only contains child widgets, you probably do not need to implement any event handlers. If you want to detect a mouse click in a child widget call the child’s function inside the widget’s mousePressEvent() .

The Scribble example implements a wider set of events to handle mouse movement, button presses, and window resizing.

You will need to supply the behavior and content for your own widgets, but here is a brief overview of the events that are relevant to QWidget , starting with the most common ones:

  • is called whenever the widget needs to be repainted. Every widget displaying custom content must implement it. Painting using a QPainter can only take place in a or a function called by a .

  • resizeEvent() is called when the widget has been resized.

  • mousePressEvent() is called when a mouse button is pressed while the mouse cursor is inside the widget, or when the widget has grabbed the mouse using . Pressing the mouse without releasing it is effectively the same as calling .

  • mouseReleaseEvent() is called when a mouse button is released. A widget receives mouse release events when it has received the corresponding mouse press event. This means that if the user presses the mouse inside your widget, then drags the mouse somewhere else before releasing the mouse button, your widget receives the release event. There is one exception: if a popup menu appears while the mouse button is held down, this popup immediately steals the mouse events.

  • mouseDoubleClickEvent() is called when the user double-clicks in the widget. If the user double-clicks, the widget receives a mouse press event, a mouse release event, (a mouse click event,) a second mouse press, this event and finally a second mouse release event. (Some mouse move events may also be received if the mouse is not held steady during this operation.) It is not possible to distinguish a click from a double-click until the second click arrives. (This is one reason why most GUI books recommend that double-clicks be an extension of single-clicks, rather than trigger a different action.)

Widgets that accept keyboard input need to reimplement a few more event handlers:

  • keyPressEvent() is called whenever a key is pressed, and again when a key has been held down long enough for it to auto-repeat. The Tab and Shift+Tab keys are only passed to the widget if they are not used by the focus-change mechanisms. To force those keys to be processed by your widget, you must reimplement event() .

  • is called when the widget gains keyboard focus (assuming you have called setFocusPolicy() ). Well-behaved widgets indicate that they own the keyboard focus in a clear but discreet way.

  • is called when the widget loses keyboard focus.

You may be required to also reimplement some of the less common event handlers:

  • mouseMoveEvent() is called whenever the mouse moves while a mouse button is held down. This can be useful during drag and drop operations. If you call setMouseTracking (true), you get mouse move events even when no buttons are held down. (See also the Drag and Drop guide.)

  • keyReleaseEvent() is called whenever a key is released and while it is held down (if the key is auto-repeating). In that case, the widget will receive a pair of key release and key press event for every repeat. The Tab and Shift+Tab keys are only passed to the widget if they are not used by the focus-change mechanisms. To force those keys to be processed by your widget, you must reimplement event() .

  • wheelEvent() is called whenever the user turns the mouse wheel while the widget has the focus.

  • is called when the mouse enters the widget’s screen space. (This excludes screen space owned by any of the widget’s children.)

  • is called when the mouse leaves the widget’s screen space. If the mouse enters a child widget it will not cause a .

  • is called when the widget has been moved relative to its parent.

  • closeEvent() is called when the user closes the widget (or when close() is called).

There are also some rather obscure events described in the documentation for Type . To handle these events, you need to reimplement event() directly.

The default implementation of event() handles Tab and Shift+Tab (to move the keyboard focus), and passes on most of the other events to one of the more specialized handlers above.

Events and the mechanism used to deliver them are covered in The Event System .

Groups of Functions and Properties

Context

Functions and Properties

Window functions

show() , hide() , raise() , lower() , close() .

Top-level windows

windowModified , windowTitle , windowIcon , isActiveWindow , , minimized , showMinimized() , maximized , showMaximized() , fullScreen , showFullScreen() , showNormal() .

Window contents

update() , repaint() , scroll() .

Geometry

pos , x() , y() , rect , size , width() , height() , move() , resize() , sizePolicy , sizeHint() , minimumSizeHint() , updateGeometry() , layout() , frameGeometry , geometry , childrenRect , childrenRegion , adjustSize() , mapFromGlobal() , mapToGlobal() , mapFromParent() , mapToParent() , maximumSize , minimumSize , sizeIncrement , baseSize , setFixedSize()

Mode

visible , isVisibleTo() , enabled , isEnabledTo() , modal , , mouseTracking , updatesEnabled , visibleRegion() .

Look and feel

style() , setStyle() , styleSheet , cursor , font , palette , backgroundRole() , setBackgroundRole() , , .

Keyboard focus functions

focus , focusPolicy , setFocus() , clearFocus() , setTabOrder() , setFocusProxy() , , .

Mouse and keyboard grabbing

, , , , , .

Event handlers

event() , mousePressEvent() , mouseReleaseEvent() , mouseDoubleClickEvent() , mouseMoveEvent() , keyPressEvent() , keyReleaseEvent() , , , wheelEvent() , , , , , resizeEvent() , closeEvent() , , , , , childEvent() , , , customEvent() . changeEvent() ,

System functions

, window() , setParent() , , find() , metric() .

Context menu

contextMenuPolicy , contextMenuEvent() , , actions()

Interactive help

setToolTip() , setWhatsThis()

Widget Style Sheets

In addition to the standard widget styles for each platform, widgets can also be styled according to rules specified in a style sheet . This feature enables you to customize the appearance of specific widgets to provide visual cues to users about their purpose. For example, a button could be styled in a particular way to indicate that it performs a destructive action.

The use of widget style sheets is described in more detail in the Qt Style Sheets document.

Transparency and Double Buffering

Since Qt 4.0, QWidget automatically double-buffers its painting, so there is no need to write double-buffering code in to avoid flicker.

Since Qt 4.1, the contents of parent widgets are propagated by default to each of their children as long as WA_PaintOnScreen is not set. Custom widgets can be written to take advantage of this feature by updating irregular regions (to create non-rectangular child widgets), or painting with colors that have less than full alpha component. The following diagram shows how attributes and properties of a custom widget can be fine-tuned to achieve different effects.

../../_images/propagation-custom.png

In the above diagram, a semi-transparent rectangular child widget with an area removed is constructed and added to a parent widget (a QLabel showing a pixmap). Then, different properties and widget attributes are set to achieve different effects:

  • The left widget has no additional properties or widget attributes set. This default state suits most custom widgets using transparency, are irregularly-shaped, or do not paint over their entire area with an opaque brush.

  • The center widget has the autoFillBackground property set. This property is used with custom widgets that rely on the widget to supply a default background, and do not paint over their entire area with an opaque brush.

  • The right widget has the WA_OpaquePaintEvent widget attribute set. This indicates that the widget will paint over its entire area with opaque colors. The widget’s area will initially be uninitialized, represented in the diagram with a red diagonal grid pattern that shines through the overpainted area. The Qt::WA_OpaquePaintArea attribute is useful for widgets that need to paint their own specialized contents quickly and do not need a default filled background.

To rapidly update custom widgets with simple background colors, such as real-time plotting or graphing widgets, it is better to define a suitable background color (using setBackgroundRole() with the Window role), set the autoFillBackground property, and only implement the necessary drawing functionality in the widget’s .

To rapidly update custom widgets that constantly paint over their entire areas with opaque content, e.g., video streaming widgets, it is better to set the widget’s WA_OpaquePaintEvent , avoiding any unnecessary overhead associated with repainting the widget’s background.

If a widget has both the WA_OpaquePaintEvent widget attribute and the autoFillBackground property set, the WA_OpaquePaintEvent attribute takes precedence. Depending on your requirements, you should choose either one of them.

Since Qt 4.1, the contents of parent widgets are also propagated to standard Qt widgets. This can lead to some unexpected results if the parent widget is decorated in a non-standard way, as shown in the diagram below.

../../_images/propagation-standard.png

The scope for customizing the painting behavior of standard Qt widgets, without resorting to subclassing, is slightly less than that possible for custom widgets. Usually, the desired appearance of a standard widget can be achieved by setting its autoFillBackground property.

Creating Translucent Windows

Since Qt 4.5, it has been possible to create windows with translucent regions on window systems that support compositing.

To enable this feature in a top-level widget, set its WA_TranslucentBackground attribute with setAttribute() and ensure that its background is painted with non-opaque colors in the regions you want to be partially transparent.

Platform notes:

  • X11: This feature relies on the use of an X server that supports ARGB visuals and a compositing window manager.

  • Windows: The widget needs to have the FramelessWindowHint window flag set for the translucency to work.

Native Widgets vs Alien Widgets

Introduced in Qt 4.4, alien widgets are widgets unknown to the windowing system. They do not have a native window handle associated with them. This feature significantly speeds up widget painting, resizing, and removes flicker.

Should you require the old behavior with native windows, you can choose one of the following options:

  1. Use the QT_USE_NATIVE_WINDOWS=1 in your environment.

  2. Set the AA_NativeWindows attribute on your application. All widgets will be native widgets.

  3. Set the WA_NativeWindow attribute on widgets: The widget itself and all of its ancestors will become native (unless WA_DontCreateNativeAncestors is set).

  4. Call QWidget::winId to enforce a native window (this implies 3).

  5. Set the WA_PaintOnScreen attribute to enforce a native window (this implies 3).

See also

QEvent QPainter QGridLayout QBoxLayout

class PySide6.QtWidgets.QWidget([parent=None[, f=Qt.WindowFlags()]])
Parameters

Constructs a widget which is a child of parent, with widget flags set to f.

If parent is None, the new widget becomes a window. If parent is another widget, this widget becomes a child window inside parent. The new widget is deleted when its parent is deleted.

The widget flags argument, f, is normally 0, but it can be set to customize the frame of a window (i.e. parent must be None). To customize the frame, use a value composed from the bitwise OR of any of the window flags .

If you add a child widget to an already visible widget you must explicitly show the child to make it visible.

Note that the X11 version of Qt may not be able to deliver all combinations of style flags on all systems. This is because on X11, Qt can only ask the window manager, and the window manager can override the application’s settings. On Windows, Qt can set whatever flags you want.

See also

windowFlags

PySide6.QtWidgets.QWidget.RenderFlag

This enum describes how to render the widget when calling render() .

Constant

Description

QWidget.DrawWindowBackground

If you enable this option, the widget’s background is rendered into the target even if autoFillBackground is not set. By default, this option is enabled.

QWidget.DrawChildren

If you enable this option, the widget’s children are rendered recursively into the target. By default, this option is enabled.

QWidget.IgnoreMask

If you enable this option, the widget’s mask() is ignored when rendering into the target. By default, this option is disabled.

PySide6.QtWidgets.QWidget.acceptDrops()
Return type

bool

See also

setAcceptDrops()

PySide6.QtWidgets.QWidget.accessibleDescription()
Return type

str

PySide6.QtWidgets.QWidget.accessibleName()
Return type

str

PySide6.QtWidgets.QWidget.actionEvent(event)
Parameters

eventPySide6.QtGui.QActionEvent

PySide6.QtWidgets.QWidget.actions()
Return type

Returns the (possibly empty) list of this widget’s actions.

PySide6.QtWidgets.QWidget.activateWindow()
PySide6.QtWidgets.QWidget.addAction(action)
Parameters

actionPySide6.QtGui.QAction

Appends the action action to this widget’s list of actions.

All QWidgets have a list of QAction s, however they can be represented graphically in many different ways. The default use of the QAction list (as returned by actions() ) is to create a context QMenu .

A QWidget should only have one of each action and adding an action it already has will not cause the same action to be in the widget twice.

The ownership of action is not transferred to this QWidget .

PySide6.QtWidgets.QWidget.addActions(actions)
Parameters

actions

Appends the actions actions to this widget’s list of actions.

PySide6.QtWidgets.QWidget.adjustSize()

Adjusts the size of the widget to fit its contents.

This function uses sizeHint() if it is valid, i.e., the size hint’s width and height are >= 0. Otherwise, it sets the size to the children rectangle that covers all child widgets (the union of all child widget rectangles).

For windows, the screen size is also taken into account. If the sizeHint() is less than (200, 100) and the size policy is expanding , the window will be at least (200, 100). The maximum size of a window is 2/3 of the screen’s width and height.

PySide6.QtWidgets.QWidget.autoFillBackground()
Return type

bool

PySide6.QtWidgets.QWidget.backgroundRole()
Return type

ColorRole

Returns the background role of the widget.

The background role defines the brush from the widget’s palette that is used to render the background.

If no explicit background role is set, the widget inherts its parent widget’s background role.

PySide6.QtWidgets.QWidget.backingStore()
Return type

PySide6.QtGui.QBackingStore

Returns the QBackingStore this widget will be drawn into.

PySide6.QtWidgets.QWidget.baseSize()
Return type

PySide6.QtCore.QSize

See also

setBaseSize()

PySide6.QtWidgets.QWidget.changeEvent(event)
Parameters

eventPySide6.QtCore.QEvent

This event handler can be reimplemented to handle state changes.

The state being changed in this event can be retrieved through the event supplied.

Change events include: ToolBarChange , ActivationChange , EnabledChange , FontChange , StyleChange , PaletteChange , WindowTitleChange , IconTextChange , ModifiedChange , MouseTrackingChange , ParentChange , WindowStateChange , LanguageChange , LocaleChange , LayoutDirectionChange , ReadOnlyChange .

PySide6.QtWidgets.QWidget.childAt(x, y)
Parameters
  • x – int

  • y – int

Return type

PySide6.QtWidgets.QWidget

PySide6.QtWidgets.QWidget.childAt(p)
Parameters

pPySide6.QtCore.QPoint

Return type

PySide6.QtWidgets.QWidget

This is an overloaded function.

Returns the visible child widget at point p in the widget’s own coordinate system.

PySide6.QtWidgets.QWidget.childrenRect()
Return type

PySide6.QtCore.QRect

PySide6.QtWidgets.QWidget.childrenRegion()
Return type

PySide6.QtGui.QRegion

PySide6.QtWidgets.QWidget.clearFocus()

Takes keyboard input focus from the widget.

If the widget has active focus, a focus out event is sent to this widget to tell it that it has lost the focus.

This widget must enable focus setting in order to get the keyboard input focus, i.e. it must call setFocusPolicy() .

PySide6.QtWidgets.QWidget.clearMask()
PySide6.QtWidgets.QWidget.close()
Return type

bool

Closes this widget. Returns true if the widget was closed; otherwise returns false.

First it sends the widget a QCloseEvent . The widget is hidden if it accepts the close event. If it ignores the event, nothing happens. The default implementation of closeEvent() accepts the close event.

If the widget has the WA_DeleteOnClose flag, the widget is also deleted. A close events is delivered to the widget no matter if the widget is visible or not.

The lastWindowClosed() signal is emitted when the last visible primary window (i.e. window with no parent) with the WA_QuitOnClose attribute set is closed. By default this attribute is set for all widgets except transient windows such as splash screens, tool windows, and popup menus.

PySide6.QtWidgets.QWidget.closeEvent(event)
Parameters

eventPySide6.QtGui.QCloseEvent

This event handler is called with the given event when Qt receives a window close request for a top-level widget from the window system.

By default, the event is accepted and the widget is closed. You can reimplement this function to change the way the widget responds to window close requests. For example, you can prevent the window from closing by calling ignore() on all events.

Main window applications typically use reimplementations of this function to check whether the user’s work has been saved and ask for permission before closing. For example, the Qt Widgets - Application Example uses a helper function to determine whether or not to close the window:

void MainWindow::closeEvent(QCloseEvent *event)        {
    if (maybeSave()) {
        writeSettings();
        event->accept();
    } else {
        event->ignore();
    }
}

See also

event() hide() close() QCloseEvent Qt Widgets - Application Example

PySide6.QtWidgets.QWidget.contentsMargins()
Return type

PySide6.QtCore.QMargins

The function returns the widget’s contents margins.

PySide6.QtWidgets.QWidget.contentsRect()
Return type

PySide6.QtCore.QRect

Returns the area inside the widget’s margins.

PySide6.QtWidgets.QWidget.contextMenuEvent(event)
Parameters

eventPySide6.QtGui.QContextMenuEvent

This event handler, for event event, can be reimplemented in a subclass to receive widget context menu events.

The handler is called when the widget’s contextMenuPolicy is DefaultContextMenu .

The default implementation ignores the context event. See the QContextMenuEvent documentation for more details.

See also

event() QContextMenuEvent customContextMenuRequested()

PySide6.QtWidgets.QWidget.contextMenuPolicy()
Return type

ContextMenuPolicy

PySide6.QtWidgets.QWidget.create([arg__1=0[, initializeWindow=true[, destroyOldWindow=true]]])
Parameters
  • arg__1WId

  • initializeWindow – bool

  • destroyOldWindow – bool

Creates a new widget window.

The parameters window, initializeWindow, and destroyOldWindow are ignored in Qt 5. Please use fromWinId() to create a QWindow wrapping a foreign window and pass it to instead.

See also

fromWinId()

PySide6.QtWidgets.QWidget.createWinId()
static PySide6.QtWidgets.QWidget.createWindowContainer(window[, parent=None[, flags=Qt.WindowFlags()]])
Parameters
Return type

PySide6.QtWidgets.QWidget

PySide6.QtWidgets.QWidget.cursor()
Return type

PySide6.QtGui.QCursor

See also

setCursor()

PySide6.QtWidgets.QWidget.customContextMenuRequested(pos)
Parameters

posPySide6.QtCore.QPoint

PySide6.QtWidgets.QWidget.destroy([destroyWindow=true[, destroySubWindows=true]])
Parameters
  • destroyWindow – bool

  • destroySubWindows – bool

PySide6.QtWidgets.QWidget.dragEnterEvent(event)
Parameters

eventPySide6.QtGui.QDragEnterEvent

PySide6.QtWidgets.QWidget.dragLeaveEvent(event)
Parameters

eventPySide6.QtGui.QDragLeaveEvent

PySide6.QtWidgets.QWidget.dragMoveEvent(event)
Parameters

eventPySide6.QtGui.QDragMoveEvent

PySide6.QtWidgets.QWidget.dropEvent(event)
Parameters

eventPySide6.QtGui.QDropEvent

PySide6.QtWidgets.QWidget.effectiveWinId()
Return type

WId

Returns the effective window system identifier of the widget, i.e. the native parent’s window system identifier.

If the widget is native, this function returns the native widget ID. Otherwise, the window ID of the first native parent widget, i.e., the top-level widget that contains this widget, is returned.

Note

We recommend that you do not store this value as it is likely to change at run-time.

PySide6.QtWidgets.QWidget.ensurePolished()

Ensures that the widget and its children have been polished by QStyle (i.e., have a proper font and palette).

QWidget calls this function after it has been fully constructed but before it is shown the very first time. You can call this function if you want to ensure that the widget is polished before doing an operation, e.g., the correct font size might be needed in the widget’s sizeHint() reimplementation. Note that this function is called from the default implementation of sizeHint() .

Polishing is useful for final initialization that must happen after all constructors (from base classes as well as from subclasses) have been called.

If you need to change some settings when a widget is polished, reimplement event() and handle the Polish event type.

Note

The function is declared const so that it can be called from other const functions (e.g., sizeHint() ).

See also

event()

PySide6.QtWidgets.QWidget.enterEvent(event)
Parameters

eventPySide6.QtGui.QEnterEvent

static PySide6.QtWidgets.QWidget.find(arg__1)
Parameters

arg__1WId

Return type

PySide6.QtWidgets.QWidget

Returns a pointer to the widget with window identifer/handle id.

The window identifier type depends on the underlying window system, see qwindowdefs.h for the actual definition. If there is no widget with this identifier, None is returned.

PySide6.QtWidgets.QWidget.focusInEvent(event)
Parameters

eventPySide6.QtGui.QFocusEvent

PySide6.QtWidgets.QWidget.focusNextChild()
Return type

bool

PySide6.QtWidgets.QWidget.focusNextPrevChild(next)
Parameters

next – bool

Return type

bool

Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true if it can find a new widget, or false if it can’t.

If next is true, this function searches forward, if next is false, it searches backward.

Sometimes, you will want to reimplement this function. For example, a web browser might reimplement it to move its “current active link” forward or backward, and call only when it reaches the last or first link on the “page”.

Child widgets call on their parent widgets, but only the window that contains the child widgets decides where to redirect focus. By reimplementing this function for an object, you thus gain control of focus traversal for all child widgets.

See also

focusNextChild()focusPreviousChild()

PySide6.QtWidgets.QWidget.focusOutEvent(event)
Parameters

eventPySide6.QtGui.QFocusEvent

PySide6.QtWidgets.QWidget.focusPolicy()
Return type

FocusPolicy

See also

setFocusPolicy()

PySide6.QtWidgets.QWidget.focusPreviousChild()
Return type

bool

PySide6.QtWidgets.QWidget.focusProxy()
Return type

PySide6.QtWidgets.QWidget

Returns the focus proxy, or None if there is no focus proxy.

See also

setFocusProxy()

PySide6.QtWidgets.QWidget.focusWidget()
Return type

PySide6.QtWidgets.QWidget

Returns the last child of this widget that setFocus had been called on. For top level widgets this is the widget that will get focus in case this window gets activated

This is not the same as focusWidget() , which returns the focus widget in the currently active window.

PySide6.QtWidgets.QWidget.font()
Return type

PySide6.QtGui.QFont

See also

setFont()

PySide6.QtWidgets.QWidget.fontInfo()
Return type

PySide6.QtGui.QFontInfo

PySide6.QtWidgets.QWidget.fontMetrics()
Return type

PySide6.QtGui.QFontMetrics

PySide6.QtWidgets.QWidget.foregroundRole()
Return type

ColorRole

Returns the foreground role.

The foreground role defines the color from the widget’s palette that is used to draw the foreground.

If no explicit foreground role is set, the function returns a role that contrasts with the background role.

PySide6.QtWidgets.QWidget.frameGeometry()
Return type

PySide6.QtCore.QRect

PySide6.QtWidgets.QWidget.frameSize()
Return type

PySide6.QtCore.QSize

PySide6.QtWidgets.QWidget.geometry()
Return type

PySide6.QtCore.QRect

See also

setGeometry()

PySide6.QtWidgets.QWidget.grab([rectangle=QRect(QPoint(0, 0), QSize(-1, -1))])
Parameters

rectanglePySide6.QtCore.QRect

Return type

PySide6.QtGui.QPixmap

Renders the widget into a pixmap restricted by the given rectangle. If the widget has any children, then they are also painted in the appropriate positions.

If a rectangle with an invalid size is specified (the default), the entire widget is painted.

See also

render() QPixmap

PySide6.QtWidgets.QWidget.grabGesture(type[, flags=Qt.GestureFlags()])
Parameters

Subscribes the widget to a given gesture with specific flags.

PySide6.QtWidgets.QWidget.grabKeyboard()
PySide6.QtWidgets.QWidget.grabMouse()
PySide6.QtWidgets.QWidget.grabMouse(arg__1)
Parameters

arg__1PySide6.QtGui.QCursor

PySide6.QtWidgets.QWidget.grabShortcut(key[, context=Qt.WindowShortcut])
Parameters
Return type

int

Adds a shortcut to Qt’s shortcut system that watches for the given key sequence in the given context. If the context is ApplicationShortcut , the shortcut applies to the application as a whole. Otherwise, it is either local to this widget, WidgetShortcut , or to the window itself, WindowShortcut .

If the same key sequence has been grabbed by several widgets, when the key sequence occurs a Shortcut event is sent to all the widgets to which it applies in a non-deterministic order, but with the ``ambiguous’’ flag set to true.

Warning

You should not normally need to use this function; instead create QAction s with the shortcut key sequences you require (if you also want equivalent menu options and toolbar buttons), or create QShortcut s if you just need key sequences. Both QAction and QShortcut handle all the event filtering for you, and provide signals which are triggered when the user triggers the key sequence, so are much easier to use than this low-level function.

PySide6.QtWidgets.QWidget.graphicsEffect()
Return type

PySide6.QtWidgets.QGraphicsEffect

The function returns a pointer to the widget’s graphics effect.

If the widget has no graphics effect, None is returned.

PySide6.QtWidgets.QWidget.graphicsProxyWidget()
Return type

PySide6.QtWidgets.QGraphicsProxyWidget

Returns the proxy widget for the corresponding embedded widget in a graphics view; otherwise returns None.

PySide6.QtWidgets.QWidget.hasFocus()
Return type

bool

PySide6.QtWidgets.QWidget.hasHeightForWidth()
Return type

bool

Returns true if the widget’s preferred height depends on its width; otherwise returns false.

PySide6.QtWidgets.QWidget.hasMouseTracking()
Return type

bool

PySide6.QtWidgets.QWidget.hasTabletTracking()
Return type

bool

PySide6.QtWidgets.QWidget.heightForWidth(arg__1)
Parameters

arg__1 – int

Return type

int

Returns the preferred height for this widget, given the width w.

If this widget has a layout, the default implementation returns the layout’s preferred height. if there is no layout, the default implementation returns -1 indicating that the preferred height does not depend on the width.

PySide6.QtWidgets.QWidget.hide()

Hides the widget. This function is equivalent to setVisible (false).

Note

If you are working with QDialog or its subclasses and you invoke the show() function after this function, the dialog will be displayed in its original position.

PySide6.QtWidgets.QWidget.hideEvent(event)
Parameters

eventPySide6.QtGui.QHideEvent

PySide6.QtWidgets.QWidget.inputMethodEvent(event)
Parameters

eventPySide6.QtGui.QInputMethodEvent

This event handler, for event event, can be reimplemented in a subclass to receive Input Method composition events. This handler is called when the state of the input method changes.

Note that when creating custom text editing widgets, the WA_InputMethodEnabled window attribute must be set explicitly (using the setAttribute() function) in order to receive input method events.

The default implementation calls event->ignore(), which rejects the Input Method event. See the QInputMethodEvent documentation for more details.

See also

event() QInputMethodEvent

PySide6.QtWidgets.QWidget.inputMethodHints()
Return type

InputMethodHints

PySide6.QtWidgets.QWidget.inputMethodQuery(arg__1)
Parameters

arg__1InputMethodQuery

Return type

object

This method is only relevant for input widgets. It is used by the input method to query a set of properties of the widget to be able to support complex input method operations as support for surrounding text and reconversions.

query specifies which property is queried.

See also

inputMethodEvent() QInputMethodEvent QInputMethodQueryEvent inputMethodHints

PySide6.QtWidgets.QWidget.insertAction(before, action)
Parameters

Inserts the action action to this widget’s list of actions, before the action before. It appends the action if before is None or before is not a valid action for this widget.

A QWidget should only have one of each action.

PySide6.QtWidgets.QWidget.insertActions(before, actions)
Parameters

Inserts the actions actions to this widget’s list of actions, before the action before. It appends the action if before is None or before is not a valid action for this widget.

A QWidget can have at most one of each action.

PySide6.QtWidgets.QWidget.internalWinId()
Return type

WId

PySide6.QtWidgets.QWidget.isActiveWindow()
Return type

bool

PySide6.QtWidgets.QWidget.isAncestorOf(child)
Parameters

childPySide6.QtWidgets.QWidget

Return type

bool

Returns true if this widget is a parent, (or grandparent and so on to any level), of the given child, and both widgets are within the same window; otherwise returns false.

PySide6.QtWidgets.QWidget.isEnabled()
Return type

bool

PySide6.QtWidgets.QWidget.isEnabledTo(arg__1)
Parameters

arg__1PySide6.QtWidgets.QWidget

Return type

bool

Returns true if this widget would become enabled if ancestor is enabled; otherwise returns false.

This is the case if neither the widget itself nor every parent up to but excluding ancestor has been explicitly disabled.

  1. returns false if this widget or any if its ancestors was explicitly disabled.

The word ancestor here means a parent widget within the same window.

Therefore (0) stops at this widget’s window, unlike isEnabled() which also takes parent windows into considerations.

See also

setEnabled() enabled

PySide6.QtWidgets.QWidget.isFullScreen()
Return type

bool

PySide6.QtWidgets.QWidget.isHidden()
Return type

bool

PySide6.QtWidgets.QWidget.isLeftToRight()
Return type

bool

PySide6.QtWidgets.QWidget.isMaximized()
Return type

bool

PySide6.QtWidgets.QWidget.isMinimized()
Return type

bool

PySide6.QtWidgets.QWidget.isModal()
Return type

bool

PySide6.QtWidgets.QWidget.isRightToLeft()
Return type

bool

PySide6.QtWidgets.QWidget.isTopLevel()
Return type

bool

Note

This function is deprecated.

PySide6.QtWidgets.QWidget.isVisible()
Return type

bool

PySide6.QtWidgets.QWidget.isVisibleTo(arg__1)
Parameters

arg__1PySide6.QtWidgets.QWidget

Return type

bool

Returns true if this widget would become visible if ancestor is shown; otherwise returns false.

The true case occurs if neither the widget itself nor any parent up to but excluding ancestor has been explicitly hidden.

This function will still return true if the widget is obscured by other windows on the screen, but could be physically visible if it or they were to be moved.

  1. is identical to isVisible() .

PySide6.QtWidgets.QWidget.isWindow()
Return type

bool

PySide6.QtWidgets.QWidget.isWindowModified()
Return type

bool

PySide6.QtWidgets.QWidget.keyPressEvent(event)
Parameters

eventPySide6.QtGui.QKeyEvent

This event handler, for event event, can be reimplemented in a subclass to receive key press events for the widget.

A widget must call setFocusPolicy() to accept focus initially and have focus in order to receive a key press event.

If you reimplement this handler, it is very important that you call the base class implementation if you do not act upon the key.

The default implementation closes popup widgets if the user presses the key sequence for Cancel (typically the Escape key). Otherwise the event is ignored, so that the widget’s parent can interpret it.

Note that QKeyEvent starts with isAccepted() == true, so you do not need to call accept() - just do not call the base class implementation if you act upon the key.

PySide6.QtWidgets.QWidget.keyReleaseEvent(event)
Parameters

eventPySide6.QtGui.QKeyEvent

This event handler, for event event, can be reimplemented in a subclass to receive key release events for the widget.

A widget must accept focus initially and have focus in order to receive a key release event.

If you reimplement this handler, it is very important that you call the base class implementation if you do not act upon the key.

The default implementation ignores the event, so that the widget’s parent can interpret it.

Note that QKeyEvent starts with isAccepted() == true, so you do not need to call accept() - just do not call the base class implementation if you act upon the key.

See also

keyPressEvent() ignore() setFocusPolicy() event() QKeyEvent

static PySide6.QtWidgets.QWidget.keyboardGrabber()
Return type

PySide6.QtWidgets.QWidget

PySide6.QtWidgets.QWidget.layout()
Return type

PySide6.QtWidgets.QLayout

Returns the layout manager that is installed on this widget, or None if no layout manager is installed.

The layout manager sets the geometry of the widget’s children that have been added to the layout.

PySide6.QtWidgets.QWidget.layoutDirection()
Return type

LayoutDirection

PySide6.QtWidgets.QWidget.leaveEvent(event)
Parameters

eventPySide6.QtCore.QEvent

PySide6.QtWidgets.QWidget.locale()
Return type

PySide6.QtCore.QLocale

See also

setLocale()

PySide6.QtWidgets.QWidget.lower()

Lowers the widget to the bottom of the parent widget’s stack.

After this call the widget will be visually behind (and therefore obscured by) any overlapping sibling widgets.

See also

raise() stackUnder()

PySide6.QtWidgets.QWidget.mapFrom(arg__1, arg__2)
Parameters
Return type

PySide6.QtCore.QPoint

PySide6.QtWidgets.QWidget.mapFrom(arg__1, arg__2)
Parameters
Return type

PySide6.QtCore.QPointF

PySide6.QtWidgets.QWidget.mapFromGlobal(arg__1)
Parameters

arg__1PySide6.QtCore.QPoint

Return type

PySide6.QtCore.QPoint

This is an overloaded function.

PySide6.QtWidgets.QWidget.mapFromGlobal(arg__1)
Parameters

arg__1PySide6.QtCore.QPointF

Return type

PySide6.QtCore.QPointF

This is an overloaded function.

PySide6.QtWidgets.QWidget.mapFromParent(arg__1)
Parameters

arg__1PySide6.QtCore.QPoint

Return type

PySide6.QtCore.QPoint

PySide6.QtWidgets.QWidget.mapFromParent(arg__1)
Parameters

arg__1PySide6.QtCore.QPointF

Return type

PySide6.QtCore.QPointF

PySide6.QtWidgets.QWidget.mapTo(arg__1, arg__2)
Parameters
Return type

PySide6.QtCore.QPoint

PySide6.QtWidgets.QWidget.mapTo(arg__1, arg__2)
Parameters
Return type

PySide6.QtCore.QPointF

PySide6.QtWidgets.QWidget.mapToGlobal(arg__1)
Parameters

arg__1PySide6.QtCore.QPoint

Return type

PySide6.QtCore.QPoint

This is an overloaded function.

PySide6.QtWidgets.QWidget.mapToGlobal(arg__1)
Parameters

arg__1PySide6.QtCore.QPointF

Return type

PySide6.QtCore.QPointF

This is an overloaded function.

PySide6.QtWidgets.QWidget.mapToParent(arg__1)
Parameters

arg__1PySide6.QtCore.QPoint

Return type

PySide6.QtCore.QPoint

PySide6.QtWidgets.QWidget.mapToParent(arg__1)
Parameters

arg__1PySide6.QtCore.QPointF

Return type

PySide6.QtCore.QPointF

PySide6.QtWidgets.QWidget.mask()
Return type

PySide6.QtGui.QRegion

Returns the mask currently set on a widget. If no mask is set the return value will be an empty region.

See also

isEmpty() Shaped Clock Example

PySide6.QtWidgets.QWidget.maximumHeight()
Return type

int

PySide6.QtWidgets.QWidget.maximumSize()
Return type

PySide6.QtCore.QSize

See also

setMaximumSize()

PySide6.QtWidgets.QWidget.maximumWidth()
Return type

int

PySide6.QtWidgets.QWidget.minimumHeight()
Return type

int

PySide6.QtWidgets.QWidget.minimumSize()
Return type

PySide6.QtCore.QSize

See also

setMinimumSize()

PySide6.QtWidgets.QWidget.minimumSizeHint()
Return type

PySide6.QtCore.QSize

PySide6.QtWidgets.QWidget.minimumWidth()
Return type

int

PySide6.QtWidgets.QWidget.mouseDoubleClickEvent(event)
Parameters

eventPySide6.QtGui.QMouseEvent

This event handler, for event event, can be reimplemented in a subclass to receive mouse double click events for the widget.

The default implementation calls mousePressEvent() .

Note

The widget will also receive mouse press and mouse release events in addition to the double click event. And if another widget that overlaps this widget disappears in response to press or release events, then this widget will only receive the double click event. It is up to the developer to ensure that the application interprets these events correctly.

static PySide6.QtWidgets.QWidget.mouseGrabber()
Return type

PySide6.QtWidgets.QWidget

PySide6.QtWidgets.QWidget.mouseMoveEvent(event)
Parameters

eventPySide6.QtGui.QMouseEvent

This event handler, for event event, can be reimplemented in a subclass to receive mouse move events for the widget.

If mouse tracking is switched off, mouse move events only occur if a mouse button is pressed while the mouse is being moved. If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.

pos() reports the position of the mouse cursor, relative to this widget. For press and release events, the position is usually the same as the position of the last mouse move event, but it might be different if the user’s hand shakes. This is a feature of the underlying window system, not Qt.

If you want to show a tooltip immediately, while the mouse is moving (e.g., to get the mouse coordinates with pos() and show them as a tooltip), you must first enable mouse tracking as described above. Then, to ensure that the tooltip is updated immediately, you must call showText() instead of setToolTip() in your implementation of .

PySide6.QtWidgets.QWidget.mousePressEvent(event)
Parameters

eventPySide6.QtGui.QMouseEvent

This event handler, for event event, can be reimplemented in a subclass to receive mouse press events for the widget.

If you create new widgets in the the mouseReleaseEvent() may not end up where you expect, depending on the underlying window system (or X11 window manager), the widgets’ location and maybe more.

The default implementation implements the closing of popup widgets when you click outside the window. For other widget types it does nothing.

PySide6.QtWidgets.QWidget.mouseReleaseEvent(event)
Parameters

eventPySide6.QtGui.QMouseEvent

This event handler, for event event, can be reimplemented in a subclass to receive mouse release events for the widget.

PySide6.QtWidgets.QWidget.move(arg__1)
Parameters

arg__1PySide6.QtCore.QPoint

PySide6.QtWidgets.QWidget.move(x, y)
Parameters
  • x – int

  • y – int

PySide6.QtWidgets.QWidget.moveEvent(event)
Parameters

eventPySide6.QtGui.QMoveEvent

PySide6.QtWidgets.QWidget.nativeEvent(eventType, message)
Parameters
Return type

PyObject

This special event handler can be reimplemented in a subclass to receive native platform events identified by eventType which are passed in the message parameter.

In your reimplementation of this function, if you want to stop the event being handled by Qt, return true and set result. The result parameter has meaning only on Windows. If you return false, this native event is passed back to Qt, which translates the event into a Qt event and sends it to the widget.

Note

Events are only delivered to this event handler if the widget has a native window handle.

Note

This function superseedes the event filter functions x11Event(), winEvent() and macEvent() of Qt 4.

Platform

Event Type Identifier

Message Type

Result Type

Windows

“windows_generic_MSG”

MSG *

LRESULT

macOS

“NSEvent”

NSEvent *

XCB

“xcb_generic_event_t”

xcb_generic_event_t *

See also

QAbstractNativeEventFilter

PySide6.QtWidgets.QWidget.nativeParentWidget()
Return type

PySide6.QtWidgets.QWidget

Returns the native parent for this widget, i.e. the next ancestor widget that has a system identifier, or None if it does not have any native parent.

See also

effectiveWinId()

PySide6.QtWidgets.QWidget.nextInFocusChain()
Return type

PySide6.QtWidgets.QWidget

Returns the next widget in this widget’s focus chain.

PySide6.QtWidgets.QWidget.normalGeometry()
Return type

PySide6.QtCore.QRect

PySide6.QtWidgets.QWidget.overrideWindowFlags(type)
Parameters

typeWindowFlags

Sets the window flags for the widget to flags, without telling the window system.

Warning

Do not call this function unless you really know what you’re doing.

See also

setWindowFlags()

PySide6.QtWidgets.QWidget.overrideWindowState(state)
Parameters

stateWindowStates

PySide6.QtWidgets.QWidget.paintEvent(event)
Parameters

eventPySide6.QtGui.QPaintEvent

PySide6.QtWidgets.QWidget.palette()
Return type

PySide6.QtGui.QPalette

See also

setPalette()

PySide6.QtWidgets.QWidget.parentWidget()
Return type

PySide6.QtWidgets.QWidget

PySide6.QtWidgets.QWidget.pos()
Return type

PySide6.QtCore.QPoint

PySide6.QtWidgets.QWidget.previousInFocusChain()
Return type

PySide6.QtWidgets.QWidget

The function returns the previous widget in this widget’s focus chain.

PySide6.QtWidgets.QWidget.raise_()

Raises this widget to the top of the parent widget’s stack.

After this call the widget will be visually in front of any overlapping sibling widgets.

Note

When using , you can call this function to ensure that the window is stacked on top.

PySide6.QtWidgets.QWidget.rect()
Return type

PySide6.QtCore.QRect

PySide6.QtWidgets.QWidget.releaseKeyboard()
PySide6.QtWidgets.QWidget.releaseMouse()
PySide6.QtWidgets.QWidget.releaseShortcut(id)
Parameters

id – int

Removes the shortcut with the given id from Qt’s shortcut system. The widget will no longer receive Shortcut events for the shortcut’s key sequence (unless it has other shortcuts with the same key sequence).

Warning

You should not normally need to use this function since Qt’s shortcut system removes shortcuts automatically when their parent widget is destroyed. It is best to use QAction or QShortcut to handle shortcuts, since they are easier to use than this low-level function. Note also that this is an expensive operation.

PySide6.QtWidgets.QWidget.removeAction(action)
Parameters

actionPySide6.QtGui.QAction

Removes the action action from this widget’s list of actions.

PySide6.QtWidgets.QWidget.render(target[, targetOffset=QPoint()[, sourceRegion=QRegion()[, renderFlags=QWidget.RenderFlags(DrawWindowBackground | DrawChildren)]]])
Parameters
PySide6.QtWidgets.QWidget.render(painter, targetOffset[, sourceRegion=QRegion()[, renderFlags=QWidget.RenderFlags(DrawWindowBackground | DrawChildren)]])
Parameters
PySide6.QtWidgets.QWidget.repaint(x, y, w, h)
Parameters
  • x – int

  • y – int

  • w – int

  • h – int

This is an overloaded function.

This version repaints a rectangle (x, y, w, h) inside the widget.

If w is negative, it is replaced with width() - x, and if h is negative, it is replaced width height() - y.

PySide6.QtWidgets.QWidget.repaint(arg__1)
Parameters

arg__1PySide6.QtCore.QRect

PySide6.QtWidgets.QWidget.repaint()

Repaints the widget directly by calling immediately, unless updates are disabled or the widget is hidden.

We suggest only using if you need an immediate repaint, for example during animation. In almost all circumstances update() is better, as it permits Qt to optimize for speed and minimize flicker.

Warning

If you call in a function which may itself be called from , you may get infinite recursion. The update() function never causes recursion.

PySide6.QtWidgets.QWidget.repaint(arg__1)
Parameters

arg__1PySide6.QtGui.QRegion

PySide6.QtWidgets.QWidget.resize(arg__1)
Parameters

arg__1PySide6.QtCore.QSize

PySide6.QtWidgets.QWidget.resize(w, h)
Parameters
  • w – int

  • h – int

PySide6.QtWidgets.QWidget.resizeEvent(event)
Parameters

eventPySide6.QtGui.QResizeEvent

This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the event parameter. When is called, the widget already has its new geometry. The old size is accessible through oldSize() .

The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.

See also

event() resize() QResizeEvent Scribble Example

PySide6.QtWidgets.QWidget.restoreGeometry(geometry)
Parameters

geometryPySide6.QtCore.QByteArray

Return type

bool

Restores the geometry and state of top-level widgets stored in the byte array geometry. Returns true on success; otherwise returns false.

If the restored geometry is off-screen, it will be modified to be inside the available screen geometry.

To restore geometry saved using QSettings , you can use code like this:

settings = QSettings("MyCompany", "MyApp")
myWidget.restoreGeometry(settings.value("myWidget/geometry").toByteArray())

See the Window Geometry documentation for an overview of geometry issues with windows.

Use restoreState() to restore the geometry and the state of toolbars and dock widgets.

PySide6.QtWidgets.QWidget.saveGeometry()
Return type

PySide6.QtCore.QByteArray

Saves the current geometry and state for top-level widgets.

To save the geometry when the window closes, you can implement a close event like this:

def closeEvent(self, event):

    settings = QSettings("MyCompany", "MyApp")
    settings.setValue("geometry", saveGeometry())
    QWidget.closeEvent(event)

See the Window Geometry documentation for an overview of geometry issues with windows.

Use saveState() to save the geometry and the state of toolbars and dock widgets.

PySide6.QtWidgets.QWidget.screen()
Return type

PySide6.QtGui.QScreen

Returns the screen the widget is on.

PySide6.QtWidgets.QWidget.scroll(dx, dy)
Parameters
  • dx – int

  • dy – int

Scrolls the widget including its children dx pixels to the right and dy downward. Both dx and dy may be negative.

After scrolling, the widgets will receive paint events for the areas that need to be repainted. For widgets that Qt knows to be opaque, this is only the newly exposed parts. For example, if an opaque widget is scrolled 8 pixels to the left, only an 8-pixel wide stripe at the right edge needs updating.

Since widgets propagate the contents of their parents by default, you need to set the autoFillBackground property, or use setAttribute() to set the WA_OpaquePaintEvent attribute, to make a widget opaque.

For widgets that use contents propagation, a scroll will cause an update of the entire scroll area.

See also

Transparency and Double Buffering

PySide6.QtWidgets.QWidget.scroll(dx, dy, arg__3)
Parameters

This is an overloaded function.

This version only scrolls r and does not move the children of the widget.

If r is empty or invalid, the result is undefined.

See also

QScrollArea

PySide6.QtWidgets.QWidget.setAcceptDrops(on)
Parameters

on – bool

See also

acceptDrops()

PySide6.QtWidgets.QWidget.setAccessibleDescription(description)
Parameters

description – str

PySide6.QtWidgets.QWidget.setAccessibleName(name)
Parameters

name – str

See also

accessibleName()

PySide6.QtWidgets.QWidget.setAttribute(arg__1[, on=true])
Parameters

Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.

See also

testAttribute()

PySide6.QtWidgets.QWidget.setAutoFillBackground(enabled)
Parameters

enabled – bool

PySide6.QtWidgets.QWidget.setBackgroundRole(arg__1)
Parameters

arg__1ColorRole

Sets the background role of the widget to role.

The background role defines the brush from the widget’s palette that is used to render the background.

If role is NoRole , then the widget inherits its parent’s background role.

Note that styles are free to choose any color from the palette. You can modify the palette or set a style sheet if you don’t achieve the result you want with .

PySide6.QtWidgets.QWidget.setBaseSize(arg__1)
Parameters

arg__1PySide6.QtCore.QSize

See also

baseSize()

PySide6.QtWidgets.QWidget.setBaseSize(basew, baseh)
Parameters
  • basew – int

  • baseh – int

This is an overloaded function.

This corresponds to setBaseSize ( QSize (basew, baseh)). Sets the widgets base size to width basew and height baseh.

PySide6.QtWidgets.QWidget.setContentsMargins(margins)
Parameters

marginsPySide6.QtCore.QMargins

This is an overloaded function.

The setContentsMargins function sets the margins around the widget’s contents.

Sets the margins around the contents of the widget to have the sizes determined by margins. The margins are used by the layout system, and may be used by subclasses to specify the area to draw in (e.g. excluding the frame).

Changing the margins will trigger a resizeEvent() .

PySide6.QtWidgets.QWidget.setContentsMargins(left, top, right, bottom)
Parameters
  • left – int

  • top – int

  • right – int

  • bottom – int

Sets the margins around the contents of the widget to have the sizes left, top, right, and bottom. The margins are used by the layout system, and may be used by subclasses to specify the area to draw in (e.g. excluding the frame).

Changing the margins will trigger a resizeEvent() .

PySide6.QtWidgets.QWidget.setContextMenuPolicy(policy)
Parameters

policyContextMenuPolicy

PySide6.QtWidgets.QWidget.setCursor(arg__1)
Parameters

arg__1PySide6.QtGui.QCursor

See also

cursor()

PySide6.QtWidgets.QWidget.setDisabled(arg__1)
Parameters

arg__1 – bool

Disables widget input events if disable is true; otherwise enables input events.

See the enabled documentation for more information.

See also

isEnabledTo() QKeyEvent QMouseEvent changeEvent()

PySide6.QtWidgets.QWidget.setEnabled(arg__1)
Parameters

arg__1 – bool

See also

isEnabled()

PySide6.QtWidgets.QWidget.setFixedHeight(h)
Parameters

h – int

Sets both the minimum and maximum heights of the widget to h without changing the widths. Provided for convenience.

PySide6.QtWidgets.QWidget.setFixedSize(arg__1)
Parameters

arg__1PySide6.QtCore.QSize

Sets both the minimum and maximum sizes of the widget to s, thereby preventing it from ever growing or shrinking.

This will override the default size constraints set by QLayout .

To remove constraints, set the size to QWIDGETSIZE_MAX .

Alternatively, if you want the widget to have a fixed size based on its contents, you can call setSizeConstraint ( SetFixedSize );

PySide6.QtWidgets.QWidget.setFixedSize(w, h)
Parameters
  • w – int

  • h – int

PySide6.QtWidgets.QWidget.setFixedWidth(w)
Parameters

w – int

Sets both the minimum and maximum width of the widget to w without changing the heights. Provided for convenience.

PySide6.QtWidgets.QWidget.setFocus(reason)
Parameters

reasonFocusReason

Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the active window . The reason argument will be passed into any focus event sent from this function, it is used to give an explanation of what caused the widget to get focus. If the window is not active, the widget will be given the focus when the window becomes active.

First, a focus about to change event is sent to the focus widget (if any) to tell it that it is about to lose the focus. Then focus is changed, a focus out event is sent to the previous focus item and a focus in event is sent to the new item to tell it that it just received the focus. (Nothing happens if the focus in and focus out widgets are the same.)

Note

On embedded platforms, will not cause an input panel to be opened by the input method. If you want this to happen, you have to send a RequestSoftwareInputPanel event to the widget yourself.

gives focus to a widget regardless of its focus policy, but does not clear any keyboard grab (see ).

Be aware that if the widget is hidden, it will not accept focus until it is shown.

Warning

If you call in a function which may itself be called from or , you may get an infinite recursion.

PySide6.QtWidgets.QWidget.setFocus()
PySide6.QtWidgets.QWidget.setFocusPolicy(policy)
Parameters

policyFocusPolicy

See also

focusPolicy()

PySide6.QtWidgets.QWidget.setFocusProxy(arg__1)
Parameters

arg__1PySide6.QtWidgets.QWidget

Sets the widget’s focus proxy to widget w. If w is None, the function resets this widget to have no focus proxy.

Some widgets can “have focus”, but create a child widget, such as QLineEdit , to actually handle the focus. In this case, the widget can set the line edit to be its focus proxy.

sets the widget which will actually get focus when “this widget” gets it. If there is a focus proxy, setFocus() and hasFocus() operate on the focus proxy. If “this widget” is the focus widget, then moves focus to the new focus proxy.

See also

focusProxy()

PySide6.QtWidgets.QWidget.setFont(arg__1)
Parameters

arg__1PySide6.QtGui.QFont

See also

font()

PySide6.QtWidgets.QWidget.setForegroundRole(arg__1)
Parameters

arg__1ColorRole

Sets the foreground role of the widget to role.

The foreground role defines the color from the widget’s palette that is used to draw the foreground.

If role is NoRole , the widget uses a foreground role that contrasts with the background role.

Note that styles are free to choose any color from the palette. You can modify the palette or set a style sheet if you don’t achieve the result you want with .

PySide6.QtWidgets.QWidget.setGeometry(arg__1)
Parameters

arg__1PySide6.QtCore.QRect

PySide6.QtWidgets.QWidget.setGeometry(x, y, w, h)
Parameters
  • x – int

  • y – int

  • w – int

  • h – int

See also

geometry()

PySide6.QtWidgets.QWidget.setGraphicsEffect(effect)
Parameters

effectPySide6.QtWidgets.QGraphicsEffect

The function is for setting the widget’s graphics effect.

Sets effect as the widget’s effect. If there already is an effect installed on this widget, QWidget will delete the existing effect before installing the new effect.

If effect is the installed effect on a different widget, will remove the effect from the widget and install it on this widget.

QWidget takes ownership of effect.

Note

This function will apply the effect on itself and all its children.

Note

Graphics effects are not supported for OpenGL-based widgets, such as QGLWidget, QOpenGLWidget and QQuickWidget .

See also

graphicsEffect()

PySide6.QtWidgets.QWidget.setHidden(hidden)
Parameters

hidden – bool

Convenience function, equivalent to setVisible (!``hidden``).

PySide6.QtWidgets.QWidget.setInputMethodHints(hints)
Parameters

hintsInputMethodHints

PySide6.QtWidgets.QWidget.setLayout(arg__1)
Parameters

arg__1PySide6.QtWidgets.QLayout

PySide6.QtWidgets.QWidget.setLayoutDirection(direction)
Parameters

directionLayoutDirection

PySide6.QtWidgets.QWidget.setLocale(locale)
Parameters

localePySide6.QtCore.QLocale

See also

locale()

PySide6.QtWidgets.QWidget.setMask(arg__1)
Parameters

arg__1PySide6.QtGui.QBitmap

PySide6.QtWidgets.QWidget.setMask(arg__1)
Parameters

arg__1PySide6.QtGui.QRegion

PySide6.QtWidgets.QWidget.setMaximumHeight(maxh)
Parameters

maxh – int

See also

maximumHeight()

PySide6.QtWidgets.QWidget.setMaximumSize(arg__1)
Parameters

arg__1PySide6.QtCore.QSize

See also

maximumSize()

PySide6.QtWidgets.QWidget.setMaximumSize(maxw, maxh)
Parameters
  • maxw – int

  • maxh – int

This is an overloaded function.

This function corresponds to setMaximumSize ( QSize (maxw, maxh)). Sets the maximum width to maxw and the maximum height to maxh.

PySide6.QtWidgets.QWidget.setMaximumWidth(maxw)
Parameters

maxw – int

See also

maximumWidth()

PySide6.QtWidgets.QWidget.setMinimumHeight(minh)
Parameters

minh – int

See also

minimumHeight()

PySide6.QtWidgets.QWidget.setMinimumSize(arg__1)
Parameters

arg__1PySide6.QtCore.QSize

See also

minimumSize()

PySide6.QtWidgets.QWidget.setMinimumSize(minw, minh)
Parameters
  • minw – int

  • minh – int

This is an overloaded function.

This function corresponds to setMinimumSize ( QSize (minw, minh)). Sets the minimum width to minw and the minimum height to minh.

PySide6.QtWidgets.QWidget.setMinimumWidth(minw)
Parameters

minw – int

See also

minimumWidth()

PySide6.QtWidgets.QWidget.setMouseTracking(enable)
Parameters

enable – bool

PySide6.QtWidgets.QWidget.setPalette(arg__1)
Parameters

arg__1PySide6.QtGui.QPalette

See also

palette()

PySide6.QtWidgets.QWidget.setParent(parent)
Parameters

parentPySide6.QtWidgets.QWidget

Sets the parent of the widget to parent, and resets the window flags. The widget is moved to position (0, 0) in its new parent.

If the new parent widget is in a different window, the reparented widget and its children are appended to the end of the tab chain of the new parent widget, in the same internal order as before. If one of the moved widgets had keyboard focus, calls clearFocus() for that widget.

If the new parent widget is in the same window as the old parent, setting the parent doesn’t change the tab order or keyboard focus.

If the “new” parent widget is the old parent widget, this function does nothing.

Note

The widget becomes invisible as part of changing its parent, even if it was previously visible. You must call show() to make the widget visible again.

Warning

It is very unlikely that you will ever need this function. If you have a widget that changes its content dynamically, it is far easier to use QStackedWidget .

See also

setWindowFlags()

PySide6.QtWidgets.QWidget.setParent(parent, f)
Parameters

This is an overloaded function.

This function also takes widget flags, f as an argument.

PySide6.QtWidgets.QWidget.setScreen(arg__1)
Parameters

arg__1PySide6.QtGui.QScreen

Sets the screen on which the widget should be shown to screen.

Setting the screen only makes sense for windows. If necessary, the widget’s window will get recreated on screen.

Note

If the screen is part of a virtual desktop of multiple screens, the window will not move automatically to screen. To place the window relative to the screen, use the screen’s topLeft() position.

See also

screen() setScreen()

PySide6.QtWidgets.QWidget.setShortcutAutoRepeat(id[, enable=true])
Parameters
  • id – int

  • enable – bool

If enable is true, auto repeat of the shortcut with the given id is enabled; otherwise it is disabled.

PySide6.QtWidgets.QWidget.setShortcutEnabled(id[, enable=true])
Parameters
  • id – int

  • enable – bool

If enable is true, the shortcut with the given id is enabled; otherwise the shortcut is disabled.

Warning

You should not normally need to use this function since Qt’s shortcut system enables/disables shortcuts automatically as widgets become hidden/visible and gain or lose focus. It is best to use QAction or QShortcut to handle shortcuts, since they are easier to use than this low-level function.

PySide6.QtWidgets.QWidget.setSizeIncrement(arg__1)
Parameters

arg__1PySide6.QtCore.QSize

See also

sizeIncrement()

PySide6.QtWidgets.QWidget.setSizeIncrement(w, h)
Parameters
  • w – int

  • h – int

This is an overloaded function.

Sets the x (width) size increment to w and the y (height) size increment to h.

PySide6.QtWidgets.QWidget.setSizePolicy(arg__1)
Parameters

arg__1PySide6.QtWidgets.QSizePolicy

See also

sizePolicy()

PySide6.QtWidgets.QWidget.setSizePolicy(horizontal, vertical)
Parameters
PySide6.QtWidgets.QWidget.setStatusTip(arg__1)
Parameters

arg__1 – str

See also

statusTip()

PySide6.QtWidgets.QWidget.setStyle(arg__1)
Parameters

arg__1PySide6.QtWidgets.QStyle

Sets the widget’s GUI style to style. The ownership of the style object is not transferred.

If no style is set, the widget uses the application’s style, style() instead.

Setting a widget’s style has no effect on existing or future child widgets.

Warning

This function is particularly useful for demonstration purposes, where you want to show Qt’s styling capabilities. Real applications should avoid it and use one consistent GUI style instead.

Warning

Qt style sheets are currently not supported for custom QStyle subclasses. We plan to address this in some future release.

PySide6.QtWidgets.QWidget.setStyleSheet(styleSheet)
Parameters

styleSheet – str

See also

styleSheet()

static PySide6.QtWidgets.QWidget.setTabOrder(arg__1, arg__2)
Parameters

Puts the second widget after the first widget in the focus order.

It effectively removes the second widget from its focus chain and inserts it after the first widget.

Note that since the tab order of the second widget is changed, you should order a chain like this:

setTabOrder(a, b) # a to b
setTabOrder(b, c) # a to b to c
setTabOrder(c, d) # a to b to c to d

not like this:

# WRONG
setTabOrder(c, d) # c to d
setTabOrder(a, b) # a to b AND c to d
setTabOrder(b, c) # a to b to c, but not c to d

If first or second has a focus proxy, correctly substitutes the proxy.

Note

Since Qt 5.10: A widget that has a child as focus proxy is understood as a compound widget. When setting a tab order between one or two compound widgets, the local tab order inside each will be preserved. This means that if both widgets are compound widgets, the resulting tab order will be from the last child inside first, to the first child inside second.

PySide6.QtWidgets.QWidget.setTabletTracking(enable)
Parameters

enable – bool

PySide6.QtWidgets.QWidget.setToolTip(arg__1)
Parameters

arg__1 – str

See also

toolTip()

PySide6.QtWidgets.QWidget.setToolTipDuration(msec)
Parameters

msec – int

PySide6.QtWidgets.QWidget.setUpdatesEnabled(enable)
Parameters

enable – bool

See also

updatesEnabled()

PySide6.QtWidgets.QWidget.setVisible(visible)
Parameters

visible – bool

See also

isVisible()

PySide6.QtWidgets.QWidget.setWhatsThis(arg__1)
Parameters

arg__1 – str

See also

whatsThis()

PySide6.QtWidgets.QWidget.setWindowFilePath(filePath)
Parameters

filePath – str

See also

windowFilePath()

PySide6.QtWidgets.QWidget.setWindowFlag(arg__1[, on=true])
Parameters

Sets the window flag flag on this widget if on is true; otherwise clears the flag.

PySide6.QtWidgets.QWidget.setWindowFlags(type)
Parameters

typeWindowFlags

See also

windowFlags()

PySide6.QtWidgets.QWidget.setWindowIcon(icon)
Parameters

iconPySide6.QtGui.QIcon

See also

windowIcon()

PySide6.QtWidgets.QWidget.setWindowIconText(arg__1)
Parameters

arg__1 – str

See also

windowIconText()

PySide6.QtWidgets.QWidget.setWindowModality(windowModality)
Parameters

windowModalityWindowModality

See also

windowModality()

PySide6.QtWidgets.QWidget.setWindowModified(arg__1)
Parameters

arg__1 – bool

PySide6.QtWidgets.QWidget.setWindowOpacity(level)
Parameters

level – float

See also

windowOpacity()

PySide6.QtWidgets.QWidget.setWindowRole(arg__1)
Parameters

arg__1 – str

Sets the window’s role to role. This only makes sense for windows on X11.

See also

windowRole()

PySide6.QtWidgets.QWidget.setWindowState(state)
Parameters

stateWindowStates

PySide6.QtWidgets.QWidget.setWindowTitle(arg__1)
Parameters

arg__1 – str

See also

windowTitle()

PySide6.QtWidgets.QWidget.show()

Shows the widget and its child widgets.

This is equivalent to calling showFullScreen() , showMaximized() , or setVisible (true), depending on the platform’s default behavior for the window flags.

PySide6.QtWidgets.QWidget.showEvent(event)
Parameters

eventPySide6.QtGui.QShowEvent

PySide6.QtWidgets.QWidget.showFullScreen()

Shows the widget in full-screen mode.

Calling this function only affects windows.

To return from full-screen mode, call showNormal() .

Full-screen mode works fine under Windows, but has certain problems under X. These problems are due to limitations of the ICCCM protocol that specifies the communication between X11 clients and the window manager. ICCCM simply does not understand the concept of non-decorated full-screen windows. Therefore, the best we can do is to request a borderless window and place and resize it to fill the entire screen. Depending on the window manager, this may or may not work. The borderless window is requested using MOTIF hints, which are at least partially supported by virtually all modern window managers.

An alternative would be to bypass the window manager entirely and create a window with the X11BypassWindowManagerHint flag. This has other severe problems though, like totally broken keyboard focus and very strange effects on desktop changes or when the user raises other windows.

X11 window managers that follow modern post-ICCCM specifications support full-screen mode properly.

PySide6.QtWidgets.QWidget.showMaximized()

Shows the widget maximized.

Calling this function only affects windows.

On X11, this function may not work properly with certain window managers. See the Window Geometry documentation for an explanation.

PySide6.QtWidgets.QWidget.showMinimized()

Shows the widget minimized, as an icon.

Calling this function only affects windows.

PySide6.QtWidgets.QWidget.showNormal()

Restores the widget after it has been maximized or minimized.

Calling this function only affects windows.

PySide6.QtWidgets.QWidget.size()
Return type

PySide6.QtCore.QSize

PySide6.QtWidgets.QWidget.sizeHint()
Return type

PySide6.QtCore.QSize

PySide6.QtWidgets.QWidget.sizeIncrement()
Return type

PySide6.QtCore.QSize

PySide6.QtWidgets.QWidget.sizePolicy()
Return type

PySide6.QtWidgets.QSizePolicy

See also

setSizePolicy()

PySide6.QtWidgets.QWidget.stackUnder(arg__1)
Parameters

arg__1PySide6.QtWidgets.QWidget

Places the widget under w in the parent widget’s stack.

To make this work, the widget itself and w must be siblings.

See also

raise() lower()

PySide6.QtWidgets.QWidget.statusTip()
Return type

str

See also

setStatusTip()

PySide6.QtWidgets.QWidget.style()
Return type

PySide6.QtWidgets.QStyle

PySide6.QtWidgets.QWidget.styleSheet()
Return type

str

See also

setStyleSheet()

PySide6.QtWidgets.QWidget.tabletEvent(event)
Parameters

eventPySide6.QtGui.QTabletEvent

This event handler, for event event, can be reimplemented in a subclass to receive tablet events for the widget.

If you reimplement this handler, it is very important that you ignore() the event if you do not handle it, so that the widget’s parent can interpret it.

The default implementation ignores the event.

If tablet tracking is switched off, tablet move events only occur if the stylus is in contact with the tablet, or at least one stylus button is pressed, while the stylus is being moved. If tablet tracking is switched on, tablet move events occur even while the stylus is hovering in proximity of the tablet, with no buttons pressed.

See also

ignore() accept() event() setTabletTracking() QTabletEvent

PySide6.QtWidgets.QWidget.testAttribute(arg__1)
Parameters

arg__1WidgetAttribute

Return type

bool

PySide6.QtWidgets.QWidget.toolTip()
Return type

str

See also

setToolTip()

PySide6.QtWidgets.QWidget.toolTipDuration()
Return type

int

PySide6.QtWidgets.QWidget.topLevelWidget()
Return type

PySide6.QtWidgets.QWidget

PySide6.QtWidgets.QWidget.underMouse()
Return type

bool

PySide6.QtWidgets.QWidget.ungrabGesture(type)
Parameters

typeGestureType

Unsubscribes the widget from a given gesture type

PySide6.QtWidgets.QWidget.unsetCursor()
PySide6.QtWidgets.QWidget.unsetLayoutDirection()
PySide6.QtWidgets.QWidget.unsetLocale()
PySide6.QtWidgets.QWidget.update()

Updates the widget unless updates are disabled or the widget is hidden.

This function does not cause an immediate repaint; instead it schedules a paint event for processing when Qt returns to the main event loop. This permits Qt to optimize for more speed and less flicker than a call to repaint() does.

Calling several times normally results in just one call.

Qt normally erases the widget’s area before the call. If the WA_OpaquePaintEvent widget attribute is set, the widget is responsible for painting all its pixels with an opaque color.

PySide6.QtWidgets.QWidget.update(arg__1)
Parameters

arg__1PySide6.QtCore.QRect

PySide6.QtWidgets.QWidget.update(arg__1)
Parameters

arg__1PySide6.QtGui.QRegion

PySide6.QtWidgets.QWidget.update(x, y, w, h)
Parameters
  • x – int

  • y – int

  • w – int

  • h – int

PySide6.QtWidgets.QWidget.updateGeometry()

Notifies the layout system that this widget has changed and may need to change geometry.

Call this function if the sizeHint() or sizePolicy() have changed.

For explicitly hidden widgets, is a no-op. The layout system will be notified as soon as the widget is shown.

PySide6.QtWidgets.QWidget.updateMicroFocus([query=Qt.ImQueryAll])
Parameters

queryInputMethodQuery

Updates the widget’s micro focus and informs input methods that the state specified by query has changed.

PySide6.QtWidgets.QWidget.updatesEnabled()
Return type

bool

PySide6.QtWidgets.QWidget.visibleRegion()
Return type

PySide6.QtGui.QRegion

Returns the unobscured region where paint events can occur.

For visible widgets, this is an approximation of the area not covered by other widgets; otherwise, this is an empty region.

The repaint() function calls this function if necessary, so in general you do not need to call it.

PySide6.QtWidgets.QWidget.whatsThis()
Return type

str

See also

setWhatsThis()

PySide6.QtWidgets.QWidget.wheelEvent(event)
Parameters

eventPySide6.QtGui.QWheelEvent

This event handler, for event event, can be reimplemented in a subclass to receive wheel events for the widget.

If you reimplement this handler, it is very important that you ignore() the event if you do not handle it, so that the widget’s parent can interpret it.

The default implementation ignores the event.

See also

ignore() accept() event() QWheelEvent

PySide6.QtWidgets.QWidget.winId()
Return type

WId

PySide6.QtWidgets.QWidget.window()
Return type

PySide6.QtWidgets.QWidget

Returns the window for this widget, i.e. the next ancestor widget that has (or could have) a window-system frame.

If the widget is a window, the widget itself is returned.

Typical usage is changing the window title:

aWidget.window().setWindowTitle("New Window Title")

See also

isWindow()

PySide6.QtWidgets.QWidget.windowFilePath()
Return type

str

PySide6.QtWidgets.QWidget.windowFlags()
Return type

WindowFlags

See also

setWindowFlags()

PySide6.QtWidgets.QWidget.windowHandle()
Return type

PySide6.QtGui.QWindow

If this is a native widget, return the associated QWindow . Otherwise return null.

Native widgets include toplevel widgets, QGLWidget, and child widgets on which was called.

See also

screen()

PySide6.QtWidgets.QWidget.windowIcon()
Return type

PySide6.QtGui.QIcon

See also

setWindowIcon()

PySide6.QtWidgets.QWidget.windowIconChanged(icon)
Parameters

iconPySide6.QtGui.QIcon

PySide6.QtWidgets.QWidget.windowIconText()
Return type

str

PySide6.QtWidgets.QWidget.windowIconTextChanged(iconText)
Parameters

iconText – str

PySide6.QtWidgets.QWidget.windowModality()
Return type

WindowModality

PySide6.QtWidgets.QWidget.windowOpacity()
Return type

float

PySide6.QtWidgets.QWidget.windowRole()
Return type

str

Returns the window’s role, or an empty string.

PySide6.QtWidgets.QWidget.windowState()
Return type

WindowStates

Returns the current window state. The window state is a OR’ed combination of WindowState : WindowMinimized , WindowMaximized , WindowFullScreen , and WindowActive .

See also

WindowState setWindowState()

PySide6.QtWidgets.QWidget.windowTitle()
Return type

str

See also

setWindowTitle()

PySide6.QtWidgets.QWidget.windowTitleChanged(title)
Parameters

title – str

PySide6.QtWidgets.QWidget.windowType()
Return type

WindowType

PySide6.QtWidgets.QWidget.x()
Return type

int

PySide6.QtWidgets.QWidget.y()
Return type

int