PythonQt.QtGui.QWidget · declarations 004
Back to PythonQt.QtGui.QWidget
mouseDoubleClickEvent
mouseDoubleClickEvent(event: Any) -> None
X.mouseDoubleClickEvent(event)
Supplemental documentation: Qt 5 reference:
[virtual protected] void QWidget::mouseDoubleClickEvent(QMouseEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive mouse double click events for the widget.
The default implementation calls mousePressEvent().
Note: The widget will also receive mouse press and mouse release events in addition to the double click event. And if another widget that overlaps this widget disappears in response to press or release events, then this widget will only receive the double click event. It is up to the developer to ensure that the application interprets these events correctly.
See also mousePressEvent(), mouseReleaseEvent(), mouseMoveEvent(), event(), and QMouseEvent.
Upstream PySide2 reference signatures (binding differences may apply):
mouseDoubleClickEvent(self, event: PySide2.QtGui.QMouseEvent) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#mouseDoubleClickEvent
mouseGrabber
mouseGrabber() -> Any
X.mouseGrabber() -> PythonQt.QtGui.QWidget
Supplemental documentation: Qt 5 reference:
[static] QWidget *QWidget::mouseGrabber()
Returns the widget that is currently grabbing the mouse input.
If no widget in this application is currently grabbing the mouse, nullptr is returned.
See also grabMouse() and keyboardGrabber().
Upstream PySide2 reference signatures (binding differences may apply):
mouseGrabber() -> PySide2.QtWidgets.QWidget
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#mouseGrabber
mouseMoveEvent
mouseMoveEvent(event: Any) -> None
X.mouseMoveEvent(event)
Supplemental documentation: Qt 5 reference:
[virtual protected] void QWidget::mouseMoveEvent(QMouseEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events for the widget.
If mouse tracking is switched off, mouse move events only occur if a mouse button is pressed while the mouse is being moved. If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.
QMouseEvent::pos() reports the position of the mouse cursor, relative to this widget. For press and release events, the position is usually the same as the position of the last mouse move event, but it might be different if the user's hand shakes. This is a feature of the underlying window system, not Qt.
If you want to show a tooltip immediately, while the mouse is moving (e.g., to get the mouse coordinates with QMouseEvent::pos() and show them as a tooltip), you must first enable mouse tracking as described above. Then, to ensure that the tooltip is updated immediately, you must call QToolTip::showText() instead of setToolTip() in your implementation of mouseMoveEvent().
See also setMouseTracking(), mousePressEvent(), mouseReleaseEvent(), mouseDoubleClickEvent(), event(), QMouseEvent, and Scribble Example.
Upstream PySide2 reference signatures (binding differences may apply):
mouseMoveEvent(self, event: PySide2.QtGui.QMouseEvent) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#mouseMoveEvent
mousePressEvent
mousePressEvent(event: Any) -> None
X.mousePressEvent(event)
Supplemental documentation: Qt 5 reference:
[virtual protected] void QWidget::mousePressEvent(QMouseEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events for the widget.
If you create new widgets in the mousePressEvent() the mouseReleaseEvent() may not end up where you expect, depending on the underlying window system (or X11 window manager), the widgets' location and maybe more.
The default implementation implements the closing of popup widgets when you click outside the window. For other widget types it does nothing.
See also mouseReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), event(), QMouseEvent, and Scribble Example.
Upstream PySide2 reference signatures (binding differences may apply):
mousePressEvent(self, event: PySide2.QtGui.QMouseEvent) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#mousePressEvent
mouseReleaseEvent
mouseReleaseEvent(event: Any) -> None
X.mouseReleaseEvent(event)
Supplemental documentation: Qt 5 reference:
[virtual protected] void QWidget::mouseReleaseEvent(QMouseEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive mouse release events for the widget.
See also mousePressEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), event(), QMouseEvent, and Scribble Example.
Upstream PySide2 reference signatures (binding differences may apply):
mouseReleaseEvent(self, event: PySide2.QtGui.QMouseEvent) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#mouseReleaseEvent
mouseTracking
instance-attribute
mouseTracking: Any
Qt 5 reference:
mouseTracking : bool
This property holds whether mouse tracking is enabled for the widget
If mouse tracking is disabled (the default), the widget only receives mouse move events when at least one mouse button is pressed while the mouse is being moved.
If mouse tracking is enabled, the widget receives mouse move events even if no buttons are pressed.
Access functions:
| bool | hasMouseTracking() const |
|---|---|
| void | setMouseTracking(bool enable) |
See also mouseMoveEvent().
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#mouseTracking
move
move(x: Any, y: Any) -> None
X.move(x, y)
Supplemental documentation: Qt 5 reference:
void QWidget::move(int x, int y)
This is an overloaded function.
This corresponds to move(QPoint(x, y)).
Note: Setter function for property pos.
Upstream PySide2 reference signatures (binding differences may apply):
move(self, arg__1: PySide2.QtCore.QPoint) -> None
move(self, x: int, y: int) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#move
moveEvent
moveEvent(event: Any) -> None
X.moveEvent(event)
Supplemental documentation: Qt 5 reference:
[virtual protected] void QWidget::moveEvent(QMoveEvent *event)
This event handler can be reimplemented in a subclass to receive widget move events which are passed in the event parameter. When the widget receives this event, it is already at the new position.
The old position is accessible through QMoveEvent::oldPos().
See also resizeEvent(), event(), move(), and QMoveEvent.
Upstream PySide2 reference signatures (binding differences may apply):
moveEvent(self, event: PySide2.QtGui.QMoveEvent) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#moveEvent
nativeEvent
nativeEvent(eventType: Any, message: int, result: Any) -> bool
X.nativeEvent(eventType, message, result) -> bool
Supplemental documentation: Qt 5 reference:
[virtual protected] bool QWidget::nativeEvent(const QByteArray \&eventType, void *message, long *result)
This special event handler can be reimplemented in a subclass to receive native platform events identified by eventType which are passed in the message parameter.
In your reimplementation of this function, if you want to stop the event being handled by Qt, return true and set result. The result parameter has meaning only on Windows. If you return false, this native event is passed back to Qt, which translates the event into a Qt event and sends it to the widget.
Note: Events are only delivered to this event handler if the widget has a native window handle.
Note: This function superseedes the event filter functions x11Event(), winEvent() and macEvent() of Qt 4.
| Platform | Event Type Identifier | Message Type | Result Type |
|---|---|---|---|
| Windows | "windows_generic_MSG" | MSG * | LRESULT |
| macOS | "NSEvent" | NSEvent * | |
| XCB | "xcb_generic_event_t" | xcb_generic_event_t * |
See also QAbstractNativeEventFilter.
Upstream PySide2 reference signatures (binding differences may apply):
nativeEvent(self, eventType: PySide2.QtCore.QByteArray, message: int) -> typing.Tuple[bool, int]
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#nativeEvent
nativeParentWidget
nativeParentWidget() -> Any
X.nativeParentWidget() -> PythonQt.QtGui.QWidget
Supplemental documentation: Qt 5 reference:
QWidget *QWidget::nativeParentWidget() const
Returns the native parent for this widget, i.e. the next ancestor widget that has a
system identifier, or nullptr if it does not have any native parent.
This function was introduced in Qt 4.4.
See also effectiveWinId().
Upstream PySide2 reference signatures (binding differences may apply):
nativeParentWidget(self) -> PySide2.QtWidgets.QWidget
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#nativeParentWidget
nextInFocusChain
nextInFocusChain() -> Any
X.nextInFocusChain() -> PythonQt.QtGui.QWidget
Supplemental documentation: Qt 5 reference:
QWidget *QWidget::nextInFocusChain() const
Returns the next widget in this widget's focus chain.
See also previousInFocusChain().
Upstream PySide2 reference signatures (binding differences may apply):
nextInFocusChain(self) -> PySide2.QtWidgets.QWidget
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#nextInFocusChain
normalGeometry
instance-attribute
normalGeometry: QRect
Qt 5 reference:
normalGeometry : const 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
For child widgets this property always holds an empty rectangle.
By default, this property contains an empty rectangle.
Access functions:
| QRect | normalGeometry() const |
|---|---|
See also QWidget::windowState() and QWidget::geometry.
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#normalGeometry
objectNameChanged
objectNameChanged(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtGui.QWidget.objectNameChanged; argument details are not documented.
overrideWindowFlags
overrideWindowFlags(type: Any) -> None
X.overrideWindowFlags(type)
Supplemental documentation: Qt 5 reference:
void QWidget::overrideWindowFlags(Qt::WindowFlags flags)
Sets the window flags for the widget to flags, without telling the window system.
Warning: Do not call this function unless you really know what you're doing.
See also setWindowFlags().
Upstream PySide2 reference signatures (binding differences may apply):
overrideWindowFlags(self, type: PySide2.QtCore.Qt.WindowFlags) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#overrideWindowFlags
overrideWindowState
overrideWindowState(state: Any) -> None
X.overrideWindowState(state)
Upstream PySide2 reference signatures (binding differences may apply):
overrideWindowState(self, state: PySide2.QtCore.Qt.WindowStates) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#overrideWindowState
paintEngine
paintEngine() -> Any
X.paintEngine() -> PythonQt.QtGui.QPaintEngine
Supplemental documentation: Qt 5 reference:
[override virtual] QPaintEngine *QWidget::paintEngine() const
Reimplements: QPaintDevice::paintEngine() const.
Returns the widget's paint engine.
Note that this function should not be called explicitly by the user, since it's meant for reimplementation purposes only. The function is called by Qt internally, and the default implementation may not always return a valid pointer.
Upstream PySide2 reference signatures (binding differences may apply):
paintEngine(self) -> PySide2.QtGui.QPaintEngine
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#paintEngine
paintEvent
paintEvent(event: Any) -> None
X.paintEvent(event)
Supplemental documentation: Qt 5 reference:
[virtual protected] void QWidget::paintEvent(QPaintEvent *event)
This event handler can be reimplemented in a subclass to receive paint events passed in event.
A paint event is a request to repaint all or part of a widget. It can happen for one of the following reasons:
- repaint() or update() was invoked,
- the widget was obscured and has now been uncovered, or
- many other reasons.
Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QTableView do this, for example.
Qt also tries to speed up painting by merging multiple paint events into one. When update() is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::united()). The repaint() function does not permit this optimization, so we suggest using update() whenever possible.
When the paint event occurs, the update region has normally been erased, so you are painting on the widget's background.
The background can be set using setBackgroundRole() and setPalette().
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.
Note: Generally, you should refrain from calling update() or repaint() inside a paintEvent(). For example, calling update() or repaint() on children inside a paintEvent() results in undefined behavior; the child may or may not get a paint event.
Warning: If you are using a custom paint engine without Qt's backingstore, Qt::WA_PaintOnScreen must be set. Otherwise, QWidget::paintEngine() will never be called; the backingstore will be used instead.
See also event(), repaint(), update(), QPainter, QPixmap, QPaintEvent, and Analog Clock Example.
Upstream PySide2 reference signatures (binding differences may apply):
paintEvent(self, event: PySide2.QtGui.QPaintEvent) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#paintEvent
palette
instance-attribute
palette: QPalette
Qt 5 reference:
palette : QPalette
This property holds the widget's palette
This property describes the widget's palette. The palette is used by the widget's style when rendering standard components, and is available as a means to ensure that custom widgets can maintain consistency with the native platform's look and feel. It's common that different platforms, or different styles, have different palettes.
When you assign a new palette to a widget, the color roles from this palette are combined with the widget's default palette to form the widget's final palette. The palette entry for the widget's background role is used to fill the widget's background (see QWidget::autoFillBackground), and the foreground role initializes QPainter's pen.
The default depends on the system environment. QApplication maintains a system/theme palette which serves as a default for all widgets. There may also be special palette defaults for certain types of widgets (e.g., on Windows Vista, all classes that derive from QMenuBar have a special default palette). You can also define default palettes for widgets yourself by passing a custom palette and the name of a widget to QApplication::setPalette(). Finally, the style always has the option of polishing the palette as it's assigned (see QStyle::polish()).
QWidget propagates explicit palette roles from parent to child. If you assign a brush or color to a specific role on a palette and assign that palette to a widget, that role will propagate to all the widget's children, overriding any system defaults for that role. Note that palettes by default don't propagate to windows (see isWindow()) unless the Qt::WA_WindowPropagation attribute is enabled.
QWidget's palette propagation is similar to its font propagation.
The current style, which is used to render the content of all standard Qt widgets, is free to choose colors and brushes from the widget palette, or in some cases, to ignore the palette (partially, or completely). In particular, certain styles like GTK style, Mac style, and Windows Vista style, depend on third party APIs to render the content of widgets, and these styles typically do not follow the palette. Because of this, assigning roles to a widget's palette is not guaranteed to change the appearance of the widget. Instead, you may choose to apply a styleSheet.
Warning: Do not use this function in conjunction with Qt Style Sheets. When using style sheets, the palette of a widget can be customized using the "color", "background-color", "selection-color", "selection-background-color" and "alternate-background-color".
Access functions:
| const QPalette \& | palette() const |
|---|---|
| void | setPalette(const QPalette \&) |
See also QGuiApplication::palette(), QWidget::font(), and Qt Style Sheets.
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#palette
parentWidget
parentWidget() -> Any
X.parentWidget() -> PythonQt.QtGui.QWidget
Supplemental documentation: Qt 5 reference:
QWidget *QWidget::parentWidget() const
Returns the parent of this widget, or nullptr if it does not have any parent widget.
Upstream PySide2 reference signatures (binding differences may apply):
parentWidget(self) -> PySide2.QtWidgets.QWidget
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#parentWidget
pos
instance-attribute
pos: QPoint
Qt 5 reference:
pos : QPoint
This property holds the position of the widget within its parent widget
If the widget is a window, the position is that of the widget on the desktop, including its frame.
When changing the position, the widget, if visible, receives a move event (moveEvent()) immediately. If the widget is not currently visible, it is guaranteed to receive an event before it is shown.
By default, this property contains a position that refers to the origin.
Warning: Calling move() or setGeometry() inside moveEvent() can lead to infinite recursion.
See the Window Geometry documentation for an overview of geometry issues with windows.
Access functions:
| QPoint | pos() const |
|---|---|
| void | move(int x, int y) |
| void | move(const QPoint \&) |
See also frameGeometry, size, x(), and y().
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#pos
previousInFocusChain
previousInFocusChain() -> Any
X.previousInFocusChain() -> PythonQt.QtGui.QWidget
Supplemental documentation: Qt 5 reference:
QWidget *QWidget::previousInFocusChain() const
The previousInFocusChain function returns the previous widget in this widget's focus chain.
This function was introduced in Qt 4.6.
See also nextInFocusChain().
Upstream PySide2 reference signatures (binding differences may apply):
previousInFocusChain(self) -> PySide2.QtWidgets.QWidget
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#previousInFocusChain
raise_
raise_() -> Any
X.raise()
Native spelling: raise; access it through getattr on the native object.
Supplemental documentation: Qt 5 reference:
[slot] void QWidget::raise()
Raises this widget to the top of the parent widget's stack.
After this call the widget will be visually in front of any overlapping sibling widgets.
Note: When using activateWindow(), you can call this function to ensure that the window is stacked on top.
See also lower() and stackUnder().
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#raise
rect
instance-attribute
rect: QRect
Qt 5 reference:
rect : const QRect
This property holds the internal geometry of the widget excluding any window frame
The rect property equals QRect(0, 0, width(), height()).
See the Window Geometry documentation for an overview of geometry issues with windows.
By default, this property contains a value that depends on the user's platform and screen geometry.
Access functions:
| QRect | rect() const |
|---|---|
See also size.
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#rect
redirected
redirected(offset: Any) -> Any
X.redirected(offset) -> PythonQt.QtGui.QPaintDevice
Upstream PySide2 reference signatures (binding differences may apply):
redirected(self, offset: PySide2.QtCore.QPoint) -> PySide2.QtGui.QPaintDevice
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#redirected
releaseKeyboard
releaseKeyboard() -> None
X.releaseKeyboard()
Supplemental documentation: Qt 5 reference:
void QWidget::releaseKeyboard()
Releases the keyboard grab.
See also grabKeyboard(), grabMouse(), and releaseMouse().
Upstream PySide2 reference signatures (binding differences may apply):
releaseKeyboard(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#releaseKeyboard
releaseMouse
releaseMouse() -> None
X.releaseMouse()
Supplemental documentation: Qt 5 reference:
void QWidget::releaseMouse()
Releases the mouse grab.
See also grabMouse(), grabKeyboard(), and releaseKeyboard().
Upstream PySide2 reference signatures (binding differences may apply):
releaseMouse(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#releaseMouse
releaseShortcut
releaseShortcut(id: int) -> None
X.releaseShortcut(id)
Supplemental documentation: Qt 5 reference:
void QWidget::releaseShortcut(int id)
Removes the shortcut with the given id from Qt's shortcut system. The widget will no longer receive QEvent::Shortcut events for the shortcut's key sequence (unless it has other shortcuts with the same key sequence).
Warning: You should not normally need to use this function since Qt's shortcut system removes shortcuts automatically when their parent widget is destroyed. It is best to use QAction or QShortcut to handle shortcuts, since they are easier to use than this low-level function. Note also that this is an expensive operation.
See also grabShortcut() and setShortcutEnabled().
Upstream PySide2 reference signatures (binding differences may apply):
releaseShortcut(self, id: int) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#releaseShortcut
removeAction
removeAction(action: Any) -> None
X.removeAction(action)
Supplemental documentation: Qt 5 reference:
void QWidget::removeAction(QAction *action)
Removes the action action from this widget's list of actions.
See also insertAction(), actions(), and insertAction().
Upstream PySide2 reference signatures (binding differences may apply):
removeAction(self, action: PySide2.QtWidgets.QAction) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#removeAction
render
render(target: Any, targetOffset: Any, sourceRegion: Any, renderFlags: Any) -> None
X.render(target, targetOffset, sourceRegion, renderFlags)
Supplemental documentation: Qt 5 reference:
void QWidget::render(QPaintDevice *target, const QPoint \&targetOffset \= QPoint(), const QRegion \&sourceRegion \= QRegion(), QWidget::RenderFlags renderFlags \= RenderFlags(DrawWindowBackground | DrawChildren))
Renders the sourceRegion of this widget into the target using renderFlags to determine how to render. Rendering starts at targetOffset in the target. For example:
QPixmap pixmap(widget->size());
widget->render(&pixmap);
If sourceRegion is a null region, this function will use QWidget::rect() as the region, i.e. the entire widget.
Ensure that you call QPainter::end() for the target device's active painter (if any) before rendering. For example:
QPainter painter(this);
...
painter.end();
myWidget->render(this);
Note: To obtain the contents of a QOpenGLWidget, use QOpenGLWidget::grabFramebuffer() instead.
Note: To obtain the contents of a QGLWidget (deprecated), use QGLWidget::grabFrameBuffer() or QGLWidget::renderPixmap() instead.
This function was introduced in Qt 4.3.
void QWidget::render(QPainter *painter, const QPoint \&targetOffset \= QPoint(), const QRegion \&sourceRegion \= QRegion(), QWidget::RenderFlags renderFlags \= RenderFlags(DrawWindowBackground | DrawChildren))
This is an overloaded function.
Renders the widget into the painter's QPainter::device().
Transformations and settings applied to the painter will be used when rendering.
Note: The painter must be active. On macOS the widget will be rendered into a QPixmap and then drawn by the painter.
See also QPainter::device().
Upstream PySide2 reference signatures (binding differences may apply):
render(self, painter: PySide2.QtGui.QPainter, targetOffset: PySide2.QtCore.QPoint, sourceRegion: PySide2.QtGui.QRegion=..., renderFlags: PySide2.QtWidgets.QWidget.RenderFlags=...) -> None
render(self, target: PySide2.QtGui.QPaintDevice, targetOffset: PySide2.QtCore.QPoint=..., sourceRegion: PySide2.QtGui.QRegion=..., renderFlags: PySide2.QtWidgets.QWidget.RenderFlags=...) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#render
repaint
repaint(x: Any, y: Any, w: Any, h: Any) -> None
X.repaint(x, y, w, h)
Supplemental documentation: Qt 5 reference:
[slot] void QWidget::repaint()
Repaints the widget directly by calling paintEvent() immediately, unless updates are disabled or the widget is hidden.
We suggest only using repaint() if you need an immediate repaint, for example during animation. In almost all circumstances update() is better, as it permits Qt to optimize for speed and minimize flicker.
Warning: If you call repaint() in a function which may itself be called from paintEvent(), you may get infinite recursion. The update() function never causes recursion.
See also update(), paintEvent(), and setUpdatesEnabled().
void QWidget::repaint(int x, int y, int w, int h)
This is an overloaded function.
This version repaints a rectangle (x, y, w, h) inside the widget.
If w is negative, it is replaced with width() - x, and if h is negative, it is
replaced width height() - y.
void QWidget::repaint(const QRect \&rect)
This is an overloaded function.
This version repaints a rectangle rect inside the widget.
void QWidget::repaint(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):
repaint(self) -> None
repaint(self, arg__1: PySide2.QtCore.QRect) -> None
repaint(self, arg__1: PySide2.QtGui.QRegion) -> None
repaint(self, x: int, y: int, w: int, h: int) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#repaint
resize
resize(w: Any, h: Any) -> None
X.resize(w, h)
Supplemental documentation: Qt 5 reference:
void QWidget::resize(int w, int h)
This is an overloaded function.
This corresponds to resize(QSize(w, h)).
Note: Setter function for property size.
Upstream PySide2 reference signatures (binding differences may apply):
resize(self, arg__1: PySide2.QtCore.QSize) -> None
resize(self, w: int, h: int) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#resize
resizeEvent
resizeEvent(event: Any) -> None
X.resizeEvent(event)
Supplemental documentation: Qt 5 reference:
[virtual protected] void QWidget::resizeEvent(QResizeEvent *event)
This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the event parameter. When resizeEvent() is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize().
The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.
See also moveEvent(), event(), resize(), QResizeEvent, paintEvent(), and Scribble Example.
Upstream PySide2 reference signatures (binding differences may apply):
resizeEvent(self, event: PySide2.QtGui.QResizeEvent) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#resizeEvent
restoreGeometry
restoreGeometry(geometry: Any) -> bool
X.restoreGeometry(geometry) -> bool
Supplemental documentation: Qt 5 reference:
bool QWidget::restoreGeometry(const QByteArray \&geometry)
Restores the geometry and state of top-level widgets stored in the byte array
geometry. Returns true on success; otherwise returns false.
If the restored geometry is off-screen, it will be modified to be inside the available screen geometry.
To restore geometry saved using QSettings, you can use code like this:
QSettings settings("MyCompany", "MyApp");
myWidget->restoreGeometry(settings.value("myWidget/geometry").toByteArray());
See the Window Geometry documentation for an overview of geometry issues with windows.
Use QMainWindow::restoreState() to restore the geometry and the state of toolbars and dock widgets.
This function was introduced in Qt 4.2.
See also saveGeometry(), QSettings, QMainWindow::saveState(), and QMainWindow::restoreState().
Upstream PySide2 reference signatures (binding differences may apply):
restoreGeometry(self, geometry: PySide2.QtCore.QByteArray) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#restoreGeometry
saveGeometry
saveGeometry() -> Any
X.saveGeometry() -> PythonQt.QtCore.QByteArray
Supplemental documentation: Qt 5 reference:
QByteArray QWidget::saveGeometry() const
Saves the current geometry and state for top-level widgets.
To save the geometry when the window closes, you can implement a close event like this:
void MyWidget::closeEvent(QCloseEvent *event)
{
QSettings settings("MyCompany", "MyApp");
settings.setValue("geometry", saveGeometry());
QWidget::closeEvent(event);
}
See the Window Geometry documentation for an overview of geometry issues with windows.
Use QMainWindow::saveState() to save the geometry and the state of toolbars and dock widgets.
This function was introduced in Qt 4.2.
See also restoreGeometry(), QMainWindow::saveState(), and QMainWindow::restoreState().
Upstream PySide2 reference signatures (binding differences may apply):
saveGeometry(self) -> PySide2.QtCore.QByteArray
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#saveGeometry
scroll
scroll(dx: int, dy: int, arg__3: Any) -> None
X.scroll(dx, dy, arg__3)
Supplemental documentation: Qt 5 reference:
void QWidget::scroll(int dx, int dy)
Scrolls the widget including its children dx pixels to the right and dy downward. Both dx and dy may be negative.
After scrolling, the widgets will receive paint events for the areas that need to be repainted. For widgets that Qt knows to be opaque, this is only the newly exposed parts. For example, if an opaque widget is scrolled 8 pixels to the left, only an 8-pixel wide stripe at the right edge needs updating.
Since widgets propagate the contents of their parents by default, you need to set the autoFillBackground property, or use setAttribute() to set the Qt::WA_OpaquePaintEvent attribute, to make a widget opaque.
For widgets that use contents propagation, a scroll will cause an update of the entire scroll area.
See also Transparency and Double Buffering.
void QWidget::scroll(int dx, int dy, const QRect \&r)
This is an overloaded function.
This version only scrolls r and does not move the children of the widget.
If r is empty or invalid, the result is undefined.
See also QScrollArea.
Upstream PySide2 reference signatures (binding differences may apply):
scroll(self, dx: int, dy: int) -> None
scroll(self, dx: int, dy: int, arg__3: PySide2.QtCore.QRect) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#scroll
setAcceptDrops
setAcceptDrops(on: bool) -> None
X.setAcceptDrops(on)
Upstream PySide2 reference signatures (binding differences may apply):
setAcceptDrops(self, on: bool) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#setAcceptDrops
setAccessibleDescription
setAccessibleDescription(description: str) -> None
X.setAccessibleDescription(description)
Upstream PySide2 reference signatures (binding differences may apply):
setAccessibleDescription(self, description: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#setAccessibleDescription
setAccessibleName
setAccessibleName(name: str) -> None
X.setAccessibleName(name)
Upstream PySide2 reference signatures (binding differences may apply):
setAccessibleName(self, name: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#setAccessibleName
setAttribute
setAttribute(arg__1: Any, on: bool) -> None
X.setAttribute(arg__1, on)
Supplemental documentation: Qt 5 reference:
void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on \= true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
See also testAttribute().
Upstream PySide2 reference signatures (binding differences may apply):
setAttribute(self, arg__1: PySide2.QtCore.Qt.WidgetAttribute, on: bool=...) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#setAttribute
setAutoFillBackground
setAutoFillBackground(enabled: bool) -> None
X.setAutoFillBackground(enabled)
Upstream PySide2 reference signatures (binding differences may apply):
setAutoFillBackground(self, enabled: bool) -> None
Source: https://doc.qt.io/archives/qt-5.15/qwidget.html#setAutoFillBackground