Classes | Public Types | Public Slots | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
QwtWidgetOverlay Class Reference

An overlay for a widget. More...

#include <qwt_widget_overlay.h>

Inheritance diagram for QwtWidgetOverlay:
Inheritance graph
[legend]

List of all members.

Classes

class  PrivateData

Public Types

enum  MaskMode { NoMask, MaskHint, AlphaMask }
 Mask mode. More...
enum  RenderMode { AutoRenderMode, CopyAlphaMask, DrawOverlay }
 Render mode. More...

Public Slots

void updateOverlay ()

Public Member Functions

virtual bool eventFilter (QObject *, QEvent *)
 Event filter.
MaskMode maskMode () const
 QwtWidgetOverlay (QWidget *)
 Constructor.
RenderMode renderMode () const
void setMaskMode (MaskMode)
 Specify how to find the mask for the overlay.
void setRenderMode (RenderMode)
virtual ~QwtWidgetOverlay ()
 Destructor.

Protected Member Functions

virtual void drawOverlay (QPainter *painter) const =0
virtual QRegion maskHint () const
 Calculate an approximation for the mask.
virtual void paintEvent (QPaintEvent *event)
virtual void resizeEvent (QResizeEvent *event)

Private Member Functions

void draw (QPainter *) const
void updateMask ()

Private Attributes

PrivateDatad_data

Detailed Description

An overlay for a widget.

The main use case of an widget overlay is to avoid heavy repaint operation of the widget below.

F.e. in combination with the plot canvas an overlay avoid 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 the following methods:

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

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, 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 

Use maskHint() 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 60 of file qwt_widget_overlay.h.

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 102 of file qwt_widget_overlay.h.


Constructor & Destructor Documentation

QwtWidgetOverlay::QwtWidgetOverlay ( QWidget *  widget) [explicit]

Constructor.

Parameters:
widgetParent widget, where the overlay is aligned to

Definition at line 114 of file qwt_widget_overlay.cpp.

Destructor.

Definition at line 131 of file qwt_widget_overlay.cpp.


Member Function Documentation

void QwtWidgetOverlay::draw ( QPainter *  painter) const [private]

Definition at line 307 of file qwt_widget_overlay.cpp.

virtual void QwtWidgetOverlay::drawOverlay ( QPainter *  painter) const [protected, pure virtual]

Draw the widget overlay

Parameters:
painterPainter

Implemented in QwtPickerTracker, and QwtPickerRubberband.

bool QwtWidgetOverlay::eventFilter ( QObject *  object,
QEvent *  event 
) [virtual]

Event filter.

Resize the overlay according to the size of the parent widget.

Parameters:
objectObject to be filtered
eventEvent
Returns:
See QObject::eventFilter()

Definition at line 367 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 pixels
  • NoMask The hint is unused.

The default implementation returns an invalid region indicating no hint.

Returns:
Hint for the mask

Reimplemented in QwtPickerTracker, and QwtPickerRubberband.

Definition at line 351 of file qwt_widget_overlay.cpp.

Returns:
Mode how to find the mask for the overlay
See also:
setMaskMode()

Definition at line 155 of file qwt_widget_overlay.cpp.

void QwtWidgetOverlay::paintEvent ( QPaintEvent *  event) [protected, virtual]

Paint event

Parameters:
eventPaint event
See also:
drawOverlay()

Definition at line 249 of file qwt_widget_overlay.cpp.

Returns:
Render mode
See also:
RenderMode, setRenderMode()

Definition at line 175 of file qwt_widget_overlay.cpp.

void QwtWidgetOverlay::resizeEvent ( QResizeEvent *  event) [protected, virtual]

Resize event

Parameters:
eventResize event

Definition at line 300 of file qwt_widget_overlay.cpp.

Specify how to find the mask for the overlay.

Parameters:
modeNew mode
See also:
maskMode()

Definition at line 142 of file qwt_widget_overlay.cpp.

Set the render mode

Parameters:
modeRender mode
See also:
RenderMode, renderMode()

Definition at line 166 of file qwt_widget_overlay.cpp.

void QwtWidgetOverlay::updateMask ( ) [private]

Definition at line 189 of file qwt_widget_overlay.cpp.

Recalculate the mask and repaint the overlay

Definition at line 183 of file qwt_widget_overlay.cpp.


Member Data Documentation

Definition at line 146 of file qwt_widget_overlay.h.


The documentation for this class was generated from the following files:


plotjuggler
Author(s): Davide Faconti
autogenerated on Fri Sep 1 2017 02:41:58