Skip to content

PythonQt.QtGui.QWidget · declarations 003

Back to PythonQt.QtGui.QWidget

isAncestorOf

isAncestorOf(child: Any) -> bool

X.isAncestorOf(child) -> bool

Supplemental documentation: Qt 5 reference:

bool QWidget::isAncestorOf(const QWidget *child) const

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

Upstream PySide2 reference signatures (binding differences may apply):

isAncestorOf(self, child: PySide2.QtWidgets.QWidget) -> bool

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

isEnabled

isEnabled() -> bool

X.isEnabled() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

isEnabled(self) -> bool

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

isEnabledTo

isEnabledTo(arg__1: Any) -> bool

X.isEnabledTo(arg__1) -> bool

Supplemental documentation: Qt 5 reference:

bool QWidget::isEnabledTo(const QWidget *ancestor) const

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

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

isEnabledTo(0) returns false if this widget or any if its ancestors was explicitly disabled.

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

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

See also setEnabled() and enabled.

Upstream PySide2 reference signatures (binding differences may apply):

isEnabledTo(self, arg__1: PySide2.QtWidgets.QWidget) -> bool

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

isFullScreen

isFullScreen() -> bool

X.isFullScreen() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

isFullScreen(self) -> bool

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

isHidden

isHidden() -> bool

X.isHidden() -> bool

Supplemental documentation: Qt 5 reference:

bool QWidget::isHidden() const

Returns true if the widget is hidden, otherwise returns false.

A hidden widget will only become visible when show() is called on it. It will not be automatically shown when the parent is shown.

To check visibility, use isVisible() instead (notice the exclamation mark).

isHidden() implies isVisible(), but a widget can be not visible and not hidden at the same time. This is the case for widgets that are children of widgets that are not visible.

Widgets are hidden if:

  • they were created as independent windows,
  • they were created as children of visible widgets,
  • hide() or setVisible(false) was called.

Upstream PySide2 reference signatures (binding differences may apply):

isHidden(self) -> bool

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

isLeftToRight

isLeftToRight() -> bool

X.isLeftToRight() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

isLeftToRight(self) -> bool

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

isMaximized

isMaximized() -> bool

X.isMaximized() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

isMaximized(self) -> bool

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

isMinimized

isMinimized() -> bool

X.isMinimized() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

isMinimized(self) -> bool

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

isModal

isModal() -> bool

X.isModal() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

isModal(self) -> bool

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

isRightToLeft

isRightToLeft() -> bool

X.isRightToLeft() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

isRightToLeft(self) -> bool

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

isVisible

isVisible() -> bool

X.isVisible() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

isVisible(self) -> bool

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

isVisibleTo

isVisibleTo(arg__1: Any) -> bool

X.isVisibleTo(arg__1) -> bool

Supplemental documentation: Qt 5 reference:

bool QWidget::isVisibleTo(const QWidget *ancestor) const

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

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

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

isVisibleTo(0) is identical to isVisible().

See also show(), hide(), and isVisible().

Upstream PySide2 reference signatures (binding differences may apply):

isVisibleTo(self, arg__1: PySide2.QtWidgets.QWidget) -> bool

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

isWindow

isWindow() -> bool

X.isWindow() -> bool

Supplemental documentation: Qt 5 reference:

bool QWidget::isWindow() const

Returns true if the widget is an independent window, otherwise returns false.

A window is a widget that isn't visually the child of any other widget and that usually has a frame and a window title.

A window can have a parent widget. It will then be grouped with its parent and deleted when the parent is deleted, minimized when the parent is minimized etc. If supported by the window manager, it will also have a common taskbar entry with its parent.

QDialog and QMainWindow widgets are by default windows, even if a parent widget is specified in the constructor. This behavior is specified by the Qt::Window flag.

See also window(), isModal(), and parentWidget().

Upstream PySide2 reference signatures (binding differences may apply):

isWindow(self) -> bool

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

isWindowModified

isWindowModified() -> bool

X.isWindowModified() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

isWindowModified(self) -> bool

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

keyPressEvent

keyPressEvent(event: Any) -> None

X.keyPressEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QWidget::keyPressEvent(QKeyEvent *event)

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

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

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

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

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

See also keyReleaseEvent(), setFocusPolicy(), focusInEvent(), focusOutEvent(), event(), QKeyEvent, and Tetrix Example.

Upstream PySide2 reference signatures (binding differences may apply):

keyPressEvent(self, event: PySide2.QtGui.QKeyEvent) -> None

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

keyReleaseEvent

keyReleaseEvent(event: Any) -> None

X.keyReleaseEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QWidget::keyReleaseEvent(QKeyEvent *event)

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

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

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

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

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

See also keyPressEvent(), QEvent::ignore(), setFocusPolicy(), focusInEvent(), focusOutEvent(), event(), and QKeyEvent.

Upstream PySide2 reference signatures (binding differences may apply):

keyReleaseEvent(self, event: PySide2.QtGui.QKeyEvent) -> None

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

keyboardGrabber

keyboardGrabber() -> Any

X.keyboardGrabber() -> PythonQt.QtGui.QWidget

Supplemental documentation: Qt 5 reference:

[static] QWidget *QWidget::keyboardGrabber()

Returns the widget that is currently grabbing the keyboard input.

If no widget in this application is currently grabbing the keyboard, nullptr is returned.

See also grabMouse() and mouseGrabber().

Upstream PySide2 reference signatures (binding differences may apply):

keyboardGrabber() -> PySide2.QtWidgets.QWidget

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

layout

layout() -> Any

X.layout() -> PythonQt.QtGui.QLayout

Supplemental documentation: Qt 5 reference:

QLayout *QWidget::layout() const

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

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

See also setLayout(), sizePolicy(), and Layout Management.

Upstream PySide2 reference signatures (binding differences may apply):

layout(self) -> PySide2.QtWidgets.QLayout

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

layoutDirection instance-attribute

layoutDirection: Any

Qt 5 reference:

layoutDirection : Qt::LayoutDirection

This property holds the layout direction for this widget.

Note: This method no longer affects text layout direction since Qt 4.7.

By default, this property is set to Qt::LeftToRight.

When the layout direction is set on a widget, it will propagate to the widget's children, but not to a child that is a window and not to a child for which setLayoutDirection() has been explicitly called. Also, child widgets added after setLayoutDirection() has been called for the parent do not inherit the parent's layout direction.

Access functions:

Qt::LayoutDirection layoutDirection() const
void setLayoutDirection(Qt::LayoutDirection direction)
void unsetLayoutDirection()

See also QApplication::layoutDirection.

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

leaveEvent

leaveEvent(event: Any) -> None

X.leaveEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QWidget::leaveEvent(QEvent *event)

This event handler can be reimplemented in a subclass to receive widget leave events which are passed in the event parameter.

A leave event is sent to the widget when the mouse cursor leaves the widget.

See also enterEvent(), mouseMoveEvent(), and event().

Upstream PySide2 reference signatures (binding differences may apply):

leaveEvent(self, event: PySide2.QtCore.QEvent) -> None

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

locale instance-attribute

locale: QLocale

Qt 5 reference:

locale : QLocale

This property holds the widget's locale

As long as no special locale has been set, this is either the parent's locale or (if this widget is a top level widget), the default locale.

If the widget displays dates or numbers, these should be formatted using the widget's locale.

This property was introduced in Qt 4.3.

Access functions:

QLocale locale() const
void setLocale(const QLocale \&locale)
void unsetLocale()

See also QLocale and QLocale::setDefault().

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

lower

lower() -> None

X.lower()

Supplemental documentation: Qt 5 reference:

[slot] void QWidget::lower()

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

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

See also raise() and stackUnder().

Upstream PySide2 reference signatures (binding differences may apply):

lower(self) -> None

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

mapFrom

mapFrom(arg__1: Any, arg__2: Any) -> Any

X.mapFrom(arg__1, arg__2) -> PythonQt.QtCore.QPoint

Supplemental documentation: Qt 5 reference:

QPoint QWidget::mapFrom(const QWidget *parent, const QPoint \&pos) const

Translates the widget coordinate pos from the coordinate system of parent to this widget's coordinate system. The parent must not be nullptr and must be a parent of the calling widget.

See also mapTo(), mapFromParent(), mapFromGlobal(), and underMouse().

Upstream PySide2 reference signatures (binding differences may apply):

mapFrom(self, arg__1: PySide2.QtWidgets.QWidget, arg__2: PySide2.QtCore.QPoint) -> PySide2.QtCore.QPoint

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

mapFromGlobal

mapFromGlobal(arg__1: Any) -> Any

X.mapFromGlobal(arg__1) -> PythonQt.QtCore.QPoint

Supplemental documentation: Qt 5 reference:

QPoint QWidget::mapFromGlobal(const QPoint \&pos) const

Translates the global screen coordinate pos to widget coordinates.

See also mapToGlobal(), mapFrom(), and mapFromParent().

Upstream PySide2 reference signatures (binding differences may apply):

mapFromGlobal(self, arg__1: PySide2.QtCore.QPoint) -> PySide2.QtCore.QPoint

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

mapFromParent

mapFromParent(arg__1: Any) -> Any

X.mapFromParent(arg__1) -> PythonQt.QtCore.QPoint

Supplemental documentation: Qt 5 reference:

QPoint QWidget::mapFromParent(const QPoint \&pos) const

Translates the parent widget coordinate pos to widget coordinates.

Same as mapFromGlobal() if the widget has no parent.

See also mapToParent(), mapFrom(), mapFromGlobal(), and underMouse().

Upstream PySide2 reference signatures (binding differences may apply):

mapFromParent(self, arg__1: PySide2.QtCore.QPoint) -> PySide2.QtCore.QPoint

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

mapTo

mapTo(arg__1: Any, arg__2: Any) -> Any

X.mapTo(arg__1, arg__2) -> PythonQt.QtCore.QPoint

Supplemental documentation: Qt 5 reference:

QPoint QWidget::mapTo(const QWidget *parent, const QPoint \&pos) const

Translates the widget coordinate pos to the coordinate system of parent. The parent must not be nullptr and must be a parent of the calling widget.

See also mapFrom(), mapToParent(), mapToGlobal(), and underMouse().

Upstream PySide2 reference signatures (binding differences may apply):

mapTo(self, arg__1: PySide2.QtWidgets.QWidget, arg__2: PySide2.QtCore.QPoint) -> PySide2.QtCore.QPoint

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

mapToGlobal

mapToGlobal(arg__1: Any) -> Any

X.mapToGlobal(arg__1) -> PythonQt.QtCore.QPoint

Supplemental documentation: Qt 5 reference:

QPoint QWidget::mapToGlobal(const QPoint \&pos) const

Translates the widget coordinate pos to global screen coordinates. For example, mapToGlobal(QPoint(0,0)) would give the global coordinates of the top-left pixel of the widget.

See also mapFromGlobal(), mapTo(), and mapToParent().

Upstream PySide2 reference signatures (binding differences may apply):

mapToGlobal(self, arg__1: PySide2.QtCore.QPoint) -> PySide2.QtCore.QPoint

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

mapToParent

mapToParent(arg__1: Any) -> Any

X.mapToParent(arg__1) -> PythonQt.QtCore.QPoint

Supplemental documentation: Qt 5 reference:

QPoint QWidget::mapToParent(const QPoint \&pos) const

Translates the widget coordinate pos to a coordinate in the parent widget.

Same as mapToGlobal() if the widget has no parent.

See also mapFromParent(), mapTo(), mapToGlobal(), and underMouse().

Upstream PySide2 reference signatures (binding differences may apply):

mapToParent(self, arg__1: PySide2.QtCore.QPoint) -> PySide2.QtCore.QPoint

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

mask

mask() -> Any

X.mask() -> PythonQt.QtGui.QRegion

Supplemental documentation: Qt 5 reference:

QRegion QWidget::mask() const

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

See also setMask(), clearMask(), QRegion::isEmpty(), and Shaped Clock Example.

Upstream PySide2 reference signatures (binding differences may apply):

mask(self) -> PySide2.QtGui.QRegion

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

maximized instance-attribute

maximized: Any

Qt 5 reference:

maximized : const bool

This property holds whether this widget is maximized

This property is only relevant for windows.

Note: Due to limitations on some window systems, this does not always report the expected results (e.g., if the user on X11 maximizes the window via the window manager, Qt has no way of distinguishing this from any other resize). This is expected to improve as window manager protocols evolve.

By default, this property is false.

Access functions:

bool isMaximized() const

See also windowState(), showMaximized(), visible, show(), hide(), showNormal(), and minimized.

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

maximumHeight instance-attribute

maximumHeight: int

Qt 5 reference:

maximumHeight : int

This property holds the widget's maximum height in pixels

This property corresponds to the height held by the maximumSize property.

By default, this property contains a value of 16777215.

Note: The definition of the QWIDGETSIZE_MAX macro limits the maximum size of widgets.

Access functions:

int maximumHeight() const
void setMaximumHeight(int maxh)

See also maximumSize and maximumWidth.

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

maximumSize instance-attribute

maximumSize: QSize

Qt 5 reference:

maximumSize : QSize

This property holds the widget's maximum size in pixels

The widget cannot be resized to a larger size than the maximum widget size.

By default, this property contains a size in which both width and height have values of 16777215.

Note: The definition of the QWIDGETSIZE_MAX macro limits the maximum size of widgets.

Access functions:

QSize maximumSize() const
void setMaximumSize(const QSize \&)
void setMaximumSize(int maxw, int maxh)

See also maximumWidth, maximumHeight, minimumSize, and sizeIncrement.

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

maximumWidth instance-attribute

maximumWidth: int

Qt 5 reference:

maximumWidth : int

This property holds the widget's maximum width in pixels

This property corresponds to the width held by the maximumSize property.

By default, this property contains a value of 16777215.

Note: The definition of the QWIDGETSIZE_MAX macro limits the maximum size of widgets.

Access functions:

int maximumWidth() const
void setMaximumWidth(int maxw)

See also maximumSize and maximumHeight.

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

metric

metric(arg__1: Any) -> int

X.metric(arg__1) -> int

Supplemental documentation: Qt 5 reference:

[override virtual protected] int QWidget::metric(QPaintDevice::PaintDeviceMetric m) const

Reimplements: QPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const.

Internal implementation of the virtual QPaintDevice::metric() function.

m is the metric to get.

Upstream PySide2 reference signatures (binding differences may apply):

metric(self, arg__1: PySide2.QtGui.QPaintDevice.PaintDeviceMetric) -> int

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

minimized instance-attribute

minimized: Any

Qt 5 reference:

minimized : const bool

This property holds whether this widget is minimized (iconified)

This property is only relevant for windows.

By default, this property is false.

Access functions:

bool isMinimized() const

See also showMinimized(), visible, show(), hide(), showNormal(), and maximized.

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

minimumHeight instance-attribute

minimumHeight: int

Qt 5 reference:

minimumHeight : int

This property holds the widget's minimum height in pixels

This property corresponds to the height held by the minimumSize property.

By default, this property has a value of 0.

Access functions:

int minimumHeight() const
void setMinimumHeight(int minh)

See also minimumSize and minimumWidth.

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

minimumSize instance-attribute

minimumSize: QSize

Qt 5 reference:

minimumSize : QSize

This property holds the widget's minimum size

The widget cannot be resized to a smaller size than the minimum widget size. The widget's size is forced to the minimum size if the current size is smaller.

The minimum size set by this function will override the minimum size defined by QLayout. In order to unset the minimum size, use a value of QSize(0, 0).

By default, this property contains a size with zero width and height.

Access functions:

QSize minimumSize() const
void setMinimumSize(const QSize \&)
void setMinimumSize(int minw, int minh)

See also minimumWidth, minimumHeight, maximumSize, and sizeIncrement.

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

minimumSizeHint instance-attribute

minimumSizeHint: QSize

Qt 5 reference:

minimumSizeHint : const QSize

This property holds the recommended minimum size for the widget

If the value of this property is an invalid size, no minimum size is recommended.

The default implementation of minimumSizeHint() returns an invalid size if there is no layout for this widget, and returns the layout's minimum size otherwise. Most built-in widgets reimplement minimumSizeHint().

QLayout will never resize a widget to a size smaller than the minimum size hint unless minimumSize() is set or the size policy is set to QSizePolicy::Ignore. If minimumSize() is set, the minimum size hint will be ignored.

Access functions:

virtual QSize minimumSizeHint() const

See also QSize::isValid(), resize(), setMinimumSize(), and sizePolicy().

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

minimumWidth instance-attribute

minimumWidth: int

Qt 5 reference:

minimumWidth : int

This property holds the widget's minimum width in pixels

This property corresponds to the width held by the minimumSize property.

By default, this property has a value of 0.

Access functions:

int minimumWidth() const
void setMinimumWidth(int minw)

See also minimumSize and minimumHeight.

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

modal instance-attribute

modal: Any

Qt 5 reference:

modal : const bool

This property holds whether the widget is a modal widget

This property only makes sense for windows. A modal widget prevents widgets in all other windows from getting any input.

By default, this property is false.

Access functions:

bool isModal() const

See also isWindow(), windowModality, and QDialog.

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