PythonQt.QtGui.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:
QWidget *parent = nullptris the parent of the new widget. If it isnullptr(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).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.

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
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:
- Use the
QT_USE_NATIVE_WINDOWS=1in your environment. - Set the Qt::AA_NativeWindows attribute on your application. All widgets will be native widgets.
- 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).
- Call QWidget::winId to enforce a native window (this implies 3).
- 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 |
accessibleDescription |
attribute | str |
This property holds the widget's description as seen by assistive technologies |
accessibleName |
attribute | str |
This property holds the widget's name as seen by assistive technologies |
actionEvent |
function | (self, event: Any) -> None |
This event handler is called with the given event whenever the widget's actions are changed. |
actions |
function | (self) -> tuple |
X.actions() -> tuple |
activateWindow |
function | (self) -> None |
Sets the top-level widget containing this widget to be the active window. |
addAction |
function | (self, action: Any) -> None |
Appends the action action to this widget's list of actions. |
addActions |
function | (self, actions: Any) -> None |
Appends the actions actions to this widget's list of actions. |
adjustSize |
function | (self) -> None |
Adjusts the size of the widget to fit its contents. |
autoFillBackground |
attribute | bool |
This property holds whether the widget background is filled automatically |
backgroundRole |
function | (self) -> Any |
Returns the background role of the widget. |
backingStore |
function | (self) -> Any |
X.backingStore() -> PythonQt.QtGui.QBackingStore |
baseSize |
attribute | QSize |
This property holds the base size of the widget |
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. |
childAt |
function | (self, x: Any, y: Any) -> Any |
X.childAt(x, y) -> PythonQt.QtGui.QWidget |
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 |
childrenRegion |
attribute | QRegion |
This property holds the combined region occupied by the widget's children |
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. |
clearMask |
function | (self) -> None |
Removes any mask set by [setMask](https://doc.qt.io/archives/qt-5.15/qwidget.html#setMask)(). |
close |
function | (self) -> bool |
X.close() -> bool |
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. |
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 |
contentsRect |
function | (self) -> Any |
X.contentsRect() -> PythonQt.QtCore.QRect |
contextMenuEvent |
function | (self, event: Any) -> None |
This event handler, for event event, can be reimplemented in a subclass to receive widget context menu events. |
contextMenuPolicy |
attribute | Any |
How the widget shows a context menu |
createWinId |
function | (self) -> None |
|
createWindowContainer |
function | (self, window: Any, parent: Any, arg2: flags) -> Any |
X.createWindowContainer(window, parent, flags) -> PythonQt.QtGui.QWidget |
cursor |
attribute | QCursor |
This property holds the cursor shape for this widget |
customContextMenuRequested |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtGui.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) |
destroyed |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtGui.QWidget.destroyed; argument details are not documented. |
devType |
function | (self) -> int |
X.devType() -> int |
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. |
dragLeaveEvent |
function | (self, event: Any) -> None |
This event handler is called when a drag is in progress and the mouse leaves this widget. |
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… |
dropEvent |
function | (self, event: Any) -> None |
This event handler is called when the drag is dropped on this widget. |
dumpObjectInfo |
function | (self) -> Any |
(shared captured text) |
dumpObjectTree |
function | (self) -> Any |
(shared captured text) |
dynamicPropertyNames |
function | (self) -> Any |
(shared captured text) |
echopy_object_name |
function | (self) -> str |
Read the objectName after explicit install_extensions(). |
effectiveWinId |
function | (self) -> int |
X.effectiveWinId() -> int |
enabled |
attribute | Any |
This property holds whether the widget is enabled |
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). |
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. |
event |
function | (self, event: Any) -> bool |
X.event(event) -> bool |
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 |
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. |
focusNextChild |
function | (self) -> bool |
X.focusNextChild() -> bool |
focusNextPrevChild |
function | (self, next: bool) -> bool |
X.focusNextPrevChild(next) -> bool |
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. |
focusPolicy |
attribute | Any |
This property holds the way the widget accepts keyboard focus |
focusPreviousChild |
function | (self) -> bool |
X.focusPreviousChild() -> bool |
focusProxy |
function | (self) -> Any |
X.focusProxy() -> PythonQt.QtGui.QWidget |
focusWidget |
function | (self) -> Any |
X.focusWidget() -> PythonQt.QtGui.QWidget |
font |
attribute | QFont |
This property holds the font currently set for the widget |
fontInfo |
function | (self) -> Any |
X.fontInfo() -> PythonQt.QtGui.QFontInfo |
fontMetrics |
function | (self) -> Any |
X.fontMetrics() -> PythonQt.QtGui.QFontMetrics |
foregroundRole |
function | (self) -> Any |
Returns the foreground role. |
frameGeometry |
attribute | QRect |
Geometry of the widget relative to its parent including any window frame |
frameSize |
attribute | QSize |
This property holds the size of the widget including any window frame |
fullScreen |
attribute | Any |
This property holds whether the widget is shown in full screen mode |
geometry |
attribute | QRect |
This property holds the geometry of the widget relative to its parent and excluding the window frame |
grab |
function | (self, rectangle: Any) -> Any |
X.grab(rectangle) -> PythonQt.QtGui.QPixmap |
grabGesture |
function | (self, type: Any, arg1: flags) -> None |
X.grabGesture(type, flags) |
grabKeyboard |
function | (self) -> None |
Grabs the keyboard input. |
grabMouse |
function | (self, arg__1: Any) -> None |
Grabs the mouse input. |
grabShortcut |
function | (self, key: Any, context: Any) -> int |
X.grabShortcut(key, context) -> int |
graphicsEffect |
function | (self) -> Any |
X.graphicsEffect() -> PythonQt.QtGui.QGraphicsEffect |
graphicsProxyWidget |
function | (self) -> Any |
X.graphicsProxyWidget() -> PythonQt.QtGui.QGraphicsProxyWidget |
hasFocus |
function | (self) -> bool |
X.hasFocus() -> bool |
hasHeightForWidth |
function | (self) -> bool |
X.hasHeightForWidth() -> bool |
hasMouseTracking |
function | (self) -> bool |
X.hasMouseTracking() -> bool |
height |
attribute | int |
This property holds the height of the widget excluding any window frame |
heightForWidth |
function | (self, arg__1: int) -> int |
X.heightForWidth(arg__1) -> int |
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. |
hideEvent |
function | (self, event: Any) -> None |
This event handler can be reimplemented in a subclass to receive widget hide events. |
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. |
inputMethodEvent |
function | (self, arg__1: Any) -> None |
This event handler, for event event, can be reimplemented in a subclass to receive. |
inputMethodHints |
attribute | Any |
What input method specific hints the widget has. |
inputMethodQuery |
function | (self, arg__1: Any) -> Any |
X.inputMethodQuery(arg__1) -> object |
insertAction |
function | (self, before: Any, action: Any) -> None |
X.insertAction(before, action) |
insertActions |
function | (self, before: Any, actions: Any) -> None |
X.insertActions(before, actions) |
installEventFilter |
function | (self, filterObj: Any) -> Any |
(shared captured text) |
isActiveWindow |
attribute | bool |
This property holds whether this widget's window is the active window |
isAncestorOf |
function | (self, child: Any) -> bool |
X.isAncestorOf(child) -> bool |
isEnabled |
function | (self) -> bool |
X.isEnabled() -> bool |
isEnabledTo |
function | (self, arg__1: Any) -> bool |
X.isEnabledTo(arg__1) -> bool |
isFullScreen |
function | (self) -> bool |
X.isFullScreen() -> bool |
isHidden |
function | (self) -> bool |
X.isHidden() -> bool |
isLeftToRight |
function | (self) -> bool |
X.isLeftToRight() -> bool |
isMaximized |
function | (self) -> bool |
X.isMaximized() -> bool |
isMinimized |
function | (self) -> bool |
X.isMinimized() -> bool |
isModal |
function | (self) -> bool |
X.isModal() -> bool |
isRightToLeft |
function | (self) -> bool |
X.isRightToLeft() -> bool |
isSignalConnected |
function | (self, signal: Any) -> bool |
X.isSignalConnected(signal) -> bool (shared captured text) |
isVisible |
function | (self) -> bool |
X.isVisible() -> bool |
isVisibleTo |
function | (self, arg__1: Any) -> bool |
X.isVisibleTo(arg__1) -> bool |
isWidgetType |
function | (self) -> bool |
X.isWidgetType() -> bool (shared captured text) |
isWindow |
function | (self) -> bool |
X.isWindow() -> bool |
isWindowModified |
function | (self) -> bool |
X.isWindowModified() -> bool |
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. |
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. |
keyboardGrabber |
function | (self) -> Any |
X.keyboardGrabber() -> PythonQt.QtGui.QWidget |
killTimer |
function | (self, id: Any) -> Any |
(shared captured text) |
layout |
function | (self) -> Any |
X.layout() -> PythonQt.QtGui.QLayout |
layoutDirection |
attribute | Any |
This property holds the layout direction for this widget. |
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. |
locale |
attribute | QLocale |
This property holds the widget's locale |
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. |
mapFrom |
function | (self, arg__1: Any, arg__2: Any) -> Any |
X.mapFrom(arg__1, arg__2) -> PythonQt.QtCore.QPoint |
mapFromGlobal |
function | (self, arg__1: Any) -> Any |
X.mapFromGlobal(arg__1) -> PythonQt.QtCore.QPoint |
mapFromParent |
function | (self, arg__1: Any) -> Any |
X.mapFromParent(arg__1) -> PythonQt.QtCore.QPoint |
mapTo |
function | (self, arg__1: Any, arg__2: Any) -> Any |
X.mapTo(arg__1, arg__2) -> PythonQt.QtCore.QPoint |
mapToGlobal |
function | (self, arg__1: Any) -> Any |
X.mapToGlobal(arg__1) -> PythonQt.QtCore.QPoint |
mapToParent |
function | (self, arg__1: Any) -> Any |
X.mapToParent(arg__1) -> PythonQt.QtCore.QPoint |
mask |
function | (self) -> Any |
X.mask() -> PythonQt.QtGui.QRegion |
maximized |
attribute | Any |
This property holds whether this widget is maximized |
maximumHeight |
attribute | int |
This property holds the widget's maximum height in pixels |
maximumSize |
attribute | QSize |
This property holds the widget's maximum size in pixels |
maximumWidth |
attribute | int |
This property holds the widget's maximum width in pixels |
metaObject |
function | (self) -> Any |
X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text) |
metric |
function | (self, arg__1: Any) -> int |
X.metric(arg__1) -> int |
minimized |
attribute | Any |
This property holds whether this widget is minimized (iconified) |
minimumHeight |
attribute | int |
This property holds the widget's minimum height in pixels |
minimumSize |
attribute | QSize |
This property holds the widget's minimum size |
minimumSizeHint |
attribute | QSize |
This property holds the recommended minimum size for the widget |
minimumWidth |
attribute | int |
This property holds the widget's minimum width in pixels |
modal |
attribute | Any |
This property holds whether the widget is a modal widget |
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. |
mouseGrabber |
function | (self) -> Any |
X.mouseGrabber() -> PythonQt.QtGui.QWidget |
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. |
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. |
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. |
mouseTracking |
attribute | Any |
This property holds whether mouse tracking is enabled for the widget |
move |
function | (self, x: Any, y: Any) -> None |
X.move(x, y) |
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. |
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 |
nativeParentWidget |
function | (self) -> Any |
X.nativeParentWidget() -> PythonQt.QtGui.QWidget |
nextInFocusChain |
function | (self) -> Any |
X.nextInFocusChain() -> PythonQt.QtGui.QWidget |
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 |
objectName |
attribute | Any |
(shared captured text) |
objectNameChanged |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtGui.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. |
overrideWindowState |
function | (self, state: Any) -> None |
|
paintEngine |
function | (self) -> Any |
X.paintEngine() -> PythonQt.QtGui.QPaintEngine |
paintEvent |
function | (self, event: Any) -> None |
This event handler can be reimplemented in a subclass to receive paint events passed in event. |
paintingActive |
function | (self) -> bool |
X.paintingActive() -> bool (shared captured text) |
palette |
attribute | QPalette |
This property holds the widget's palette |
parent |
function | (self) -> Any |
X.parent() -> PythonQt.private.QObject (shared captured text) |
parentWidget |
function | (self) -> Any |
X.parentWidget() -> PythonQt.QtGui.QWidget |
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 |
previousInFocusChain |
function | (self) -> Any |
X.previousInFocusChain() -> PythonQt.QtGui.QWidget |
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. |
rect |
attribute | QRect |
This property holds the internal geometry of the widget excluding any window frame |
redirected |
function | (self, offset: Any) -> Any |
X.redirected(offset) -> PythonQt.QtGui.QPaintDevice |
releaseKeyboard |
function | (self) -> None |
Releases the keyboard grab. |
releaseMouse |
function | (self) -> None |
Releases the mouse grab. |
releaseShortcut |
function | (self, id: int) -> None |
Removes the shortcut with the given id from Qt's shortcut system. |
removeAction |
function | (self, action: Any) -> None |
Removes the action action from this widget's list of actions. |
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) |
repaint |
function | (self, x: Any, y: Any, w: Any, h: Any) -> None |
X.repaint(x, y, w, h) |
resize |
function | (self, w: Any, h: Any) -> None |
X.resize(w, h) |
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. |
restoreGeometry |
function | (self, geometry: Any) -> bool |
X.restoreGeometry(geometry) -> bool |
saveGeometry |
function | (self) -> Any |
X.saveGeometry() -> PythonQt.QtCore.QByteArray |
scroll |
function | (self, dx: int, dy: int, arg__3: Any) -> None |
X.scroll(dx, dy, arg__3) |
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 |
|
setAccessibleDescription |
function | (self, description: str) -> None |
|
setAccessibleName |
function | (self, name: str) -> None |
|
setAttribute |
function | (self, arg__1: Any, on: bool) -> None |
X.setAttribute(arg__1, on) |
setAutoFillBackground |
function | (self, enabled: bool) -> None |
|
setBackgroundRole |
function | (self, arg__1: Any) -> None |
Sets the background role of the widget to role. |
setBaseSize |
function | (self, basew: Any, baseh: Any) -> None |
X.setBaseSize(basew, baseh) |
setContentsMargins |
function | (self, left: Any, top: Any, right: Any, bottom: Any) -> None |
X.setContentsMargins(left, top, right, bottom) |
setContextMenuPolicy |
function | (self, policy: Any) -> None |
|
setCursor |
function | (self, arg__1: Any) -> None |
|
setDisabled |
function | (self, a: Any) -> None |
Disables widget input events if disable is true; otherwise enables input events. |
setEnabled |
function | (self, a: Any) -> None |
|
setFixedHeight |
function | (self, h: int) -> None |
Sets both the minimum and maximum heights of the widget to h without changing the widths. |
setFixedSize |
function | (self, w: Any, h: Any) -> None |
X.setFixedSize(w, h) |
setFixedWidth |
function | (self, w: int) -> None |
Sets both the minimum and maximum width of the widget to w without changing the heights. |
setFocus |
function | (self, reason: Any) -> None |
This is an overloaded function. |
setFocusPolicy |
function | (self, policy: Any) -> None |
|
setFocusProxy |
function | (self, arg__1: Any) -> None |
Sets the widget's focus proxy to widget w. |
setFont |
function | (self, arg__1: Any) -> None |
|
setForegroundRole |
function | (self, arg__1: Any) -> None |
Sets the foreground role of the widget to role. |
setGeometry |
function | (self, x: Any, y: Any, w: Any, h: Any) -> None |
X.setGeometry(x, y, w, h) |
setGraphicsEffect |
function | (self, effect: Any) -> None |
The setGraphicsEffect function is for setting the widget's graphics effect. |
setHidden |
function | (self, hidden: bool) -> None |
Convenience function, equivalent to [setVisible](https://doc.qt.io/archives/qt-5.15/qwidget.html#visible-prop)(!hidden). |
setInputMethodHints |
function | (self, hints: Any) -> None |
|
setLayout |
function | (self, arg__1: Any) -> None |
Sets the layout manager for this widget to layout. |
setLayoutDirection |
function | (self, direction: Any) -> None |
|
setLocale |
function | (self, locale: Any) -> None |
|
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. |
setMaximumHeight |
function | (self, maxh: int) -> None |
|
setMaximumSize |
function | (self, maxw: Any, maxh: Any) -> None |
X.setMaximumSize(maxw, maxh) |
setMaximumWidth |
function | (self, maxw: int) -> None |
|
setMinimumHeight |
function | (self, minh: int) -> None |
|
setMinimumSize |
function | (self, minw: Any, minh: Any) -> None |
X.setMinimumSize(minw, minh) |
setMinimumWidth |
function | (self, minw: int) -> None |
|
setMouseTracking |
function | (self, enable: bool) -> None |
|
setObjectName |
function | (self, name: Any) -> Any |
(shared captured text) |
setPalette |
function | (self, arg__1: Any) -> None |
|
setParent |
function | (self, parent: Any, f: Any) -> None |
X.setParent(parent, f) |
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) |
setShortcutEnabled |
function | (self, id: int, enable: bool) -> None |
X.setShortcutEnabled(id, enable) |
setSizeIncrement |
function | (self, w: Any, h: Any) -> None |
X.setSizeIncrement(w, h) |
setSizePolicy |
function | (self, horizontal: Any, vertical: Any) -> None |
X.setSizePolicy(horizontal, vertical) |
setStatusTip |
function | (self, arg__1: str) -> None |
|
setStyle |
function | (self, arg__1: Any) -> None |
Sets the widget's GUI style to style. |
setStyleSheet |
function | (self, styleSheet: str) -> None |
|
setTabOrder |
function | (self, arg__1: Any, arg__2: Any) -> None |
X.setTabOrder(arg__1, arg__2) |
setToolTip |
function | (self, arg__1: str) -> None |
|
setToolTipDuration |
function | (self, msec: int) -> None |
|
setUpdatesEnabled |
function | (self, enable: bool) -> None |
|
setVisible |
function | (self, visible: bool) -> None |
|
setWhatsThis |
function | (self, arg__1: str) -> None |
|
setWindowFilePath |
function | (self, filePath: str) -> None |
|
setWindowFlags |
function | (self, type: Any) -> None |
|
setWindowIcon |
function | (self, icon: Any) -> None |
|
setWindowIconText |
function | (self, arg__1: str) -> None |
|
setWindowModality |
function | (self, windowModality: Any) -> None |
|
setWindowModified |
function | (self, a: Any) -> None |
|
setWindowOpacity |
function | (self, level: float) -> None |
|
setWindowRole |
function | (self, arg__1: str) -> None |
Sets the window's role to role. |
setWindowState |
function | (self, state: Any) -> None |
Sets the window state to windowState. |
setWindowTitle |
function | (self, a: Any) -> None |
|
sharedPainter |
function | (self) -> Any |
X.sharedPainter() -> PythonQt.QtGui.QPainter |
show |
function | (self) -> None |
Shows the widget and its child widgets. |
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. |
showFullScreen |
function | (self) -> None |
Shows the widget in full-screen mode. |
showMaximized |
function | (self) -> None |
Shows the widget maximized. |
showMinimized |
function | (self) -> None |
Shows the widget minimized, as an icon. |
showNormal |
function | (self) -> None |
Restores the widget after it has been maximized or minimized. |
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 |
sizeHint |
attribute | QSize |
This property holds the recommended size for the widget |
sizeIncrement |
attribute | QSize |
This property holds the size increment of the widget |
sizePolicy |
attribute | QSizePolicy |
This property holds the default layout behavior of the widget |
stackUnder |
function | (self, arg__1: Any) -> None |
Places the widget under w in the parent widget's stack. |
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 |
style |
function | (self) -> Any |
X.style() -> PythonQt.QtGui.QStyle |
styleSheet |
attribute | str |
This property holds the widget's style sheet |
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. |
tabletTracking |
attribute | Any |
This property holds whether tablet tracking is enabled for the widget |
testAttribute |
function | (self, arg__1: Any) -> bool |
X.testAttribute(arg__1) -> bool |
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 |
toolTipDuration |
attribute | int |
This property holds the widget's tooltip duration |
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 |
ungrabGesture |
function | (self, type: Any) -> None |
Unsubscribes the widget from a given gesture type |
unsetCursor |
function | (self) -> None |
|
unsetLayoutDirection |
function | (self) -> None |
|
unsetLocale |
function | (self) -> None |
|
update |
function | (self, x: Any, y: Any, w: Any, h: Any) -> None |
X.update(x, y, w, h) |
updateGeometry |
function | (self) -> None |
Notifies the layout system that this widget has changed and may need to change geometry. |
updatesEnabled |
attribute | bool |
This property holds whether updates are enabled |
visible |
attribute | Any |
This property holds whether the widget is visible |
visibleRegion |
function | (self) -> Any |
X.visibleRegion() -> PythonQt.QtGui.QRegion |
whatsThis |
attribute | str |
This property holds the widget's What's This help 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. |
width |
attribute | int |
This property holds the width of the widget excluding any window frame |
widthMM |
function | (self) -> int |
X.widthMM() -> int (shared captured text) |
winId |
function | (self) -> int |
X.winId() -> int |
window |
function | (self) -> Any |
X.window() -> PythonQt.QtGui.QWidget |
windowFilePath |
attribute | str |
This property holds the file path associated with a widget |
windowFlags |
function | (self) -> Any |
Window flags are a combination of a type (e.g. |
windowHandle |
function | (self) -> Any |
X.windowHandle() -> PythonQt.QtGui.QWindow |
windowIcon |
attribute | QIcon |
This property holds the widget's icon |
windowIconChanged |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtGui.QWidget.windowIconChanged; argument details are not documented. |
windowIconText |
attribute | str |
|
windowIconTextChanged |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtGui.QWidget.windowIconTextChanged; argument details are not documented. |
windowModality |
attribute | Any |
This property holds which windows are blocked by the modal widget |
windowModified |
attribute | Any |
This property holds whether the document shown in the window has unsaved changes |
windowOpacity |
attribute | float |
This property holds the level of opacity for the window. |
windowRole |
function | (self) -> str |
X.windowRole() -> str |
windowState |
function | (self) -> Any |
Returns the current window state. |
windowTitle |
attribute | str |
This property holds the window title (caption) |
windowTitleChanged |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtGui.QWidget.windowTitleChanged; argument details are not documented. |
windowType |
function | (self) -> Any |
Returns the window type of this widget. |
x |
attribute | int |
This property holds the x coordinate of the widget relative to its parent including any window frame |
y |
attribute | int |
This property holds the y coordinate of the widget relative to its parent and including any window frame |