The widgetoverlay module¶
View mixin class to display QWidgets on top of a Page.
- class OverlayData(page, point, rect, alignment)¶
Bases:
tuple
- alignment¶
Alias for field number 3
- page¶
Alias for field number 0
- point¶
Alias for field number 1
- rect¶
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.
- removeWidget(widget)[source]¶
Remove the widget.
The widget is not deleted, but its parent is set to None.