Skip to content

PythonQt.QtGui.QWidget · declarations 001

Back to PythonQt.QtGui.QWidget

acceptDrops instance-attribute

acceptDrops: bool

Qt 5 reference:

acceptDrops : bool

This property holds whether drop events are enabled for this widget

Setting this property to true announces to the system that this widget may be able to accept drop events.

If the widget is the desktop (windowType() \=\= Qt::Desktop), this may fail if another application is using the desktop; you can call acceptDrops() to test if this occurs.

Warning: Do not modify this property in a drag and drop event handler.

By default, this property is false.

Access functions:

bool acceptDrops() const
void setAcceptDrops(bool on)

See also Drag and Drop.

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

accessibleDescription instance-attribute

accessibleDescription: str

Qt 5 reference:

accessibleDescription : QString

This property holds the widget's description as seen by assistive technologies

The accessible description of a widget should convey what a widget does. While the accessibleName should be a short and concise string (e.g. Save), the description should give more context, such as Saves the current document.

This property has to be localized.

By default, this property contains an empty string and Qt falls back to using the tool tip to provide this information.

Access functions:

QString accessibleDescription() const
void setAccessibleDescription(const QString \&description)

See also QWidget::accessibleName and QAccessibleInterface::text().

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

accessibleName instance-attribute

accessibleName: str

Qt 5 reference:

accessibleName : QString

This property holds the widget's name as seen by assistive technologies

This is the primary name by which assistive technology such as screen readers announce this widget. For most widgets setting this property is not required. For example for QPushButton the button's text will be used.

It is important to set this property when the widget does not provide any text. For example a button that only contains an icon needs to set this property to work with screen readers. The name should be short and equivalent to the visual information conveyed by the widget.

This property has to be localized.

By default, this property contains an empty string.

Access functions:

QString accessibleName() const
void setAccessibleName(const QString \&name)

See also QWidget::accessibleDescription and QAccessibleInterface::text().

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

actionEvent

actionEvent(event: Any) -> None

X.actionEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QWidget::actionEvent(QActionEvent *event)

This event handler is called with the given event whenever the widget's actions are changed.

See also addAction(), insertAction(), removeAction(), actions(), and QActionEvent.

Upstream PySide2 reference signatures (binding differences may apply):

actionEvent(self, event: PySide2.QtGui.QActionEvent) -> None

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

actions

actions() -> tuple

X.actions() -> tuple

Supplemental documentation: Qt 5 reference:

QList\<QAction *> QWidget::actions() const

Returns the (possibly empty) list of this widget's actions.

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

Upstream PySide2 reference signatures (binding differences may apply):

actions(self) -> typing.List[PySide2.QtWidgets.QAction]

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

activateWindow

activateWindow() -> None

X.activateWindow()

Supplemental documentation: Qt 5 reference:

void QWidget::activateWindow()

Sets the top-level widget containing this widget to be the active window.

An active window is a visible top-level window that has the keyboard input focus.

This function performs the same operation as clicking the mouse on the title bar of a top-level window. On X11, the result depends on the Window Manager. If you want to ensure that the window is stacked on top as well you should also call raise(). Note that the window must be visible, otherwise activateWindow() has no effect.

On Windows, if you are calling this when the application is not currently the active one then it will not make it the active window. It will change the color of the taskbar entry to indicate that the window has changed in some way. This is because Microsoft does not allow an application to interrupt what the user is currently doing in another application.

See also isActiveWindow(), window(), show(), and QWindowsWindowFunctions::setWindowActivationBehavior().

Upstream PySide2 reference signatures (binding differences may apply):

activateWindow(self) -> None

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

addAction

addAction(action: Any) -> None

X.addAction(action)

Supplemental documentation: Qt 5 reference:

void QWidget::addAction(QAction *action)

Appends the action action to this widget's list of actions.

All QWidgets have a list of QActions, however they can be represented graphically in many different ways. The default use of the QAction list (as returned by actions()) is to create a context QMenu.

A QWidget should only have one of each action and adding an action it already has will not cause the same action to be in the widget twice.

The ownership of action is not transferred to this QWidget.

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

Upstream PySide2 reference signatures (binding differences may apply):

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

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

addActions

addActions(actions: Any) -> None

X.addActions(actions)

Supplemental documentation: Qt 5 reference:

void QWidget::addActions(QList\<QAction *> actions)

Appends the actions actions to this widget's list of actions.

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

Upstream PySide2 reference signatures (binding differences may apply):

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

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

adjustSize

adjustSize() -> None

X.adjustSize()

Supplemental documentation: Qt 5 reference:

void QWidget::adjustSize()

Adjusts the size of the widget to fit its contents.

This function uses sizeHint() if it is valid, i.e., the size hint's width and height are >\= 0. Otherwise, it sets the size to the children rectangle that covers all child widgets (the union of all child widget rectangles).

For windows, the screen size is also taken into account. If the sizeHint() is less than (200, 100) and the size policy is expanding, the window will be at least (200, 100). The maximum size of a window is 2/3 of the screen's width and height.

See also sizeHint() and childrenRect().

Upstream PySide2 reference signatures (binding differences may apply):

adjustSize(self) -> None

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

autoFillBackground instance-attribute

autoFillBackground: bool

Qt 5 reference:

autoFillBackground : bool

This property holds whether the widget background is filled automatically

If enabled, this property will cause Qt to fill the background of the widget before invoking the paint event. The color used is defined by the QPalette::Window color role from the widget's palette.

In addition, Windows are always filled with QPalette::Window, unless the WA_OpaquePaintEvent or WA_NoSystemBackground attributes are set.

This property cannot be turned off (i.e., set to false) if a widget's parent has a static gradient for its background.

Warning: Use this property with caution in conjunction with Qt Style Sheets. When a widget has a style sheet with a valid background or a border-image, this property is automatically disabled.

By default, this property is false.

This property was introduced in Qt 4.1.

Access functions:

bool autoFillBackground() const
void setAutoFillBackground(bool enabled)

See also Qt::WA_OpaquePaintEvent, Qt::WA_NoSystemBackground, and Transparency and Double Buffering.

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

backgroundRole

backgroundRole() -> Any

X.backgroundRole()

Supplemental documentation: Qt 5 reference:

QPalette::ColorRole QWidget::backgroundRole() const

Returns the background role of the widget.

The background role defines the brush from the widget's palette that is used to render the background.

If no explicit background role is set, the widget inherts its parent widget's background role.

See also setBackgroundRole() and foregroundRole().

Upstream PySide2 reference signatures (binding differences may apply):

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

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

backingStore

backingStore() -> Any

X.backingStore() -> PythonQt.QtGui.QBackingStore

Supplemental documentation: Qt 5 reference:

QBackingStore *QWidget::backingStore() const

Returns the QBackingStore this widget will be drawn into.

This function was introduced in Qt 5.0.

Upstream PySide2 reference signatures (binding differences may apply):

backingStore(self) -> PySide2.QtGui.QBackingStore

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

baseSize instance-attribute

baseSize: QSize

Qt 5 reference:

baseSize : QSize

This property holds the base size of the widget

The base size is used to calculate a proper widget size if the widget defines sizeIncrement().

By default, for a newly-created widget, this property contains a size with zero width and height.

Access functions:

QSize baseSize() const
void setBaseSize(const QSize \&)
void setBaseSize(int basew, int baseh)

See also setSizeIncrement().

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

changeEvent

changeEvent(arg__1: Any) -> None

X.changeEvent(arg__1)

Supplemental documentation: Qt 5 reference:

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

This event handler can be reimplemented to handle state changes.

The state being changed in this event can be retrieved through the event supplied.

Change events include: QEvent::ToolBarChange, QEvent::ActivationChange, QEvent::EnabledChange, QEvent::FontChange, QEvent::StyleChange, QEvent::PaletteChange, QEvent::WindowTitleChange, QEvent::IconTextChange, QEvent::ModifiedChange, QEvent::MouseTrackingChange, QEvent::ParentChange, QEvent::WindowStateChange, QEvent::LanguageChange, QEvent::LocaleChange, QEvent::LayoutDirectionChange, QEvent::ReadOnlyChange.

Upstream PySide2 reference signatures (binding differences may apply):

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

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

childAt

childAt(x: Any, y: Any) -> Any

X.childAt(x, y) -> PythonQt.QtGui.QWidget

Supplemental documentation: Qt 5 reference:

QWidget *QWidget::childAt(int x, int y) const

Returns the visible child widget at the position (x, y) in the widget's coordinate system. If there is no visible child widget at the specified position, the function returns nullptr.

QWidget *QWidget::childAt(const QPoint \&p) const

This is an overloaded function.

Returns the visible child widget at point p in the widget's own coordinate system.

Upstream PySide2 reference signatures (binding differences may apply):

childAt(self, p: PySide2.QtCore.QPoint) -> PySide2.QtWidgets.QWidget
childAt(self, x: int, y: int) -> PySide2.QtWidgets.QWidget

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

childrenRect instance-attribute

childrenRect: QRect

Qt 5 reference:

childrenRect : const QRect

This property holds the bounding rectangle of the widget's children

Hidden children are excluded.

By default, for a widget with no children, this property contains a rectangle with zero width and height located at the origin.

Access functions:

QRect childrenRect() const

See also childrenRegion() and geometry().

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

childrenRegion instance-attribute

childrenRegion: QRegion

Qt 5 reference:

childrenRegion : const QRegion

This property holds the combined region occupied by the widget's children

Hidden children are excluded.

By default, for a widget with no children, this property contains an empty region.

Access functions:

QRegion childrenRegion() const

See also childrenRect(), geometry(), and mask().

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

clearFocus

clearFocus() -> None

X.clearFocus()

Supplemental documentation: Qt 5 reference:

void QWidget::clearFocus()

Takes keyboard input focus from the widget.

If the widget has active focus, a focus out event is sent to this widget to tell it that it has lost the focus.

This widget must enable focus setting in order to get the keyboard input focus, i.e. it must call setFocusPolicy().

See also hasFocus(), setFocus(), focusInEvent(), focusOutEvent(), setFocusPolicy(), and QApplication::focusWidget().

Upstream PySide2 reference signatures (binding differences may apply):

clearFocus(self) -> None

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

clearMask

clearMask() -> None

X.clearMask()

Supplemental documentation: Qt 5 reference:

void QWidget::clearMask()

Removes any mask set by setMask().

See also setMask().

Upstream PySide2 reference signatures (binding differences may apply):

clearMask(self) -> None

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

close

close() -> bool

X.close() -> bool

Supplemental documentation: Qt 5 reference:

[slot] bool QWidget::close()

Closes this widget. Returns true if the widget was closed; otherwise returns false.

First it sends the widget a QCloseEvent. The widget is hidden if it accepts the close event. If it ignores the event, nothing happens. The default implementation of QWidget::closeEvent() accepts the close event.

If the widget has the Qt::WA_DeleteOnClose flag, the widget is also deleted. A close events is delivered to the widget no matter if the widget is visible or not.

The QApplication::lastWindowClosed() signal is emitted when the last visible primary window (i.e. window with no parent) with the Qt::WA_QuitOnClose attribute set is closed. By default this attribute is set for all widgets except transient windows such as splash screens, tool windows, and popup menus.

Upstream PySide2 reference signatures (binding differences may apply):

close(self) -> bool

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

closeEvent

closeEvent(event: Any) -> None

X.closeEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QWidget::closeEvent(QCloseEvent *event)

This event handler is called with the given event when Qt receives a window close request for a top-level widget from the window system.

By default, the event is accepted and the widget is closed. You can reimplement this function to change the way the widget responds to window close requests. For example, you can prevent the window from closing by calling ignore() on all events.

Main window applications typically use reimplementations of this function to check whether the user's work has been saved and ask for permission before closing. For example, the Application Example uses a helper function to determine whether or not to close the window:

void MainWindow::closeEvent(QCloseEvent *event)
{
    if (maybeSave()) {
        writeSettings();
        event->accept();
    } else {
        event->ignore();
    }
}

See also event(), hide(), close(), QCloseEvent, and Application Example.

Upstream PySide2 reference signatures (binding differences may apply):

closeEvent(self, event: PySide2.QtGui.QCloseEvent) -> None

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

contentsMargins

contentsMargins() -> Any

X.contentsMargins() -> PythonQt.QtGui.QMargins

Supplemental documentation: Qt 5 reference:

QMargins QWidget::contentsMargins() const

The contentsMargins function returns the widget's contents margins.

This function was introduced in Qt 4.6.

See also setContentsMargins() and contentsRect().

Upstream PySide2 reference signatures (binding differences may apply):

contentsMargins(self) -> PySide2.QtCore.QMargins

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

contentsRect

contentsRect() -> Any

X.contentsRect() -> PythonQt.QtCore.QRect

Supplemental documentation: Qt 5 reference:

QRect QWidget::contentsRect() const

Returns the area inside the widget's margins.

See also setContentsMargins() and contentsMargins().

Upstream PySide2 reference signatures (binding differences may apply):

contentsRect(self) -> PySide2.QtCore.QRect

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

contextMenuEvent

contextMenuEvent(event: Any) -> None

X.contextMenuEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QWidget::contextMenuEvent(QContextMenuEvent *event)

This event handler, for event event, can be reimplemented in a subclass to receive widget context menu events.

The handler is called when the widget's contextMenuPolicy is Qt::DefaultContextMenu.

The default implementation ignores the context event. See the QContextMenuEvent documentation for more details.

See also event(), QContextMenuEvent, and customContextMenuRequested().

Upstream PySide2 reference signatures (binding differences may apply):

contextMenuEvent(self, event: PySide2.QtGui.QContextMenuEvent) -> None

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

contextMenuPolicy instance-attribute

contextMenuPolicy: Any

Qt 5 reference:

contextMenuPolicy : Qt::ContextMenuPolicy

how the widget shows a context menu

The default value of this property is Qt::DefaultContextMenu, which means the contextMenuEvent() handler is called. Other values are Qt::NoContextMenu, Qt::PreventContextMenu, Qt::ActionsContextMenu, and Qt::CustomContextMenu. With Qt::CustomContextMenu, the signal customContextMenuRequested() is emitted.

Access functions:

Qt::ContextMenuPolicy contextMenuPolicy() const
void setContextMenuPolicy(Qt::ContextMenuPolicy policy)

See also contextMenuEvent(), customContextMenuRequested(), and actions().

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

createWinId

createWinId() -> None

X.createWinId()

Upstream PySide2 reference signatures (binding differences may apply):

createWinId(self) -> None

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

createWindowContainer

createWindowContainer(window: Any, parent: Any, arg2: flags) -> Any

X.createWindowContainer(window, parent, flags) -> PythonQt.QtGui.QWidget

Supplemental documentation: Qt 5 reference:

[static] QWidget *QWidget::createWindowContainer(QWindow *window, QWidget *parent \= nullptr, Qt::WindowFlags flags \= Qt::WindowFlags())

Creates a QWidget that makes it possible to embed window into a QWidget-based application.

The window container is created as a child of parent and with window flags flags.

Once the window has been embedded into the container, the container will control the window's geometry and visibility. Explicit calls to QWindow::setGeometry(), QWindow::show() or QWindow::hide() on an embedded window is not recommended.

The container takes over ownership of window. The window can be removed from the window container with a call to QWindow::setParent().

The window container is attached as a native child window to the toplevel window it is a child of. When a window container is used as a child of a QAbstractScrollArea or QMdiArea, it will create a native window for every widget in its parent chain to allow for proper stacking and clipping in this use case. Creating a native window for the window container also allows for proper stacking and clipping. This must be done before showing the window container. Applications with many native child windows may suffer from performance issues.

The window container has a number of known limitations:

  • Stacking order; The embedded window will stack on top of the widget hierarchy as an opaque box. The stacking order of multiple overlapping window container instances is undefined.
  • Rendering Integration; The window container does not interoperate with QGraphicsProxyWidget, QWidget::render() or similar functionality.
  • Focus Handling; It is possible to let the window container instance have any focus policy and it will delegate focus to the window via a call to QWindow::requestActivate(). However, returning to the normal focus chain from the QWindow instance will be up to the QWindow instance implementation itself. For instance, when entering a Qt Quick based window with tab focus, it is quite likely that further tab presses will only cycle inside the QML application. Also, whether QWindow::requestActivate() actually gives the window focus, is platform dependent.
  • Using many window container instances in a QWidget-based application can greatly hurt the overall performance of the application.

Upstream PySide2 reference signatures (binding differences may apply):

createWindowContainer(window: PySide2.QtGui.QWindow, parent: typing.Optional[PySide2.QtWidgets.QWidget]=..., flags: PySide2.QtCore.Qt.WindowFlags=...) -> PySide2.QtWidgets.QWidget

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

cursor instance-attribute

cursor: QCursor

Qt 5 reference:

cursor : QCursor

This property holds the cursor shape for this widget

The mouse cursor will assume this shape when it's over this widget. See the list of predefined cursor objects for a range of useful shapes.

An editor widget might use an I-beam cursor:

setCursor(Qt::IBeamCursor);

If no cursor has been set, or after a call to unsetCursor(), the parent's cursor is used.

By default, this property contains a cursor with the Qt::ArrowCursor shape.

Some underlying window implementations will reset the cursor if it leaves a widget even if the mouse is grabbed. If you want to have a cursor set for all widgets, even when outside the window, consider QGuiApplication::setOverrideCursor().

Access functions:

QCursor cursor() const
void setCursor(const QCursor \&)
void unsetCursor()

See also QGuiApplication::setOverrideCursor().

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

customContextMenuRequested

customContextMenuRequested(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QWidget.customContextMenuRequested; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QWidget::customContextMenuRequested(const QPoint \&pos)

This signal is emitted when the widget's contextMenuPolicy is Qt::CustomContextMenu, and the user has requested a context menu on the widget. The position pos is the position of the context menu event that the widget receives. Normally this is in widget coordinates. The exception to this rule is QAbstractScrollArea and its subclasses that map the context menu event to coordinates of the viewport().

See also mapToGlobal(), QMenu, and contextMenuPolicy.

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

destroy

destroy(destroyWindow: bool, destroySubWindows: bool) -> None

X.destroy(destroyWindow, destroySubWindows)

Supplemental documentation: Qt 5 reference:

[protected] void QWidget::destroy(bool destroyWindow \= true, bool destroySubWindows \= true)

Frees up window system resources. Destroys the widget window if destroyWindow is true.

destroy() calls itself recursively for all the child widgets, passing destroySubWindows for the destroyWindow parameter. To have more control over destruction of subwidgets, destroy subwidgets selectively first.

This function is usually called from the QWidget destructor.

Upstream PySide2 reference signatures (binding differences may apply):

destroy(self, destroyWindow: bool=..., destroySubWindows: bool=...) -> None

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

destroyed

destroyed(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QWidget.destroyed; argument details are not documented.

devType

devType() -> int

X.devType() -> int

Upstream PySide2 reference signatures (binding differences may apply):

devType(self) -> int

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

dragEnterEvent

dragEnterEvent(event: Any) -> None

X.dragEnterEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QWidget::dragEnterEvent(QDragEnterEvent *event)

This event handler is called when a drag is in progress and the mouse enters this widget. The event is passed in the event parameter.

If the event is ignored, the widget won't receive any drag move events.

See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application.

See also QDrag and QDragEnterEvent.

Upstream PySide2 reference signatures (binding differences may apply):

dragEnterEvent(self, event: PySide2.QtGui.QDragEnterEvent) -> None

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

dragLeaveEvent

dragLeaveEvent(event: Any) -> None

X.dragLeaveEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QWidget::dragLeaveEvent(QDragLeaveEvent *event)

This event handler is called when a drag is in progress and the mouse leaves this widget. The event is passed in the event parameter.

See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application.

See also QDrag and QDragLeaveEvent.

Upstream PySide2 reference signatures (binding differences may apply):

dragLeaveEvent(self, event: PySide2.QtGui.QDragLeaveEvent) -> None

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

dragMoveEvent

dragMoveEvent(event: Any) -> None

X.dragMoveEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QWidget::dragMoveEvent(QDragMoveEvent *event)

This event handler is called if a drag is in progress, and when any of the following conditions occur: the cursor enters this widget, the cursor moves within this widget, or a modifier key is pressed on the keyboard while this widget has the focus. The event is passed in the event parameter.

See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application.

See also QDrag and QDragMoveEvent.

Upstream PySide2 reference signatures (binding differences may apply):

dragMoveEvent(self, event: PySide2.QtGui.QDragMoveEvent) -> None

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

dropEvent

dropEvent(event: Any) -> None

X.dropEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QWidget::dropEvent(QDropEvent *event)

This event handler is called when the drag is dropped on this widget. The event is passed in the event parameter.

See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application.

See also QDrag and QDropEvent.

Upstream PySide2 reference signatures (binding differences may apply):

dropEvent(self, event: PySide2.QtGui.QDropEvent) -> None

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

echopy_object_name

echopy_object_name() -> str

Read the objectName after explicit install_extensions().

effectiveWinId

effectiveWinId() -> int

X.effectiveWinId() -> int

Supplemental documentation: Qt 5 reference:

WId QWidget::effectiveWinId() const

Returns the effective window system identifier of the widget, i.e. the native parent's window system identifier.

If the widget is native, this function returns the native widget ID. Otherwise, the window ID of the first native parent widget, i.e., the top-level widget that contains this widget, is returned.

Note: We recommend that you do not store this value as it is likely to change at run-time.

This function was introduced in Qt 4.4.

See also nativeParentWidget().

Upstream PySide2 reference signatures (binding differences may apply):

effectiveWinId(self) -> int

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

enabled instance-attribute

enabled: Any

Qt 5 reference:

enabled : bool

This property holds whether the widget is enabled

In general an enabled widget handles keyboard and mouse events; a disabled widget does not. An exception is made with QAbstractButton.

Some widgets display themselves differently when they are disabled. For example a button might draw its label grayed out. If your widget needs to know when it becomes enabled or disabled, you can use the changeEvent() with type QEvent::EnabledChange.

Disabling a widget implicitly disables all its children. Enabling respectively enables all child widgets unless they have been explicitly disabled. It it not possible to explicitly enable a child widget which is not a window while its parent widget remains disabled.

By default, this property is true.

Access functions:

bool isEnabled() const
void setEnabled(bool)

See also isEnabledTo(), QKeyEvent, QMouseEvent, and changeEvent().

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

ensurePolished

ensurePolished() -> None

X.ensurePolished()

Supplemental documentation: Qt 5 reference:

void QWidget::ensurePolished() const

Ensures that the widget and its children have been polished by QStyle (i.e., have a proper font and palette).

QWidget calls this function after it has been fully constructed but before it is shown the very first time. You can call this function if you want to ensure that the widget is polished before doing an operation, e.g., the correct font size might be needed in the widget's sizeHint() reimplementation. Note that this function is called from the default implementation of sizeHint().

Polishing is useful for final initialization that must happen after all constructors (from base classes as well as from subclasses) have been called.

If you need to change some settings when a widget is polished, reimplement event() and handle the QEvent::Polish event type.

Note: The function is declared const so that it can be called from other const functions (e.g., sizeHint()).

See also event().

Upstream PySide2 reference signatures (binding differences may apply):

ensurePolished(self) -> None

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