QwtWidgetOverlay(3)
β¨ NAME β¨
Bestie, welcome to QwtWidgetOverlay(3) from the Library Functions Manual β itβs literally βAn overlay for a widget.β π
This is the Qwt overlay class, and itβs serving abstract-base-class realness.
β¨ SYNOPSIS β¨
#include <qwt_widget_overlay.h>
Inherits QWidget.
π Public Types
enum MaskMode { NoMask, MaskHint, AlphaMask }β mask mode.enum RenderMode { AutoRenderMode, CopyAlphaMask, DrawOverlay }β render mode.
π«Ά Public Slots
void updateOverlay ()β the public slot for recalculating the mask and repainting the overlay.
πΈ Public Member Functions
QwtWidgetOverlay (QWidget *)β constructor.virtual ~QwtWidgetOverlay ()β destructor.void setMaskMode (MaskMode)β specify how to find the mask for the overlay.MaskMode maskMode () constβ returns the mask mode.void setRenderMode (RenderMode)β set the render mode.RenderMode renderMode () constβ returns the render mode.virtual bool eventFilter (QObject *, QEvent *) overrideβ event filter.
π¦ Protected Member Functions
virtual void paintEvent (QPaintEvent *) overridevirtual void resizeEvent (QResizeEvent *) overridevirtual QRegion maskHint () constβ calculate an approximation for the mask.virtual void drawOverlay (QPainter *painter) const =0
β¨ Detailed Description β¨
An overlay for a widget.
The main use case of a widget overlay is to avoid heavy repaint operations of the widget below. π₯
F.e. in combination with the plot canvas, an overlay avoids replots as the content of the canvas can be restored from its backing store.
QwtWidgetOverlay is an abstract base class. Deriving classes are supposed to reimplement these methods:
drawOverlay()maskHint()
Internally QwtPlotPicker uses overlays for displaying the rubber band and the tracker text.
See also: QwtPlotCanvas::BackingStore
Definition at line 40 of file qwt_widget_overlay.h.
β¨ Member Enumeration Documentation β¨
π
enum QwtWidgetOverlay::MaskMode
Mask mode. When using masks, the widget below gets paint events for the masked regions of the overlay only. Otherwise Qt triggers full repaints. On less powerful hardware (f.e embedded systems) β or when using the raster paint engine on a remote desktop β bit blitting is a noticeable operation, and that needs to be avoided. π
If and how to mask depends on how expensive the calculation of the mask is and how many pixels can be excluded by the mask.
The default setting is MaskHint.
See also: setMaskMode(), maskMode()
π Enumerator
NoMaskβ Donβt use a mask.MaskHintβ UsemaskHint()as mask. For many situations a fast approximation is good enough and it is not necessary to build a more detailed mask (f.e the bounding rectangle of a text).AlphaMaskβ Calculate a mask by checking the alpha values. Sometimes it is not possible to give a fast approximation and the mask needs to be calculated by drawing the overlay and testing the result.
When a valid maskHint() is available only pixels inside this approximation are checked.
Definition at line 62 of file qwt_widget_overlay.h.
π
enum QwtWidgetOverlay::RenderMode
Render mode. For calculating the alpha mask the overlay has already been painted to a temporary QImage. Instead of rendering the overlay twice this buffer can be copied for drawing the overlay.
On graphic systems using the raster paint engine (QWS, Windows) it means usually copying some memory only. On X11 it results in an expensive operation building a pixmap and for simple overlays it might not be recommended.
Note: The render mode has no effect, when maskMode() != AlphaMask.
π Enumerator
AutoRenderModeβ Copy the buffer, when using the raster paint engine.CopyAlphaMaskβ Always copy the buffer.DrawOverlayβ Never copy the buffer.
Definition at line 104 of file qwt_widget_overlay.h.
β¨ Constructor & Destructor Documentation β¨
π QwtWidgetOverlay::QwtWidgetOverlay (QWidget * widget) [explicit]
Constructor.
Parameters
widgetβ Parent widget, where the overlay is aligned to
Definition at line 126 of file qwt_widget_overlay.cpp.
π QwtWidgetOverlay::~QwtWidgetOverlay () [virtual]
Destructor.
Definition at line 143 of file qwt_widget_overlay.cpp.
β¨ Member Function Documentation β¨
π¦ virtual void QwtWidgetOverlay::drawOverlay (QPainter * painter) const [protected], [pure virtual]
Draw the widget overlay.
Parameters
painterβ Painter
π¦ bool QwtWidgetOverlay::eventFilter (QObject * object, QEvent * event) [override], [virtual]
Event filter. Resize the overlay according to the size of the parent widget.
Parameters
objectβ Object to be filteredeventβ Event
Returns
- See
QObject::eventFilter()
Definition at line 389 of file qwt_widget_overlay.cpp.
π¦ QRegion QwtWidgetOverlay::maskHint () const [protected], [virtual]
Calculate an approximation for the mask.
MaskHintβ The hint is used as mask.AlphaMaskβ The hint is used to speed up the algorithm for calculating a mask from non transparent pixelsNoMaskβ The hint is unused.
The default implementation returns an invalid region indicating no hint.
Returns
- Hint for the mask
Definition at line 373 of file qwt_widget_overlay.cpp.
π¦ QwtWidgetOverlay::MaskMode QwtWidgetOverlay::maskMode () const
Returns
- Mode how to find the mask for the overlay
See also: setMaskMode()
Definition at line 167 of file qwt_widget_overlay.cpp.
π¦ void QwtWidgetOverlay::paintEvent (QPaintEvent * event) [override], [protected], [virtual]
Paint event.
Parameters
eventβ Paint event
See also: drawOverlay()
Definition at line 261 of file qwt_widget_overlay.cpp.
π¦ QwtWidgetOverlay::RenderMode QwtWidgetOverlay::renderMode () const
Returns
- Render mode
See also: RenderMode, setRenderMode()
Definition at line 187 of file qwt_widget_overlay.cpp.
π¦ void QwtWidgetOverlay::resizeEvent (QResizeEvent * event) [override], [protected], [virtual]
Resize event.
Parameters
eventβ Resize event
Definition at line 323 of file qwt_widget_overlay.cpp.
π¦ void QwtWidgetOverlay::setMaskMode (MaskMode mode)
Specify how to find the mask for the overlay.
Parameters
modeβ New mode
See also: maskMode()
Definition at line 154 of file qwt_widget_overlay.cpp.
π¦ void QwtWidgetOverlay::setRenderMode (RenderMode mode)
Set the render mode.
Parameters
modeβ Render mode
See also: RenderMode, renderMode()
Definition at line 178 of file qwt_widget_overlay.cpp.
π¦ void QwtWidgetOverlay::updateOverlay () [slot]
Recalculate the mask and repaint the overlay.
Definition at line 195 of file qwt_widget_overlay.cpp.
β¨ Author β¨
Generated automatically by Doxygen for Qwt User's Guide from the source code.
Cute footer sign-off: Qwt Userβs Guide + QwtWidgetOverlay(3) β thatβs the source/version footer stamp, and this footer has no separate date line, so no fake date energy here, bestie. π
β¨π«Ά
π¦ where this page comes from
- alpine 3.24: qwt-doc 6.3.0-r0 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms