Skip to content

PythonQt.QtGui.QWidget · declarations 002

Back to PythonQt.QtGui.QWidget

enterEvent

enterEvent(event: Any) -> None

X.enterEvent(event)

Supplemental documentation: Qt 5 reference:

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

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

An event is sent to the widget when the mouse cursor enters the widget.

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

Upstream PySide2 reference signatures (binding differences may apply):

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

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

event

event(event: Any) -> bool

X.event(event) -> bool

Supplemental documentation: Qt 5 reference:

[override virtual protected] bool QWidget::event(QEvent *event)

Reimplements: QObject::event(QEvent *e).

This is the main event handler; it handles event event. You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.

Key press and release events are treated differently from other events. event() checks for Tab and Shift+Tab and tries to move the focus appropriately. If there is no widget to move the focus to (or the key press is not Tab or Shift+Tab), event() calls keyPressEvent().

Mouse and tablet event handling is also slightly special: only when the widget is enabled, event() will call the specialized handlers such as mousePressEvent(); otherwise it will discard the event.

This function returns true if the event was recognized, otherwise it returns false. If the recognized event was accepted (see QEvent::accepted), any further processing such as event propagation to the parent widget stops.

See also closeEvent(), focusInEvent(), focusOutEvent(), enterEvent(), keyPressEvent(), keyReleaseEvent(), leaveEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), moveEvent(), paintEvent(), resizeEvent(), QObject::event(), and QObject::timerEvent().

Upstream PySide2 reference signatures (binding differences may apply):

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

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

focus instance-attribute

focus: Any

Qt 5 reference:

focus : const bool

This property holds whether this widget (or its focus proxy) has the keyboard input focus

By default, this property is false.

Note: Obtaining the value of this property for a widget is effectively equivalent to checking whether QApplication::focusWidget() refers to the widget.

Access functions:

bool hasFocus() const

See also setFocus(), clearFocus(), setFocusPolicy(), and QApplication::focusWidget().

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

focusInEvent

focusInEvent(event: Any) -> None

X.focusInEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QWidget::focusInEvent(QFocusEvent *event)

This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget. The event is passed in the event parameter

A widget normally must setFocusPolicy() to something other than Qt::NoFocus in order to receive focus events. (Note that the application programmer can call setFocus() on any widget, even those that do not normally accept focus.)

The default implementation updates the widget (except for windows that do not specify a focusPolicy()).

See also focusOutEvent(), setFocusPolicy(), keyPressEvent(), keyReleaseEvent(), event(), and QFocusEvent.

Upstream PySide2 reference signatures (binding differences may apply):

focusInEvent(self, event: PySide2.QtGui.QFocusEvent) -> None

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

focusNextChild

focusNextChild() -> bool

X.focusNextChild() -> bool

Supplemental documentation: Qt 5 reference:

[protected] bool QWidget::focusNextChild()

Finds a new widget to give the keyboard focus to, as appropriate for Tab, and returns true if it can find a new widget, or false if it can't.

See also focusPreviousChild().

Upstream PySide2 reference signatures (binding differences may apply):

focusNextChild(self) -> bool

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

focusNextPrevChild

focusNextPrevChild(next: bool) -> bool

X.focusNextPrevChild(next) -> bool

Supplemental documentation: Qt 5 reference:

[virtual protected] bool QWidget::focusNextPrevChild(bool next)

Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true if it can find a new widget, or false if it can't.

If next is true, this function searches forward, if next is false, it searches backward.

Sometimes, you will want to reimplement this function. For example, a web browser might reimplement it to move its "current active link" forward or backward, and call focusNextPrevChild() only when it reaches the last or first link on the "page".

Child widgets call focusNextPrevChild() on their parent widgets, but only the window that contains the child widgets decides where to redirect focus. By reimplementing this function for an object, you thus gain control of focus traversal for all child widgets.

See also focusNextChild() and focusPreviousChild().

Upstream PySide2 reference signatures (binding differences may apply):

focusNextPrevChild(self, next: bool) -> bool

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

focusOutEvent

focusOutEvent(event: Any) -> None

X.focusOutEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QWidget::focusOutEvent(QFocusEvent *event)

This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) for the widget. The events is passed in the event parameter.

A widget normally must setFocusPolicy() to something other than Qt::NoFocus in order to receive focus events. (Note that the application programmer can call setFocus() on any widget, even those that do not normally accept focus.)

The default implementation updates the widget (except for windows that do not specify a focusPolicy()).

See also focusInEvent(), setFocusPolicy(), keyPressEvent(), keyReleaseEvent(), event(), and QFocusEvent.

Upstream PySide2 reference signatures (binding differences may apply):

focusOutEvent(self, event: PySide2.QtGui.QFocusEvent) -> None

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

focusPolicy instance-attribute

focusPolicy: Any

Qt 5 reference:

focusPolicy : Qt::FocusPolicy

This property holds the way the widget accepts keyboard focus

The policy is Qt::TabFocus if the widget accepts keyboard focus by tabbing, Qt::ClickFocus if the widget accepts focus by clicking, Qt::StrongFocus if it accepts both, and Qt::NoFocus (the default) if it does not accept focus at all.

You must enable keyboard focus for a widget if it processes keyboard events. This is normally done from the widget's constructor. For instance, the QLineEdit constructor calls setFocusPolicy(Qt::StrongFocus).

If the widget has a focus proxy, then the focus policy will be propagated to it.

Access functions:

Qt::FocusPolicy focusPolicy() const
void setFocusPolicy(Qt::FocusPolicy policy)

See also focusInEvent(), focusOutEvent(), keyPressEvent(), keyReleaseEvent(), and enabled.

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

focusPreviousChild

focusPreviousChild() -> bool

X.focusPreviousChild() -> bool

Supplemental documentation: Qt 5 reference:

[protected] bool QWidget::focusPreviousChild()

Finds a new widget to give the keyboard focus to, as appropriate for Shift+Tab, and returns true if it can find a new widget, or false if it can't.

See also focusNextChild().

Upstream PySide2 reference signatures (binding differences may apply):

focusPreviousChild(self) -> bool

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

focusProxy

focusProxy() -> Any

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

Supplemental documentation: Qt 5 reference:

QWidget *QWidget::focusProxy() const

Returns the focus proxy, or nullptr if there is no focus proxy.

See also setFocusProxy().

Upstream PySide2 reference signatures (binding differences may apply):

focusProxy(self) -> PySide2.QtWidgets.QWidget

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

focusWidget

focusWidget() -> Any

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

Supplemental documentation: Qt 5 reference:

QWidget *QWidget::focusWidget() const

Returns the last child of this widget that setFocus had been called on. For top level widgets this is the widget that will get focus in case this window gets activated

This is not the same as QApplication::focusWidget(), which returns the focus widget in the currently active window.

Upstream PySide2 reference signatures (binding differences may apply):

focusWidget(self) -> PySide2.QtWidgets.QWidget

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

font instance-attribute

font: QFont

Qt 5 reference:

font : QFont

This property holds the font currently set for the widget

This property describes the widget's requested font. The font 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, define different fonts for an application.

When you assign a new font to a widget, the properties from this font are combined with the widget's default font to form the widget's final font. You can call fontInfo() to get a copy of the widget's final font. The final font is also used to initialize QPainter's font.

The default depends on the system environment. QApplication maintains a system/theme font which serves as a default for all widgets. There may also be special font defaults for certain types of widgets. You can also define default fonts for widgets yourself by passing a custom font and the name of a widget to QApplication::setFont(). Finally, the font is matched against Qt's font database to find the best match.

QWidget propagates explicit font properties from parent to child. If you change a specific property on a font and assign that font to a widget, that property will propagate to all the widget's children, overriding any system defaults for that property. Note that fonts by default don't propagate to windows (see isWindow()) unless the Qt::WA_WindowPropagation attribute is enabled.

QWidget's font propagation is similar to its palette propagation.

The current style, which is used to render the content of all standard Qt widgets, is free to choose to use the widget font, or in some cases, to ignore it (partially, or completely). In particular, certain styles like GTK style, Mac style, and Windows Vista style, apply special modifications to the widget font to match the platform's native look and feel. Because of this, assigning properties to a widget's font is not guaranteed to change the appearance of the widget. Instead, you may choose to apply a styleSheet.

Note: If Qt Style Sheets are used on the same widget as setFont(), style sheets will take precedence if the settings conflict.

Access functions:

const QFont \& font() const
void setFont(const QFont \&)

See also fontInfo() and fontMetrics().

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

fontInfo

fontInfo() -> Any

X.fontInfo() -> PythonQt.QtGui.QFontInfo

Supplemental documentation: Qt 5 reference:

QFontInfo QWidget::fontInfo() const

Returns the font info for the widget's current font. Equivalent to QFontInfo(widget->font()).

See also font(), fontMetrics(), and setFont().

Upstream PySide2 reference signatures (binding differences may apply):

fontInfo(self) -> PySide2.QtGui.QFontInfo

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

fontMetrics

fontMetrics() -> Any

X.fontMetrics() -> PythonQt.QtGui.QFontMetrics

Supplemental documentation: Qt 5 reference:

QFontMetrics QWidget::fontMetrics() const

Returns the font metrics for the widget's current font. Equivalent to QFontMetrics(widget->font()).

See also font(), fontInfo(), and setFont().

Upstream PySide2 reference signatures (binding differences may apply):

fontMetrics(self) -> PySide2.QtGui.QFontMetrics

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

foregroundRole

foregroundRole() -> Any

X.foregroundRole()

Supplemental documentation: Qt 5 reference:

QPalette::ColorRole QWidget::foregroundRole() const

Returns the foreground role.

The foreground role defines the color from the widget's palette that is used to draw the foreground.

If no explicit foreground role is set, the function returns a role that contrasts with the background role.

See also setForegroundRole() and backgroundRole().

Upstream PySide2 reference signatures (binding differences may apply):

foregroundRole(self) -> PySide2.QtGui.QPalette.ColorRole

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

frameGeometry instance-attribute

frameGeometry: QRect

Qt 5 reference:

frameGeometry : const QRect

geometry 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 contains a value that depends on the user's platform and screen geometry.

Access functions:

QRect frameGeometry() const

See also geometry(), x(), y(), and pos().

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

frameSize instance-attribute

frameSize: QSize

Qt 5 reference:

frameSize : const QSize

This property holds the size of the widget including any window frame

By default, this property contains a value that depends on the user's platform and screen geometry.

Access functions:

QSize frameSize() const

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

fullScreen instance-attribute

fullScreen: Any

Qt 5 reference:

fullScreen : const bool

This property holds whether the widget is shown in full screen mode

A widget in full screen mode occupies the whole screen area and does not display window decorations, such as a title bar.

By default, this property is false.

Access functions:

bool isFullScreen() const

See also windowState(), minimized, and maximized.

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

geometry instance-attribute

geometry: QRect

Qt 5 reference:

geometry : QRect

This property holds the geometry of the widget relative to its parent and excluding the window frame

When changing the geometry, the widget, if visible, receives a move event (moveEvent()) and/or a resize event (resizeEvent()) immediately. If the widget is not currently visible, it is guaranteed to receive appropriate events before it is shown.

The size component is adjusted if it lies outside the range defined by minimumSize() and maximumSize().

Warning: Calling setGeometry() inside resizeEvent() or moveEvent() can lead to infinite recursion.

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:

const QRect \& geometry() const
void setGeometry(int x, int y, int w, int h)
void setGeometry(const QRect \&)

See also frameGeometry(), rect(), move(), resize(), moveEvent(), resizeEvent(), minimumSize(), and maximumSize().

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

grab

grab(rectangle: Any) -> Any

X.grab(rectangle) -> PythonQt.QtGui.QPixmap

Supplemental documentation: Qt 5 reference:

QPixmap QWidget::grab(const QRect \&rectangle \= QRect(QPoint(0, 0), QSize(-1, -1)))

Renders the widget into a pixmap restricted by the given rectangle. If the widget has any children, then they are also painted in the appropriate positions.

If a rectangle with an invalid size is specified (the default), the entire widget is painted.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

This function was introduced in Qt 5.0.

See also render() and QPixmap.

Upstream PySide2 reference signatures (binding differences may apply):

grab(self, rectangle: PySide2.QtCore.QRect=...) -> PySide2.QtGui.QPixmap

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

grabGesture

grabGesture(type: Any, arg1: flags) -> None

X.grabGesture(type, flags)

Supplemental documentation: Qt 5 reference:

void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags \= Qt::GestureFlags())

Subscribes the widget to a given gesture with specific flags.

This function was introduced in Qt 4.6.

See also ungrabGesture() and QGestureEvent.

Upstream PySide2 reference signatures (binding differences may apply):

grabGesture(self, type: PySide2.QtCore.Qt.GestureType, flags: PySide2.QtCore.Qt.GestureFlags=...) -> None

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

grabKeyboard

grabKeyboard() -> None

X.grabKeyboard()

Supplemental documentation: Qt 5 reference:

void QWidget::grabKeyboard()

Grabs the keyboard input.

This widget receives all keyboard events until releaseKeyboard() is called; other widgets get no keyboard events at all. Mouse events are not affected. Use grabMouse() if you want to grab that.

The focus widget is not affected, except that it doesn't receive any keyboard events. setFocus() moves the focus as usual, but the new focus widget receives keyboard events only after releaseKeyboard() is called.

If a different widget is currently grabbing keyboard input, that widget's grab is released first.

See also releaseKeyboard(), grabMouse(), releaseMouse(), and focusWidget().

Upstream PySide2 reference signatures (binding differences may apply):

grabKeyboard(self) -> None

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

grabMouse

grabMouse(arg__1: Any) -> None

X.grabMouse(arg__1)

Supplemental documentation: Qt 5 reference:

void QWidget::grabMouse()

Grabs the mouse input.

This widget receives all mouse events until releaseMouse() is called; other widgets get no mouse events at all. Keyboard events are not affected. Use grabKeyboard() if you want to grab that.

Warning: Bugs in mouse-grabbing applications very often lock the terminal. Use this function with extreme caution, and consider using the -nograb command line option while debugging.

It is almost never necessary to grab the mouse when using Qt, as Qt grabs and releases it sensibly. In particular, Qt grabs the mouse when a mouse button is pressed and keeps it until the last button is released.

Note: Only visible widgets can grab mouse input. If isVisible() returns false for a widget, that widget cannot call grabMouse().

Note: On Windows, grabMouse() only works when the mouse is inside a window owned by the process. On macOS, grabMouse() only works when the mouse is inside the frame of that widget.

See also releaseMouse(), grabKeyboard(), and releaseKeyboard().

void QWidget::grabMouse(const QCursor \&cursor)

This function overloads grabMouse().

Grabs the mouse input and changes the cursor shape.

The cursor will assume shape cursor (for as long as the mouse focus is grabbed) and this widget will be the only one to receive mouse events until releaseMouse() is called().

Warning: Grabbing the mouse might lock the terminal.

Note: See the note in QWidget::grabMouse().

See also releaseMouse(), grabKeyboard(), releaseKeyboard(), and setCursor().

Upstream PySide2 reference signatures (binding differences may apply):

grabMouse(self) -> None
grabMouse(self, arg__1: PySide2.QtGui.QCursor) -> None

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

grabShortcut

grabShortcut(key: Any, context: Any) -> int

X.grabShortcut(key, context) -> int

Supplemental documentation: Qt 5 reference:

int QWidget::grabShortcut(const QKeySequence \&key, Qt::ShortcutContext context \= Qt::WindowShortcut)

Adds a shortcut to Qt's shortcut system that watches for the given key sequence in the given context. If the context is Qt::ApplicationShortcut, the shortcut applies to the application as a whole. Otherwise, it is either local to this widget, Qt::WidgetShortcut, or to the window itself, Qt::WindowShortcut.

If the same key sequence has been grabbed by several widgets, when the key sequence occurs a QEvent::Shortcut event is sent to all the widgets to which it applies in a non-deterministic order, but with the ``ambiguous'' flag set to true.

Warning: You should not normally need to use this function; instead create QActions with the shortcut key sequences you require (if you also want equivalent menu options and toolbar buttons), or create QShortcuts if you just need key sequences. Both QAction and QShortcut handle all the event filtering for you, and provide signals which are triggered when the user triggers the key sequence, so are much easier to use than this low-level function.

See also releaseShortcut() and setShortcutEnabled().

Upstream PySide2 reference signatures (binding differences may apply):

grabShortcut(self, key: PySide2.QtGui.QKeySequence, context: PySide2.QtCore.Qt.ShortcutContext=...) -> int

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

graphicsEffect

graphicsEffect() -> Any

X.graphicsEffect() -> PythonQt.QtGui.QGraphicsEffect

Supplemental documentation: Qt 5 reference:

QGraphicsEffect *QWidget::graphicsEffect() const

The graphicsEffect function returns a pointer to the widget's graphics effect.

If the widget has no graphics effect, nullptr is returned.

This function was introduced in Qt 4.6.

See also setGraphicsEffect().

Upstream PySide2 reference signatures (binding differences may apply):

graphicsEffect(self) -> PySide2.QtWidgets.QGraphicsEffect

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

graphicsProxyWidget

graphicsProxyWidget() -> Any

X.graphicsProxyWidget() -> PythonQt.QtGui.QGraphicsProxyWidget

Supplemental documentation: Qt 5 reference:

QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const

Returns the proxy widget for the corresponding embedded widget in a graphics view; otherwise returns nullptr.

This function was introduced in Qt 4.5.

See also QGraphicsProxyWidget::createProxyForChildWidget() and QGraphicsScene::addWidget().

Upstream PySide2 reference signatures (binding differences may apply):

graphicsProxyWidget(self) -> PySide2.QtWidgets.QGraphicsProxyWidget

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

hasFocus

hasFocus() -> bool

X.hasFocus() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

hasFocus(self) -> bool

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

hasHeightForWidth

hasHeightForWidth() -> bool

X.hasHeightForWidth() -> bool

Supplemental documentation: Qt 5 reference:

[virtual] bool QWidget::hasHeightForWidth() const

Returns true if the widget's preferred height depends on its width; otherwise returns false.

This function was introduced in Qt 5.0.

Upstream PySide2 reference signatures (binding differences may apply):

hasHeightForWidth(self) -> bool

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

hasMouseTracking

hasMouseTracking() -> bool

X.hasMouseTracking() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

hasMouseTracking(self) -> bool

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

height instance-attribute

height: int

Qt 5 reference:

height : const int

This property holds the height 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 height 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 height() const

See also geometry, width, and size.

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

heightForWidth

heightForWidth(arg__1: int) -> int

X.heightForWidth(arg__1) -> int

Supplemental documentation: Qt 5 reference:

[virtual] int QWidget::heightForWidth(int w) const

Returns the preferred height for this widget, given the width w.

If this widget has a layout, the default implementation returns the layout's preferred height. if there is no layout, the default implementation returns -1 indicating that the preferred height does not depend on the width.

Upstream PySide2 reference signatures (binding differences may apply):

heightForWidth(self, arg__1: int) -> int

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

hide

hide() -> None

X.hide()

Supplemental documentation: Qt 5 reference:

[slot] void QWidget::hide()

Hides the widget. This function is equivalent to setVisible(false).

Note: If you are working with QDialog or its subclasses and you invoke the show() function after this function, the dialog will be displayed in its original position.

See also hideEvent(), isHidden(), show(), setVisible(), isVisible(), and close().

Upstream PySide2 reference signatures (binding differences may apply):

hide(self) -> None

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

hideEvent

hideEvent(event: Any) -> None

X.hideEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QWidget::hideEvent(QHideEvent *event)

This event handler can be reimplemented in a subclass to receive widget hide events. The event is passed in the event parameter.

Hide events are sent to widgets immediately after they have been hidden.

Note: 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. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible().

See also visible, event(), and QHideEvent.

Upstream PySide2 reference signatures (binding differences may apply):

hideEvent(self, event: PySide2.QtGui.QHideEvent) -> None

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

initPainter

initPainter(painter: Any) -> None

X.initPainter(painter)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QWidget::initPainter(QPainter *painter) const

Initializes the painter pen, background and font to the same as the given widget's. This function is called automatically when the painter is opened on a QWidget.

Upstream PySide2 reference signatures (binding differences may apply):

initPainter(self, painter: PySide2.QtGui.QPainter) -> None

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

inputMethodEvent

inputMethodEvent(arg__1: Any) -> None

X.inputMethodEvent(arg__1)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QWidget::inputMethodEvent(QInputMethodEvent *event)

This event handler, for event event, can be reimplemented in a subclass to receive Input Method composition events. This handler is called when the state of the input method changes.

Note that when creating custom text editing widgets, the Qt::WA_InputMethodEnabled window attribute must be set explicitly (using the setAttribute() function) in order to receive input method events.

The default implementation calls event->ignore(), which rejects the Input Method event. See the QInputMethodEvent documentation for more details.

See also event() and QInputMethodEvent.

Upstream PySide2 reference signatures (binding differences may apply):

inputMethodEvent(self, event: PySide2.QtGui.QInputMethodEvent) -> None

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

inputMethodHints instance-attribute

inputMethodHints: Any

Qt 5 reference:

inputMethodHints : Qt::InputMethodHints

What input method specific hints the widget has.

This is only relevant for input widgets. It is used by the input method to retrieve hints as to how the input method should operate. For example, if the Qt::ImhFormattedNumbersOnly flag is set, the input method may change its visual components to reflect that only numbers can be entered.

Warning: Some widgets require certain flags in order to work as intended. To set a flag, do w->setInputMethodHints(w->inputMethodHints()|f) instead of w->setInputMethodHints(f).

Note: The flags are only hints, so the particular input method implementation is free to ignore them. If you want to be sure that a certain type of characters are entered, you should also set a QValidator on the widget.

The default value is Qt::ImhNone.

This property was introduced in Qt 4.6.

Access functions:

Qt::InputMethodHints inputMethodHints() const
void setInputMethodHints(Qt::InputMethodHints hints)

See also inputMethodQuery().

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

inputMethodQuery

inputMethodQuery(arg__1: Any) -> Any

X.inputMethodQuery(arg__1) -> object

Supplemental documentation: Qt 5 reference:

[virtual] QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const

This method is only relevant for input widgets. It is used by the input method to query a set of properties of the widget to be able to support complex input method operations as support for surrounding text and reconversions.

query specifies which property is queried.

See also inputMethodEvent(), QInputMethodEvent, QInputMethodQueryEvent, and inputMethodHints.

Upstream PySide2 reference signatures (binding differences may apply):

inputMethodQuery(self, arg__1: PySide2.QtCore.Qt.InputMethodQuery) -> typing.Any

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

insertAction

insertAction(before: Any, action: Any) -> None

X.insertAction(before, action)

Supplemental documentation: Qt 5 reference:

void QWidget::insertAction(QAction *before, QAction *action)

Inserts the action action to this widget's list of actions, before the action before. It appends the action if before is nullptr or before is not a valid action for this widget.

A QWidget should only have one of each action.

See also removeAction(), addAction(), QMenu, contextMenuPolicy, and actions().

Upstream PySide2 reference signatures (binding differences may apply):

insertAction(self, before: PySide2.QtWidgets.QAction, action: PySide2.QtWidgets.QAction) -> None

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

insertActions

insertActions(before: Any, actions: Any) -> None

X.insertActions(before, actions)

Supplemental documentation: Qt 5 reference:

void QWidget::insertActions(QAction *before, QList\<QAction *> actions)

Inserts the actions actions to this widget's list of actions, before the action before. It appends the action if before is nullptr or before is not a valid action for this widget.

A QWidget can have at most one of each action.

See also removeAction(), QMenu, insertAction(), and contextMenuPolicy.

Upstream PySide2 reference signatures (binding differences may apply):

insertActions(self, before: PySide2.QtWidgets.QAction, actions: typing.Sequence[PySide2.QtWidgets.QAction]) -> None

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

isActiveWindow instance-attribute

isActiveWindow: bool

Qt 5 reference:

isActiveWindow : const bool

This property holds whether this widget's window is the active window

The active window is the window that contains the widget that has keyboard focus (The window may still have focus if it has no widgets or none of its widgets accepts keyboard focus).

When popup windows are visible, this property is true for both the active window and for the popup.

By default, this property is false.

Access functions:

bool isActiveWindow() const

See also activateWindow() and QApplication::activeWindow().

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