Skip to content

PythonQt.Qt.QWidget

QWidget

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

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 nullptr (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 Qt::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.

A parent widget containing various child
widgets.

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 paintEvent() 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 underMouse() 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:

  • paintEvent() 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 paintEvent() or a function called by a paintEvent().
  • 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 grabMouse(). Pressing the mouse without releasing it is effectively the same as calling grabMouse().
  • 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 QWidget::event().
  • focusInEvent() 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.
  • focusOutEvent() 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 QWidget::event().
  • wheelEvent() is called whenever the user turns the mouse wheel while the widget has the focus.
  • enterEvent() is called when the mouse enters the widget's screen space. (This excludes screen space owned by any of the widget's children.)
  • leaveEvent() is called when the mouse leaves the widget's screen space. If the mouse enters a child widget it will not cause a leaveEvent().
  • moveEvent() 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 QEvent::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, activateWindow(), 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, isWindow(), mouseTracking, updatesEnabled, visibleRegion().
Look and feel style(), setStyle(), styleSheet, cursor, font, palette, backgroundRole(), setBackgroundRole(), fontInfo(), fontMetrics().
Keyboard focus functions focus, focusPolicy, setFocus(), clearFocus(), setTabOrder(), setFocusProxy(), focusNextChild(), focusPreviousChild().
Mouse and keyboard grabbing grabMouse(), releaseMouse(), grabKeyboard(), releaseKeyboard(), mouseGrabber(), keyboardGrabber().
Event handlers event(), mousePressEvent(), mouseReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), keyPressEvent(), keyReleaseEvent(), focusInEvent(), focusOutEvent(), wheelEvent(), enterEvent(), leaveEvent(), paintEvent(), moveEvent(), resizeEvent(), closeEvent(), dragEnterEvent(), dragMoveEvent(), dragLeaveEvent(), dropEvent(), childEvent(), showEvent(), hideEvent(), customEvent(). changeEvent(),
System functions parentWidget(), window(), setParent(), winId(), find(), metric().
Context menu contextMenuPolicy, contextMenuEvent(), customContextMenuRequested(), 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 paintEvent() to avoid flicker.

Since Qt 4.1, the contents of parent widgets are propagated by default to each of their children as long as Qt::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.

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 Qt::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 QPalette::Window role), set the autoFillBackground property, and only implement the necessary drawing functionality in the widget's paintEvent().

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 Qt::WA_OpaquePaintEvent, avoiding any unnecessary overhead associated with repainting the widget's background.

If a widget has both the Qt::WA_OpaquePaintEvent widget attribute and the autoFillBackground property set, the Qt::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.

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 Qt::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 Qt::FramelessWindowHint window flag set for the translucency to work.
  • macOS: The widget needs to have the Qt::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 Qt::AA_NativeWindows attribute on your application. All widgets will be native widgets.
  3. Set the Qt::WA_NativeWindow attribute on widgets: The widget itself and all of its ancestors will become native (unless Qt::WA_DontCreateNativeAncestors is set).
  4. Call QWidget::winId to enforce a native window (this implies 3).
  5. Set the Qt::WA_PaintOnScreen attribute to enforce a native window (this implies 3).

Source: https://doc.qt.io/archives/qt-5.15/qwidget.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
DrawChildren attribute Any (shared captured text)
DrawWindowBackground attribute Any (shared captured text)
IgnoreMask attribute Any (shared captured text)
PaintDeviceMetric attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
PdmDepth attribute Any (shared captured text)
PdmDevicePixelRatio attribute Any (shared captured text)
PdmDevicePixelRatioScaled attribute Any (shared captured text)
PdmDpiX attribute Any (shared captured text)
PdmDpiY attribute Any (shared captured text)
PdmHeight attribute Any (shared captured text)
PdmHeightMM attribute Any (shared captured text)
PdmNumColors attribute Any (shared captured text)
PdmPhysicalDpiX attribute Any (shared captured text)
PdmPhysicalDpiY attribute Any (shared captured text)
PdmWidth attribute Any (shared captured text)
PdmWidthMM attribute Any (shared captured text)
RenderFlag attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
RenderFlags attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
acceptDrops attribute bool This property holds whether drop events are enabled for this widget (shared captured text)
accessibleDescription attribute str This property holds the widget's description as seen by assistive technologies (shared captured text)
accessibleName attribute str This property holds the widget's name as seen by assistive technologies (shared captured text)
actionEvent function (self, event: Any) -> None This event handler is called with the given event whenever the widget's actions are changed. (shared captured text)
actions function (self) -> tuple X.actions() -> tuple (shared captured text)
activateWindow function (self) -> None Sets the top-level widget containing this widget to be the active window. (shared captured text)
addAction function (self, action: Any) -> None Appends the action action to this widget's list of actions. (shared captured text)
addActions function (self, actions: Any) -> None Appends the actions actions to this widget's list of actions. (shared captured text)
adjustSize function (self) -> None Adjusts the size of the widget to fit its contents. (shared captured text)
autoFillBackground attribute bool This property holds whether the widget background is filled automatically (shared captured text)
backgroundRole function (self) -> Any Returns the background role of the widget. (shared captured text)
backingStore function (self) -> Any X.backingStore() -> PythonQt.QtGui.QBackingStore (shared captured text)
baseSize attribute QSize This property holds the base size of the widget (shared captured text)
blockSignals function (self, b: Any) -> bool X.blockSignals(b) -> bool (shared captured text)
changeEvent function (self, arg__1: Any) -> None This event handler can be reimplemented to handle state changes. (shared captured text)
childAt function (self, x: Any, y: Any) -> Any X.childAt(x, y) -> PythonQt.QtGui.QWidget (shared captured text)
childEvent function (self, event: Any) -> Any (shared captured text)
children function (self) -> tuple X.children() -> tuple (shared captured text)
childrenRect attribute QRect This property holds the bounding rectangle of the widget's children (shared captured text)
childrenRegion attribute QRegion This property holds the combined region occupied by the widget's children (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
clearFocus function (self) -> None Takes keyboard input focus from the widget. (shared captured text)
clearMask function (self) -> None Removes any mask set by [setMask](https://doc.qt.io/archives/qt-5.15/qwidget.html#setMask)(). (shared captured text)
close function (self) -> bool X.close() -> bool (shared captured text)
closeEvent function (self, event: Any) -> None 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. (shared captured text)
colorCount function (self) -> int X.colorCount() -> int (shared captured text)
connect function (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool X.connect(signal, receiver, slot, type) -> bool (shared captured text)
contentsMargins function (self) -> Any X.contentsMargins() -> PythonQt.QtGui.QMargins (shared captured text)
contentsRect function (self) -> Any X.contentsRect() -> PythonQt.QtCore.QRect (shared captured text)
contextMenuEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented in a subclass to receive widget context menu events. (shared captured text)
contextMenuPolicy attribute Any How the widget shows a context menu (shared captured text)
createWinId function (self) -> None (shared captured text)
createWindowContainer function (self, window: Any, parent: Any, arg2: flags) -> Any X.createWindowContainer(window, parent, flags) -> PythonQt.QtGui.QWidget (shared captured text)
cursor attribute QCursor This property holds the cursor shape for this widget (shared captured text)
customContextMenuRequested function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWidget.customContextMenuRequested; argument details are not documented.
customEvent function (self, event: Any) -> Any (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
deleteLater function (self) -> Any (shared captured text)
depth function (self) -> int X.depth() -> int (shared captured text)
destroy function (self, destroyWindow: bool, destroySubWindows: bool) -> None X.destroy(destroyWindow, destroySubWindows) (shared captured text)
destroyed function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWidget.destroyed; argument details are not documented.
devType function (self) -> int X.devType() -> int (shared captured text)
devicePixelRatio function (self) -> int X.devicePixelRatio() -> int (shared captured text)
devicePixelRatioF function (self) -> float X.devicePixelRatioF() -> float (shared captured text)
devicePixelRatioFScale function (self) -> float X.devicePixelRatioFScale() -> float (shared captured text)
disconnect function (self, signal: Any, receiver: Any, slot: Any) -> bool X.disconnect(signal, receiver, slot) -> bool (shared captured text)
dragEnterEvent function (self, event: Any) -> None This event handler is called when a drag is in progress and the mouse enters this widget. (shared captured text)
dragLeaveEvent function (self, event: Any) -> None This event handler is called when a drag is in progress and the mouse leaves this widget. (shared captured text)
dragMoveEvent function (self, event: Any) -> None This event handler is called if a drag is in progress, and when any of the following conditions occur: the cursor enters this widget, the cursor moves within this widget, or a modifier key is… (shared captured text)
dropEvent function (self, event: Any) -> None This event handler is called when the drag is dropped on this widget. (shared captured text)
dumpObjectInfo function (self) -> Any (shared captured text)
dumpObjectTree function (self) -> Any (shared captured text)
dynamicPropertyNames function (self) -> Any (shared captured text)
effectiveWinId function (self) -> int X.effectiveWinId() -> int (shared captured text)
enabled attribute Any This property holds whether the widget is enabled (shared captured text)
ensurePolished function (self) -> None Ensures that the widget and its children have been polished by [QStyle](https://doc.qt.io/archives/qt-5.15/qstyle.html) (i.e., have a proper font and palette). (shared captured text)
enterEvent function (self, event: Any) -> None This event handler can be reimplemented in a subclass to receive widget enter events which are passed in the event parameter. (shared captured text)
event function (self, event: Any) -> bool X.event(event) -> bool (shared captured text)
eventFilter function (self, watched: Any, event: Any) -> bool X.eventFilter(watched, event) -> bool (shared captured text)
findChild function (self, type: Any, name: Any) -> Any X.findChild(type, name) -> PythonQt.private.QObject (shared captured text)
findChildren function (self, type: Any, name: Any) -> tuple X.findChildren(type, name) -> tuple (shared captured text)
focus attribute Any This property holds whether this widget (or its focus proxy) has the keyboard input focus (shared captured text)
focusInEvent function (self, event: Any) -> None This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget. (shared captured text)
focusNextChild function (self) -> bool X.focusNextChild() -> bool (shared captured text)
focusNextPrevChild function (self, next: bool) -> bool X.focusNextPrevChild(next) -> bool (shared captured text)
focusOutEvent function (self, event: Any) -> None This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) for the widget. (shared captured text)
focusPolicy attribute Any This property holds the way the widget accepts keyboard focus (shared captured text)
focusPreviousChild function (self) -> bool X.focusPreviousChild() -> bool (shared captured text)
focusProxy function (self) -> Any X.focusProxy() -> PythonQt.QtGui.QWidget (shared captured text)
focusWidget function (self) -> Any X.focusWidget() -> PythonQt.QtGui.QWidget (shared captured text)
font attribute QFont This property holds the font currently set for the widget (shared captured text)
fontInfo function (self) -> Any X.fontInfo() -> PythonQt.QtGui.QFontInfo (shared captured text)
fontMetrics function (self) -> Any X.fontMetrics() -> PythonQt.QtGui.QFontMetrics (shared captured text)
foregroundRole function (self) -> Any Returns the foreground role. (shared captured text)
frameGeometry attribute QRect Geometry of the widget relative to its parent including any window frame (shared captured text)
frameSize attribute QSize This property holds the size of the widget including any window frame (shared captured text)
fullScreen attribute Any This property holds whether the widget is shown in full screen mode (shared captured text)
geometry attribute QRect This property holds the geometry of the widget relative to its parent and excluding the window frame (shared captured text)
grab function (self, rectangle: Any) -> Any X.grab(rectangle) -> PythonQt.QtGui.QPixmap (shared captured text)
grabGesture function (self, type: Any, arg1: flags) -> None X.grabGesture(type, flags) (shared captured text)
grabKeyboard function (self) -> None Grabs the keyboard input. (shared captured text)
grabMouse function (self, arg__1: Any) -> None Grabs the mouse input. (shared captured text)
grabShortcut function (self, key: Any, context: Any) -> int X.grabShortcut(key, context) -> int (shared captured text)
graphicsEffect function (self) -> Any X.graphicsEffect() -> PythonQt.QtGui.QGraphicsEffect (shared captured text)
graphicsProxyWidget function (self) -> Any X.graphicsProxyWidget() -> PythonQt.QtGui.QGraphicsProxyWidget (shared captured text)
hasFocus function (self) -> bool X.hasFocus() -> bool (shared captured text)
hasHeightForWidth function (self) -> bool X.hasHeightForWidth() -> bool (shared captured text)
hasMouseTracking function (self) -> bool X.hasMouseTracking() -> bool (shared captured text)
height attribute int This property holds the height of the widget excluding any window frame (shared captured text)
heightForWidth function (self, arg__1: int) -> int X.heightForWidth(arg__1) -> int (shared captured text)
heightMM function (self) -> int X.heightMM() -> int (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
hide function (self) -> None Hides the widget. (shared captured text)
hideEvent function (self, event: Any) -> None This event handler can be reimplemented in a subclass to receive widget hide events. (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
initPainter function (self, painter: Any) -> None Initializes the painter pen, background and font to the same as the given widget's. (shared captured text)
inputMethodEvent function (self, arg__1: Any) -> None This event handler, for event event, can be reimplemented in a subclass to receive. (shared captured text)
inputMethodHints attribute Any What input method specific hints the widget has. (shared captured text)
inputMethodQuery function (self, arg__1: Any) -> Any X.inputMethodQuery(arg__1) -> object (shared captured text)
insertAction function (self, before: Any, action: Any) -> None X.insertAction(before, action) (shared captured text)
insertActions function (self, before: Any, actions: Any) -> None X.insertActions(before, actions) (shared captured text)
installEventFilter function (self, filterObj: Any) -> Any (shared captured text)
isActiveWindow attribute bool This property holds whether this widget's window is the active window (shared captured text)
isAncestorOf function (self, child: Any) -> bool X.isAncestorOf(child) -> bool (shared captured text)
isEnabled function (self) -> bool X.isEnabled() -> bool (shared captured text)
isEnabledTo function (self, arg__1: Any) -> bool X.isEnabledTo(arg__1) -> bool (shared captured text)
isFullScreen function (self) -> bool X.isFullScreen() -> bool (shared captured text)
isHidden function (self) -> bool X.isHidden() -> bool (shared captured text)
isLeftToRight function (self) -> bool X.isLeftToRight() -> bool (shared captured text)
isMaximized function (self) -> bool X.isMaximized() -> bool (shared captured text)
isMinimized function (self) -> bool X.isMinimized() -> bool (shared captured text)
isModal function (self) -> bool X.isModal() -> bool (shared captured text)
isRightToLeft function (self) -> bool X.isRightToLeft() -> bool (shared captured text)
isSignalConnected function (self, signal: Any) -> bool X.isSignalConnected(signal) -> bool (shared captured text)
isVisible function (self) -> bool X.isVisible() -> bool (shared captured text)
isVisibleTo function (self, arg__1: Any) -> bool X.isVisibleTo(arg__1) -> bool (shared captured text)
isWidgetType function (self) -> bool X.isWidgetType() -> bool (shared captured text)
isWindow function (self) -> bool X.isWindow() -> bool (shared captured text)
isWindowModified function (self) -> bool X.isWindowModified() -> bool (shared captured text)
isWindowType function (self) -> bool X.isWindowType() -> bool (shared captured text)
keyPressEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented in a subclass to receive key press events for the widget. (shared captured text)
keyReleaseEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented in a subclass to receive key release events for the widget. (shared captured text)
keyboardGrabber function (self) -> Any X.keyboardGrabber() -> PythonQt.QtGui.QWidget (shared captured text)
killTimer function (self, id: Any) -> Any (shared captured text)
layout function (self) -> Any X.layout() -> PythonQt.QtGui.QLayout (shared captured text)
layoutDirection attribute Any This property holds the layout direction for this widget. (shared captured text)
leaveEvent function (self, event: Any) -> None This event handler can be reimplemented in a subclass to receive widget leave events which are passed in the event parameter. (shared captured text)
locale attribute QLocale This property holds the widget's locale (shared captured text)
logicalDpiX function (self) -> int X.logicalDpiX() -> int (shared captured text)
logicalDpiY function (self) -> int X.logicalDpiY() -> int (shared captured text)
lower function (self) -> None Lowers the widget to the bottom of the parent widget's stack. (shared captured text)
mapFrom function (self, arg__1: Any, arg__2: Any) -> Any X.mapFrom(arg__1, arg__2) -> PythonQt.QtCore.QPoint (shared captured text)
mapFromGlobal function (self, arg__1: Any) -> Any X.mapFromGlobal(arg__1) -> PythonQt.QtCore.QPoint (shared captured text)
mapFromParent function (self, arg__1: Any) -> Any X.mapFromParent(arg__1) -> PythonQt.QtCore.QPoint (shared captured text)
mapTo function (self, arg__1: Any, arg__2: Any) -> Any X.mapTo(arg__1, arg__2) -> PythonQt.QtCore.QPoint (shared captured text)
mapToGlobal function (self, arg__1: Any) -> Any X.mapToGlobal(arg__1) -> PythonQt.QtCore.QPoint (shared captured text)
mapToParent function (self, arg__1: Any) -> Any X.mapToParent(arg__1) -> PythonQt.QtCore.QPoint (shared captured text)
mask function (self) -> Any X.mask() -> PythonQt.QtGui.QRegion (shared captured text)
maximized attribute Any This property holds whether this widget is maximized (shared captured text)
maximumHeight attribute int This property holds the widget's maximum height in pixels (shared captured text)
maximumSize attribute QSize This property holds the widget's maximum size in pixels (shared captured text)
maximumWidth attribute int This property holds the widget's maximum width in pixels (shared captured text)
metaObject function (self) -> Any X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text)
metric function (self, arg__1: Any) -> int X.metric(arg__1) -> int (shared captured text)
minimized attribute Any This property holds whether this widget is minimized (iconified) (shared captured text)
minimumHeight attribute int This property holds the widget's minimum height in pixels (shared captured text)
minimumSize attribute QSize This property holds the widget's minimum size (shared captured text)
minimumSizeHint attribute QSize This property holds the recommended minimum size for the widget (shared captured text)
minimumWidth attribute int This property holds the widget's minimum width in pixels (shared captured text)
modal attribute Any This property holds whether the widget is a modal widget (shared captured text)
mouseDoubleClickEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented in a subclass to receive mouse double click events for the widget. (shared captured text)
mouseGrabber function (self) -> Any X.mouseGrabber() -> PythonQt.QtGui.QWidget (shared captured text)
mouseMoveEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented in a subclass to receive mouse move events for the widget. (shared captured text)
mousePressEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented in a subclass to receive mouse press events for the widget. (shared captured text)
mouseReleaseEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented in a subclass to receive mouse release events for the widget. (shared captured text)
mouseTracking attribute Any This property holds whether mouse tracking is enabled for the widget (shared captured text)
move function (self, x: Any, y: Any) -> None X.move(x, y) (shared captured text)
moveEvent function (self, event: Any) -> None This event handler can be reimplemented in a subclass to receive widget move events which are passed in the event parameter. (shared captured text)
moveToThread function (self, thread: Any) -> Any (shared captured text)
nativeEvent function (self, eventType: Any, message: int, result: Any) -> bool X.nativeEvent(eventType, message, result) -> bool (shared captured text)
nativeParentWidget function (self) -> Any X.nativeParentWidget() -> PythonQt.QtGui.QWidget (shared captured text)
nextInFocusChain function (self) -> Any X.nextInFocusChain() -> PythonQt.QtGui.QWidget (shared captured text)
normalGeometry attribute QRect This property holds the geometry of the widget as it will appear when shown as a normal (not maximized or full screen) top-level widget (shared captured text)
objectName attribute Any (shared captured text)
objectNameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWidget.objectNameChanged; argument details are not documented.
overrideWindowFlags function (self, type: Any) -> None Sets the window flags for the widget to flags, without telling the window system. (shared captured text)
overrideWindowState function (self, state: Any) -> None (shared captured text)
paintEngine function (self) -> Any X.paintEngine() -> PythonQt.QtGui.QPaintEngine (shared captured text)
paintEvent function (self, event: Any) -> None This event handler can be reimplemented in a subclass to receive paint events passed in event. (shared captured text)
paintingActive function (self) -> bool X.paintingActive() -> bool (shared captured text)
palette attribute QPalette This property holds the widget's palette (shared captured text)
parent function (self) -> Any X.parent() -> PythonQt.private.QObject (shared captured text)
parentWidget function (self) -> Any X.parentWidget() -> PythonQt.QtGui.QWidget (shared captured text)
physicalDpiX function (self) -> int X.physicalDpiX() -> int (shared captured text)
physicalDpiY function (self) -> int X.physicalDpiY() -> int (shared captured text)
pos attribute QPoint This property holds the position of the widget within its parent widget (shared captured text)
previousInFocusChain function (self) -> Any X.previousInFocusChain() -> PythonQt.QtGui.QWidget (shared captured text)
property function (self, name: Any) -> Any X.property(name) -> object (shared captured text)
raise_ function (self) -> Any Native spelling: raise; access it through getattr on the native object. (shared captured text)
rect attribute QRect This property holds the internal geometry of the widget excluding any window frame (shared captured text)
redirected function (self, offset: Any) -> Any X.redirected(offset) -> PythonQt.QtGui.QPaintDevice (shared captured text)
releaseKeyboard function (self) -> None Releases the keyboard grab. (shared captured text)
releaseMouse function (self) -> None Releases the mouse grab. (shared captured text)
releaseShortcut function (self, id: int) -> None Removes the shortcut with the given id from Qt's shortcut system. (shared captured text)
removeAction function (self, action: Any) -> None Removes the action action from this widget's list of actions. (shared captured text)
removeEventFilter function (self, obj: Any) -> Any (shared captured text)
render function (self, target: Any, targetOffset: Any, sourceRegion: Any, renderFlags: Any) -> None X.render(target, targetOffset, sourceRegion, renderFlags) (shared captured text)
repaint function (self, x: Any, y: Any, w: Any, h: Any) -> None X.repaint(x, y, w, h) (shared captured text)
resize function (self, w: Any, h: Any) -> None X.resize(w, h) (shared captured text)
resizeEvent function (self, event: Any) -> None This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the event parameter. (shared captured text)
restoreGeometry function (self, geometry: Any) -> bool X.restoreGeometry(geometry) -> bool (shared captured text)
saveGeometry function (self) -> Any X.saveGeometry() -> PythonQt.QtCore.QByteArray (shared captured text)
scroll function (self, dx: int, dy: int, arg__3: Any) -> None X.scroll(dx, dy, arg__3) (shared captured text)
sender function (self) -> Any X.sender() -> PythonQt.private.QObject (shared captured text)
senderSignalIndex function (self) -> int X.senderSignalIndex() -> int (shared captured text)
setAcceptDrops function (self, on: bool) -> None (shared captured text)
setAccessibleDescription function (self, description: str) -> None (shared captured text)
setAccessibleName function (self, name: str) -> None (shared captured text)
setAttribute function (self, arg__1: Any, on: bool) -> None X.setAttribute(arg__1, on) (shared captured text)
setAutoFillBackground function (self, enabled: bool) -> None (shared captured text)
setBackgroundRole function (self, arg__1: Any) -> None Sets the background role of the widget to role. (shared captured text)
setBaseSize function (self, basew: Any, baseh: Any) -> None X.setBaseSize(basew, baseh) (shared captured text)
setContentsMargins function (self, left: Any, top: Any, right: Any, bottom: Any) -> None X.setContentsMargins(left, top, right, bottom) (shared captured text)
setContextMenuPolicy function (self, policy: Any) -> None (shared captured text)
setCursor function (self, arg__1: Any) -> None (shared captured text)
setDisabled function (self, a: Any) -> None Disables widget input events if disable is true; otherwise enables input events. (shared captured text)
setEnabled function (self, a: Any) -> None (shared captured text)
setFixedHeight function (self, h: int) -> None Sets both the minimum and maximum heights of the widget to h without changing the widths. (shared captured text)
setFixedSize function (self, w: Any, h: Any) -> None X.setFixedSize(w, h) (shared captured text)
setFixedWidth function (self, w: int) -> None Sets both the minimum and maximum width of the widget to w without changing the heights. (shared captured text)
setFocus function (self, reason: Any) -> None This is an overloaded function. (shared captured text)
setFocusPolicy function (self, policy: Any) -> None (shared captured text)
setFocusProxy function (self, arg__1: Any) -> None Sets the widget's focus proxy to widget w. (shared captured text)
setFont function (self, arg__1: Any) -> None (shared captured text)
setForegroundRole function (self, arg__1: Any) -> None Sets the foreground role of the widget to role. (shared captured text)
setGeometry function (self, x: Any, y: Any, w: Any, h: Any) -> None X.setGeometry(x, y, w, h) (shared captured text)
setGraphicsEffect function (self, effect: Any) -> None The setGraphicsEffect function is for setting the widget's graphics effect. (shared captured text)
setHidden function (self, hidden: bool) -> None Convenience function, equivalent to [setVisible](https://doc.qt.io/archives/qt-5.15/qwidget.html#visible-prop)(!hidden). (shared captured text)
setInputMethodHints function (self, hints: Any) -> None (shared captured text)
setLayout function (self, arg__1: Any) -> None Sets the layout manager for this widget to layout. (shared captured text)
setLayoutDirection function (self, direction: Any) -> None (shared captured text)
setLocale function (self, locale: Any) -> None (shared captured text)
setMask function (self, arg__1: Any) -> None Causes only the pixels of the widget for which bitmap has a corresponding 1 bit to be visible. (shared captured text)
setMaximumHeight function (self, maxh: int) -> None (shared captured text)
setMaximumSize function (self, maxw: Any, maxh: Any) -> None X.setMaximumSize(maxw, maxh) (shared captured text)
setMaximumWidth function (self, maxw: int) -> None (shared captured text)
setMinimumHeight function (self, minh: int) -> None (shared captured text)
setMinimumSize function (self, minw: Any, minh: Any) -> None X.setMinimumSize(minw, minh) (shared captured text)
setMinimumWidth function (self, minw: int) -> None (shared captured text)
setMouseTracking function (self, enable: bool) -> None (shared captured text)
setObjectName function (self, name: Any) -> Any (shared captured text)
setPalette function (self, arg__1: Any) -> None (shared captured text)
setParent function (self, parent: Any, f: Any) -> None X.setParent(parent, f) (shared captured text)
setProperty function (self, name: Any, value: Any) -> bool X.setProperty(name, value) -> bool (shared captured text)
setShortcutAutoRepeat function (self, id: int, enable: bool) -> None X.setShortcutAutoRepeat(id, enable) (shared captured text)
setShortcutEnabled function (self, id: int, enable: bool) -> None X.setShortcutEnabled(id, enable) (shared captured text)
setSizeIncrement function (self, w: Any, h: Any) -> None X.setSizeIncrement(w, h) (shared captured text)
setSizePolicy function (self, horizontal: Any, vertical: Any) -> None X.setSizePolicy(horizontal, vertical) (shared captured text)
setStatusTip function (self, arg__1: str) -> None (shared captured text)
setStyle function (self, arg__1: Any) -> None Sets the widget's GUI style to style. (shared captured text)
setStyleSheet function (self, styleSheet: str) -> None (shared captured text)
setTabOrder function (self, arg__1: Any, arg__2: Any) -> None X.setTabOrder(arg__1, arg__2) (shared captured text)
setToolTip function (self, arg__1: str) -> None (shared captured text)
setToolTipDuration function (self, msec: int) -> None (shared captured text)
setUpdatesEnabled function (self, enable: bool) -> None (shared captured text)
setVisible function (self, visible: bool) -> None (shared captured text)
setWhatsThis function (self, arg__1: str) -> None (shared captured text)
setWindowFilePath function (self, filePath: str) -> None (shared captured text)
setWindowFlags function (self, type: Any) -> None (shared captured text)
setWindowIcon function (self, icon: Any) -> None (shared captured text)
setWindowIconText function (self, arg__1: str) -> None (shared captured text)
setWindowModality function (self, windowModality: Any) -> None (shared captured text)
setWindowModified function (self, a: Any) -> None (shared captured text)
setWindowOpacity function (self, level: float) -> None (shared captured text)
setWindowRole function (self, arg__1: str) -> None Sets the window's role to role. (shared captured text)
setWindowState function (self, state: Any) -> None Sets the window state to windowState. (shared captured text)
setWindowTitle function (self, a: Any) -> None (shared captured text)
sharedPainter function (self) -> Any X.sharedPainter() -> PythonQt.QtGui.QPainter (shared captured text)
show function (self) -> None Shows the widget and its child widgets. (shared captured text)
showEvent function (self, event: Any) -> None This event handler can be reimplemented in a subclass to receive widget show events which are passed in the event parameter. (shared captured text)
showFullScreen function (self) -> None Shows the widget in full-screen mode. (shared captured text)
showMaximized function (self) -> None Shows the widget maximized. (shared captured text)
showMinimized function (self) -> None Shows the widget minimized, as an icon. (shared captured text)
showNormal function (self) -> None Restores the widget after it has been maximized or minimized. (shared captured text)
signalsBlocked function (self) -> bool X.signalsBlocked() -> bool (shared captured text)
size attribute QSize This property holds the size of the widget excluding any window frame (shared captured text)
sizeHint attribute QSize This property holds the recommended size for the widget (shared captured text)
sizeIncrement attribute QSize This property holds the size increment of the widget (shared captured text)
sizePolicy attribute QSizePolicy This property holds the default layout behavior of the widget (shared captured text)
stackUnder function (self, arg__1: Any) -> None Places the widget under w in the parent widget's stack. (shared captured text)
startTimer function (self, interval: Any, timerType: Any) -> int X.startTimer(interval, timerType) -> int (shared captured text)
statusTip attribute str This property holds the widget's status tip (shared captured text)
style function (self) -> Any X.style() -> PythonQt.QtGui.QStyle (shared captured text)
styleSheet attribute str This property holds the widget's style sheet (shared captured text)
tabletEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented in a subclass to receive tablet events for the widget. (shared captured text)
tabletTracking attribute Any This property holds whether tablet tracking is enabled for the widget (shared captured text)
testAttribute function (self, arg__1: Any) -> bool X.testAttribute(arg__1) -> bool (shared captured text)
thread function (self) -> Any (shared captured text)
timerEvent function (self, event: Any) -> Any (shared captured text)
toolTip attribute str This property holds the widget's tooltip (shared captured text)
toolTipDuration attribute int This property holds the widget's tooltip duration (shared captured text)
tr function (self, text: Any, ambig: Any, n: Any) -> str X.tr(text, ambig, n) -> str (shared captured text)
underMouse function (self) -> bool X.underMouse() -> bool (shared captured text)
ungrabGesture function (self, type: Any) -> None Unsubscribes the widget from a given gesture type (shared captured text)
unsetCursor function (self) -> None (shared captured text)
unsetLayoutDirection function (self) -> None (shared captured text)
unsetLocale function (self) -> None (shared captured text)
update function (self, x: Any, y: Any, w: Any, h: Any) -> None X.update(x, y, w, h) (shared captured text)
updateGeometry function (self) -> None Notifies the layout system that this widget has changed and may need to change geometry. (shared captured text)
updatesEnabled attribute bool This property holds whether updates are enabled (shared captured text)
visible attribute Any This property holds whether the widget is visible (shared captured text)
visibleRegion function (self) -> Any X.visibleRegion() -> PythonQt.QtGui.QRegion (shared captured text)
whatsThis attribute str This property holds the widget's What's This help text. (shared captured text)
wheelEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented in a subclass to receive wheel events for the widget. (shared captured text)
width attribute int This property holds the width of the widget excluding any window frame (shared captured text)
widthMM function (self) -> int X.widthMM() -> int (shared captured text)
winId function (self) -> int X.winId() -> int (shared captured text)
window function (self) -> Any X.window() -> PythonQt.QtGui.QWidget (shared captured text)
windowFilePath attribute str This property holds the file path associated with a widget (shared captured text)
windowFlags function (self) -> Any Window flags are a combination of a type (e.g. (shared captured text)
windowHandle function (self) -> Any X.windowHandle() -> PythonQt.QtGui.QWindow (shared captured text)
windowIcon attribute QIcon This property holds the widget's icon (shared captured text)
windowIconChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWidget.windowIconChanged; argument details are not documented.
windowIconText attribute str (shared captured text)
windowIconTextChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWidget.windowIconTextChanged; argument details are not documented.
windowModality attribute Any This property holds which windows are blocked by the modal widget (shared captured text)
windowModified attribute Any This property holds whether the document shown in the window has unsaved changes (shared captured text)
windowOpacity attribute float This property holds the level of opacity for the window. (shared captured text)
windowRole function (self) -> str X.windowRole() -> str (shared captured text)
windowState function (self) -> Any Returns the current window state. (shared captured text)
windowTitle attribute str This property holds the window title (caption) (shared captured text)
windowTitleChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWidget.windowTitleChanged; argument details are not documented.
windowType function (self) -> Any Returns the window type of this widget. (shared captured text)
x attribute int This property holds the x coordinate of the widget relative to its parent including any window frame (shared captured text)
y attribute int This property holds the y coordinate of the widget relative to its parent and including any window frame (shared captured text)