The widgetoverlay module

View mixin class to display QWidgets on top of a Page.

class OverlayData(page, point, rect, alignment)

Bases: tuple


Alias for field number 3


Alias for field number 0


Alias for field number 1


Alias for field number 2

class WidgetOverlayViewMixin(parent=None)[source]

Bases: object

Mixin class to add widgets to be displayed on top of pages.

Widgets are added using addWidget(), and become children of the viewport.

This class adds the following instance attribute:

deleteUnusedOverlayWidgets = True

If True, unused widgets are deleted using QObject.deleteLater(). Otherwise, only the parent is set to None. A widget becomes unused if the Page it was added to disappears from the page layout.

deleteUnusedOverlayWidgets = True
addWidget(widget, page, where=None, alignment=None)[source]

Add widget to be displayed on top of page.

The widget becomes a child of the viewport.

The where argument can be a QPoint or a QRect. If a rect is given, the widget is resized to occupy that rectangle. The rect should be in page coordinates. When the zoom factor is changed, the widget will be resized.

If a point is given, the widget is not resized and aligned on the point using the specified alignment (top-left if None).

If where is None, the widget occupies the whole page.

You can also use this method to change the page or rect for a widget that already has been added.


Remove the widget.

The widget is not deleted, but its parent is set to None.


Yield all widgets (for the Page if given).


Remove all widgets (for the Page if given).

The widget are not deleted, but their parent is set to None.


Reimplemented to update the size and position of the widgets.

scrollContentsBy(dx, dy)[source]

Reimplemented to scroll the page widgets along with the layout.


Reimplemented to keep page widgets in the right position.