PythonQt.QtGui.QWidget · declarations 007
Back to PythonQt.QtGui.QWidget
update
update(x: Any, y: Any, w: Any, h: Any) -> None
X.update(x, y, w, h)
Supplemental documentation: Qt 5 reference:
[slot] void QWidget::update()
Updates the widget unless updates are disabled or the widget is hidden.
This function does not cause an immediate repaint; instead it schedules a paint event for processing when Qt returns to the main event loop. This permits Qt to optimize for more speed and less flicker than a call to repaint() does.
Calling update() several times normally results in just one paintEvent() call.
Qt normally erases the widget's area before the paintEvent() call. If the Qt::WA_OpaquePaintEvent widget attribute is set, the widget is responsible for painting all its pixels with an opaque color.
See also repaint(), paintEvent(), setUpdatesEnabled(), and Analog Clock Example.
void QWidget::update(int x, int y, int w, int h)
This is an overloaded function.
This version updates a rectangle (x, y, w, h) inside the widget.
void QWidget::update(const QRect \&rect)
This is an overloaded function.
This version updates a rectangle rect inside the widget.
void QWidget::update(const QRegion \&rgn)
This is an overloaded function.
This version repaints a region rgn inside the widget.
Upstream PySide2 reference signatures (binding differences may apply):
update(self) -> None
update(self, arg__1: PySide2.QtCore.QRect) -> None
update(self, arg__1: PySide2.QtGui.QRegion) -> None
update(self, x: int, y: int, w: int, h: int) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#update
updateGeometry
updateGeometry() -> None
X.updateGeometry()
Supplemental documentation: Qt 5 reference:
void QWidget::updateGeometry()
Notifies the layout system that this widget has changed and may need to change geometry.
Call this function if the sizeHint() or sizePolicy() have changed.
For explicitly hidden widgets, updateGeometry() is a no-op. The layout system will be notified as soon as the widget is shown.
Upstream PySide2 reference signatures (binding differences may apply):
updateGeometry(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#updateGeometry
updatesEnabled
instance-attribute
updatesEnabled: bool
Qt 5 reference:
updatesEnabled : bool
This property holds whether updates are enabled
An updates enabled widget receives paint events and has a system background; a disabled widget does not. This also implies that calling update() and repaint() has no effect if updates are disabled.
By default, this property is true.
setUpdatesEnabled() is normally used to disable updates for a short period of time, for instance to avoid screen flicker during large changes. In Qt, widgets normally do not generate screen flicker, but on X11 the server might erase regions on the screen when widgets get hidden before they can be replaced by other widgets. Disabling updates solves this.
Example:
setUpdatesEnabled(false);
bigVisualChanges();
setUpdatesEnabled(true);
Disabling a widget implicitly disables all its children. Enabling a widget enables all child widgets except top-level widgets or those that have been explicitly disabled. Re-enabling updates implicitly calls update() on the widget.
Access functions:
| bool | updatesEnabled() const |
|---|---|
| void | setUpdatesEnabled(bool enable) |
See also paintEvent().
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#updatesEnabled
visible
instance-attribute
visible: Any
Qt 5 reference:
visible : bool
This property holds whether the widget is visible
Calling setVisible(true) or show() sets the widget to visible status if all its parent widgets up to the window are visible. If an ancestor is not visible, the widget won't become visible until all its ancestors are shown. If its size or position has changed, Qt guarantees that a widget gets move and resize events just before it is shown. If the widget has not been resized yet, Qt will adjust the widget's size to a useful default using adjustSize().
Calling setVisible(false) or hide() hides a widget explicitly. An explicitly hidden widget will never become visible, even if all its ancestors become visible, unless you show it.
A widget receives show and hide events when its visibility status changes. Between a hide and a show event, there is no need to waste CPU cycles preparing or displaying information to the user. A video application, for example, might simply stop generating new frames.
A widget that happens to be obscured by other windows on the screen is considered to be visible. The same applies to iconified windows and windows that exist on another virtual desktop (on platforms that support this concept). A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again.
You almost never have to reimplement the setVisible() function. If you need to change some settings before a widget is shown, use showEvent() instead. If you need to do some delayed initialization use the Polish event delivered to the event() function.
Access functions:
| bool | isVisible() const |
|---|---|
| virtual void | setVisible(bool visible) |
See also show(), hide(), isHidden(), isVisibleTo(), isMinimized(), showEvent(), and hideEvent().
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#visible
visibleRegion
visibleRegion() -> Any
X.visibleRegion() -> PythonQt.QtGui.QRegion
Supplemental documentation: Qt 5 reference:
QRegion QWidget::visibleRegion() const
Returns the unobscured region where paint events can occur.
For visible widgets, this is an approximation of the area not covered by other widgets; otherwise, this is an empty region.
The repaint() function calls this function if necessary, so in general you do not need to call it.
Upstream PySide2 reference signatures (binding differences may apply):
visibleRegion(self) -> PySide2.QtGui.QRegion
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#visibleRegion
whatsThis
instance-attribute
whatsThis: str
Qt 5 reference:
whatsThis : QString
This property holds the widget's What's This help text.
By default, this property contains an empty string.
Access functions:
| QString | whatsThis() const |
|---|---|
| void | setWhatsThis(const QString \&) |
See also QWhatsThis, QWidget::toolTip, and QWidget::statusTip.
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#whatsThis
wheelEvent
wheelEvent(event: Any) -> None
X.wheelEvent(event)
Supplemental documentation: Qt 5 reference:
[virtual protected] void QWidget::wheelEvent(QWheelEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive wheel events for the widget.
If you reimplement this handler, it is very important that you ignore() the event if you do not handle it, so that the widget's parent can interpret it.
The default implementation ignores the event.
See also QEvent::ignore(), QEvent::accept(), event(), and QWheelEvent.
Upstream PySide2 reference signatures (binding differences may apply):
wheelEvent(self, event: PySide2.QtGui.QWheelEvent) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#wheelEvent
width
instance-attribute
width: int
Qt 5 reference:
width : const int
This property holds the width of the widget excluding any window frame
See the Window Geometry documentation for an overview of geometry issues with windows.
Note: Do not use this function to find the width of a screen on a multiple screen desktop. Read this note for details.
By default, this property contains a value that depends on the user's platform and screen geometry.
Access functions:
| int | width() const |
|---|---|
See also geometry, height, and size.
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#width
winId
winId() -> int
X.winId() -> int
Supplemental documentation: Qt 5 reference:
WId QWidget::winId() const
Returns the window system identifier of the widget.
Portable in principle, but if you use it you are probably about to do something non-portable. Be careful.
If a widget is non-native (alien) and winId() is invoked on it, that widget will be provided a native handle.
This value may change at run-time. An event with type QEvent::WinIdChange will be sent to the widget following a change in window system identifier.
See also find().
Upstream PySide2 reference signatures (binding differences may apply):
winId(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#winId
window
window() -> Any
X.window() -> PythonQt.QtGui.QWidget
Supplemental documentation: Qt 5 reference:
QWidget *QWidget::window() const
Returns the window for this widget, i.e. the next ancestor widget that has (or could have) a window-system frame.
If the widget is a window, the widget itself is returned.
Typical usage is changing the window title:
aWidget->window()->setWindowTitle("New Window Title");
See also isWindow().
Upstream PySide2 reference signatures (binding differences may apply):
window(self) -> PySide2.QtWidgets.QWidget
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#window
windowFilePath
instance-attribute
windowFilePath: str
Qt 5 reference:
windowFilePath : QString
This property holds the file path associated with a widget
This property only makes sense for windows. It associates a file path with a window. If you set the file path, but have not set the window title, Qt sets the window title to the file name of the specified path, obtained using QFileInfo::fileName().
If the window title is set at any point, then the window title takes precedence and will be shown instead of the file path string.
Additionally, on macOS, this has an added benefit that it sets the proxy icon for the window, assuming that the file path exists.
If no file path is set, this property contains an empty string.
By default, this property contains an empty string.
This property was introduced in Qt 4.4.
Access functions:
| QString | windowFilePath() const |
|---|---|
| void | setWindowFilePath(const QString \&filePath) |
See also windowTitle and windowIcon.
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#windowFilePath
windowFlags
windowFlags() -> Any
X.windowFlags()
Supplemental documentation: Qt 5 reference:
windowFlags : Qt::WindowFlags
Window flags are a combination of a type (e.g. Qt::Dialog) and zero or more hints to the window system (e.g. Qt::FramelessWindowHint).
If the widget had type Qt::Widget or Qt::SubWindow and becomes a window (Qt::Window, Qt::Dialog, etc.), it is put at position (0, 0) on the desktop. If the widget is a window and becomes a Qt::Widget or Qt::SubWindow, it is put at position (0, 0) relative to its parent widget.
Note: This function calls setParent() when changing the flags for a window, causing the widget to be hidden. You must call show() to make the widget visible again..
Access functions:
| Qt::WindowFlags | windowFlags() const |
|---|---|
| void | setWindowFlags(Qt::WindowFlags type) |
See also windowType(), setWindowFlag(), and Window Flags Example.
Upstream PySide2 reference signatures (binding differences may apply):
windowFlags(self) -> PySide2.QtCore.Qt.WindowFlags
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#windowFlags
windowHandle
windowHandle() -> Any
X.windowHandle() -> PythonQt.QtGui.QWindow
Supplemental documentation: Qt 5 reference:
QWindow *QWidget::windowHandle() const
If this is a native widget, return the associated QWindow. Otherwise return null.
Native widgets include toplevel widgets, QGLWidget, and child widgets on which winId() was called.
This function was introduced in Qt 5.0.
See also winId() and screen().
Upstream PySide2 reference signatures (binding differences may apply):
windowHandle(self) -> PySide2.QtGui.QWindow
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#windowHandle
windowIcon
instance-attribute
windowIcon: QIcon
Qt 5 reference:
windowIcon : QIcon
This property holds the widget's icon
This property only makes sense for windows. If no icon has been set, windowIcon() returns the application icon (QApplication::windowIcon()).
Note: On macOS, window icons represent the active document, and will not be displayed unless a file path has also been set using setWindowFilePath.
Access functions:
| QIcon | windowIcon() const |
|---|---|
| void | setWindowIcon(const QIcon \&icon) |
Notifier signal:
| void | windowIconChanged(const QIcon \&icon) |
|---|---|
See also windowTitle and setWindowFilePath.
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#windowIcon
windowIconChanged
windowIconChanged(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtGui.QWidget.windowIconChanged; argument details are not documented.
Supplemental documentation: Qt 5 reference:
[signal] void QWidget::windowIconChanged(const QIcon \&icon)
This signal is emitted when the window's icon has changed, with the new icon as an argument.
Note: Notifier signal for property windowIcon.
This function was introduced in Qt 5.2.
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#windowIconChanged
windowIconText
instance-attribute
windowIconText: str
windowIconTextChanged
windowIconTextChanged(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtGui.QWidget.windowIconTextChanged; argument details are not documented.
windowModality
instance-attribute
windowModality: Any
Qt 5 reference:
windowModality : Qt::WindowModality
This property holds which windows are blocked by the modal widget
This property only makes sense for windows. A modal widget prevents widgets in other windows from getting input. The value of this property controls which windows are blocked when the widget is visible. Changing this property while the window is visible has no effect; you must hide() the widget first, then show() it again.
By default, this property is Qt::NonModal.
This property was introduced in Qt 4.1.
Access functions:
| Qt::WindowModality | windowModality() const |
|---|---|
| void | setWindowModality(Qt::WindowModality windowModality) |
See also isWindow(), QWidget::modal, and QDialog.
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#windowModality
windowModified
instance-attribute
windowModified: Any
Qt 5 reference:
windowModified : bool
This property holds whether the document shown in the window has unsaved changes
A modified window is a window whose content has changed but has not been saved to disk. This flag will have different effects varied by the platform. On macOS the close button will have a modified look; on other platforms, the window title will have an '*' (asterisk).
The window title must contain a "[*]" placeholder, which indicates where the '*' should appear. Normally, it should appear right after the file name (e.g., "document1.txt[*] - Text Editor"). If the window isn't modified, the placeholder is simply removed.
Note that if a widget is set as modified, all its ancestors will also be set as
modified. However, if you call setWindowModified(false) on a widget, this will not
propagate to its parent because other children of the parent might have been modified.
Access functions:
| bool | isWindowModified() const |
|---|---|
| void | setWindowModified(bool) |
See also windowTitle, Application Example, SDI Example, and MDI Example.
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#windowModified
windowOpacity
instance-attribute
windowOpacity: float
Qt 5 reference:
windowOpacity : double
This property holds the level of opacity for the window.
The valid range of opacity is from 1.0 (completely opaque) to 0.0 (completely transparent).
By default the value of this property is 1.0.
This feature is available on Embedded Linux, macOS, Windows, and X11 platforms that support the Composite extension.
Note: On X11 you need to have a composite manager running, and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be supported by the window manager you are using.
Warning: Changing this property from opaque to transparent might issue a paint event that needs to be processed before the window is displayed correctly. This affects mainly the use of QScreen::grabWindow(). Also note that semi-transparent windows update and resize significantly slower than opaque windows.
Access functions:
| qreal | windowOpacity() const |
|---|---|
| void | setWindowOpacity(qreal level) |
See also setMask().
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#windowOpacity
windowRole
windowRole() -> str
X.windowRole() -> str
Supplemental documentation: Qt 5 reference:
QString QWidget::windowRole() const
Returns the window's role, or an empty string.
See also setWindowRole(), windowIcon, and windowTitle.
Upstream PySide2 reference signatures (binding differences may apply):
windowRole(self) -> str
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#windowRole
windowState
windowState() -> Any
X.windowState()
Supplemental documentation: Qt 5 reference:
Qt::WindowStates QWidget::windowState() const
Returns the current window state. The window state is a OR'ed combination of Qt::WindowState: Qt::WindowMinimized, Qt::WindowMaximized, Qt::WindowFullScreen, and Qt::WindowActive.
See also Qt::WindowState and setWindowState().
Upstream PySide2 reference signatures (binding differences may apply):
windowState(self) -> PySide2.QtCore.Qt.WindowStates
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#windowState
windowTitle
instance-attribute
windowTitle: str
Qt 5 reference:
windowTitle : QString
This property holds the window title (caption)
This property only makes sense for top-level widgets, such as windows and dialogs. If no caption has been set, the title is based of the windowFilePath. If neither of these is set, then the title is an empty string.
If you use the
windowModified
mechanism, the window title must contain a "[*]" placeholder, which indicates where
the '*' should appear. Normally, it should appear right after the file name (e.g.,
"document1.txt[*] - Text Editor"). If the
windowModified
property is false (the default), the placeholder is simply removed.
On some desktop platforms (including Windows and Unix), the application name (from QGuiApplication::applicationDisplayName) is added at the end of the window title, if set. This is done by the QPA plugin, so it is shown to the user, but isn't part of the windowTitle string.
Access functions:
| QString | windowTitle() const |
|---|---|
| void | setWindowTitle(const QString \&) |
Notifier signal:
| void | windowTitleChanged(const QString \&title) |
|---|---|
See also windowIcon, windowModified, and windowFilePath.
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#windowTitle
windowTitleChanged
windowTitleChanged(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtGui.QWidget.windowTitleChanged; argument details are not documented.
Supplemental documentation: Qt 5 reference:
[signal] void QWidget::windowTitleChanged(const QString \&title)
This signal is emitted when the window's title has changed, with the new title as an argument.
Note: Notifier signal for property windowTitle.
This function was introduced in Qt 5.2.
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#windowTitleChanged
windowType
windowType() -> Any
X.windowType()
Supplemental documentation: Qt 5 reference:
Qt::WindowType QWidget::windowType() const
Returns the window type of this widget. This is identical to windowFlags() \& Qt::WindowType_Mask.
See also windowFlags.
Upstream PySide2 reference signatures (binding differences may apply):
windowType(self) -> PySide2.QtCore.Qt.WindowType
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#windowType
x
instance-attribute
x: int
Qt 5 reference:
x : const int
This property holds the x coordinate of the widget relative to its parent including any window frame
See the Window Geometry documentation for an overview of geometry issues with windows.
By default, this property has a value of 0.
Access functions:
| int | x() const |
|---|---|
See also frameGeometry, y, and pos.
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#x
y
instance-attribute
y: int
Qt 5 reference:
y : const int
This property holds the y coordinate of the widget relative to its parent and including any window frame
See the Window Geometry documentation for an overview of geometry issues with windows.
By default, this property has a value of 0.
Access functions:
| int | y() const |
|---|---|
See also frameGeometry, x, and pos.
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#y