Classes | Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
QwtPlotLayout Class Reference

Layout engine for QwtPlot. More...

#include <qwt_plot_layout.h>

Classes

class  LayoutData
 
class  PrivateData
 

Public Types

enum  Option {
  AlignScales = 0x01, IgnoreScrollbars = 0x02, IgnoreFrames = 0x04, IgnoreLegend = 0x08,
  IgnoreTitle = 0x10, IgnoreFooter = 0x20
}
 
typedef QFlags< OptionOptions
 Layout options. More...
 

Public Member Functions

virtual void activate (const QwtPlot *, const QRectF &plotRect, Options options=Options())
 Recalculate the geometry of all components. More...
 
bool alignCanvasToScale (int axisId) const
 
int canvasMargin (int axisId) const
 
QRectF canvasRect () const
 
QRectF footerRect () const
 
virtual void invalidate ()
 
QwtPlot::LegendPosition legendPosition () const
 
double legendRatio () const
 
QRectF legendRect () const
 
virtual QSize minimumSizeHint (const QwtPlot *) const
 
 QwtPlotLayout ()
 Constructor. More...
 
QRectF scaleRect (int axis) const
 
void setAlignCanvasToScale (int axisId, bool)
 
void setAlignCanvasToScales (bool)
 Set the align-canvas-to-axis-scales flag for all axes. More...
 
void setCanvasMargin (int margin, int axis=-1)
 
void setLegendPosition (QwtPlot::LegendPosition pos, double ratio)
 Specify the position of the legend. More...
 
void setLegendPosition (QwtPlot::LegendPosition pos)
 Specify the position of the legend. More...
 
void setLegendRatio (double ratio)
 
void setSpacing (int)
 
int spacing () const
 
QRectF titleRect () const
 
virtual ~QwtPlotLayout ()
 Destructor. More...
 

Protected Member Functions

QRectF alignLegend (const QRectF &canvasRect, const QRectF &legendRect) const
 
void alignScales (Options options, QRectF &canvasRect, QRectF scaleRect[QwtPlot::axisCnt]) const
 
void expandLineBreaks (Options options, const QRectF &rect, int &dimTitle, int &dimFooter, int dimAxes[QwtPlot::axisCnt]) const
 
QRectF layoutLegend (Options options, const QRectF &) const
 
void setCanvasRect (const QRectF &)
 Set the geometry for the canvas. More...
 
void setFooterRect (const QRectF &)
 Set the geometry for the footer. More...
 
void setLegendRect (const QRectF &)
 Set the geometry for the legend. More...
 
void setScaleRect (int axis, const QRectF &)
 Set the geometry for an axis. More...
 
void setTitleRect (const QRectF &)
 Set the geometry for the title. More...
 

Private Attributes

PrivateDatad_data
 

Detailed Description

Layout engine for QwtPlot.

It is used by the QwtPlot widget to organize its internal widgets or by QwtPlot::print() to render its content to a QPaintDevice like a QPrinter, QPixmap/QImage or QSvgRenderer.

See also
QwtPlot::setPlotLayout()

Definition at line 26 of file qwt_plot_layout.h.

Member Typedef Documentation

typedef QFlags<Option> QwtPlotLayout::Options

Layout options.

Definition at line 58 of file qwt_plot_layout.h.

Member Enumeration Documentation

Options to configure the plot layout engine

See also
activate(), QwtPlotRenderer
Enumerator
AlignScales 

Unused.

IgnoreScrollbars 

Ignore the dimension of the scrollbars. There are no scrollbars, when the plot is not rendered to widgets.

IgnoreFrames 

Ignore all frames.

IgnoreLegend 

Ignore the legend.

IgnoreTitle 

Ignore the title.

IgnoreFooter 

Ignore the footer.

Definition at line 33 of file qwt_plot_layout.h.

Constructor & Destructor Documentation

QwtPlotLayout::QwtPlotLayout ( )
explicit

Constructor.

Definition at line 202 of file qwt_plot_layout.cpp.

QwtPlotLayout::~QwtPlotLayout ( )
virtual

Destructor.

Definition at line 214 of file qwt_plot_layout.cpp.

Member Function Documentation

void QwtPlotLayout::activate ( const QwtPlot plot,
const QRectF &  plotRect,
Options  options = Options() 
)
virtual

Recalculate the geometry of all components.

Parameters
plotPlot to be layout
plotRectRectangle where to place the components
optionsLayout options
See also
invalidate(), titleRect(), footerRect() legendRect(), scaleRect(), canvasRect()

Definition at line 1272 of file qwt_plot_layout.cpp.

bool QwtPlotLayout::alignCanvasToScale ( int  axisId) const

Return the align-canvas-to-axis-scales setting. The canvas may:

  • extend beyond the axis scale ends to maximize its size
  • align with the axis scale ends to control its size.
Parameters
axisIdAxis index
Returns
align-canvas-to-axis-scales setting
See also
setAlignCanvasToScale(), setAlignCanvasToScale(), setCanvasMargin()

Definition at line 303 of file qwt_plot_layout.cpp.

QRectF QwtPlotLayout::alignLegend ( const QRectF &  canvasRect,
const QRectF &  legendRect 
) const
protected

Align the legend to the canvas

Parameters
canvasRectGeometry of the canvas
legendRectMaximum geometry for the legend
Returns
Geometry for the aligned legend

Definition at line 815 of file qwt_plot_layout.cpp.

void QwtPlotLayout::alignScales ( Options  options,
QRectF &  canvasRect,
QRectF  scaleRect[QwtPlot::axisCnt] 
) const
protected

Align the ticks of the axis to the canvas borders using the empty corners.

Parameters
optionsLayout options
canvasRectGeometry of the canvas ( IN/OUT )
scaleRectGeometries of the scales ( IN/OUT )
See also
Options

Definition at line 1009 of file qwt_plot_layout.cpp.

int QwtPlotLayout::canvasMargin ( int  axisId) const
Parameters
axisIdAxis index
Returns
Margin around the scale tick borders
See also
setCanvasMargin()

Definition at line 251 of file qwt_plot_layout.cpp.

QRectF QwtPlotLayout::canvasRect ( ) const
Returns
Geometry for the canvas
See also
activate(), invalidate()

Definition at line 538 of file qwt_plot_layout.cpp.

void QwtPlotLayout::expandLineBreaks ( Options  options,
const QRectF &  rect,
int &  dimTitle,
int &  dimFooter,
int  dimAxis[QwtPlot::axisCnt] 
) const
protected

Expand all line breaks in text labels, and calculate the height of their widgets in orientation of the text.

Parameters
optionsOptions how to layout the legend
rectBounding rectangle for title, footer, axes and canvas.
dimTitleExpanded height of the title widget
dimFooterExpanded height of the footer widget
dimAxisExpanded heights of the axis in axis orientation.
See also
Options

Definition at line 853 of file qwt_plot_layout.cpp.

QRectF QwtPlotLayout::footerRect ( ) const
Returns
Geometry for the footer
See also
activate(), invalidate()

Definition at line 460 of file qwt_plot_layout.cpp.

void QwtPlotLayout::invalidate ( )
virtual

Invalidate the geometry of all components.

See also
activate()

Definition at line 547 of file qwt_plot_layout.cpp.

QRectF QwtPlotLayout::layoutLegend ( Options  options,
const QRectF &  rect 
) const
protected

Find the geometry for the legend

Parameters
optionsOptions how to layout the legend
rectRectangle where to place the legend
Returns
Geometry for the legend
See also
Options

Definition at line 754 of file qwt_plot_layout.cpp.

QwtPlot::LegendPosition QwtPlotLayout::legendPosition ( ) const
Returns
Position of the legend
See also
setLegendPosition(), QwtPlot::setLegendPosition(), QwtPlot::legendPosition()

Definition at line 393 of file qwt_plot_layout.cpp.

double QwtPlotLayout::legendRatio ( ) const
Returns
The relative size of the legend in the plot.
See also
setLegendPosition()

Definition at line 416 of file qwt_plot_layout.cpp.

QRectF QwtPlotLayout::legendRect ( ) const
Returns
Geometry for the legend
See also
activate(), invalidate()

Definition at line 484 of file qwt_plot_layout.cpp.

QSize QwtPlotLayout::minimumSizeHint ( const QwtPlot plot) const
virtual
Returns
Minimum size hint
Parameters
plotPlot widget
See also
QwtPlot::minimumSizeHint()

Definition at line 562 of file qwt_plot_layout.cpp.

QRectF QwtPlotLayout::scaleRect ( int  axis) const
Parameters
axisAxis index
Returns
Geometry for the scale
See also
activate(), invalidate()

Definition at line 511 of file qwt_plot_layout.cpp.

void QwtPlotLayout::setAlignCanvasToScale ( int  axisId,
bool  on 
)

Change the align-canvas-to-axis-scales setting. The canvas may:

  • extend beyond the axis scale ends to maximize its size,
  • align with the axis scale ends to control its size.

The axisId parameter is somehow confusing as it identifies a border of the plot and not the axes, that are aligned. F.e when QwtPlot::yLeft is set, the left end of the the x-axes ( QwtPlot::xTop, QwtPlot::xBottom ) is aligned.

Parameters
axisIdAxis index
onNew align-canvas-to-axis-scales setting
See also
setCanvasMargin(), alignCanvasToScale(), setAlignCanvasToScales()
Warning
In case of on == true canvasMargin() will have no effect

Definition at line 288 of file qwt_plot_layout.cpp.

void QwtPlotLayout::setAlignCanvasToScales ( bool  on)

Set the align-canvas-to-axis-scales flag for all axes.

Parameters
onTrue/False
See also
setAlignCanvasToScale(), alignCanvasToScale()

Definition at line 265 of file qwt_plot_layout.cpp.

void QwtPlotLayout::setCanvasMargin ( int  margin,
int  axis = -1 
)

Change a margin of the canvas. The margin is the space above/below the scale ticks. A negative margin will be set to -1, excluding the borders of the scales.

Parameters
marginNew margin
axisOne of QwtPlot::Axis. Specifies where the position of the margin. -1 means margin at all borders.
See also
canvasMargin()
Warning
The margin will have no effect when alignCanvasToScale() is true

Definition at line 232 of file qwt_plot_layout.cpp.

void QwtPlotLayout::setCanvasRect ( const QRectF &  rect)
protected

Set the geometry for the canvas.

This method is intended to be used from derived layouts overloading activate()

See also
canvasRect(), activate()

Definition at line 529 of file qwt_plot_layout.cpp.

void QwtPlotLayout::setFooterRect ( const QRectF &  rect)
protected

Set the geometry for the footer.

This method is intended to be used from derived layouts overloading activate()

See also
footerRect(), activate()

Definition at line 451 of file qwt_plot_layout.cpp.

void QwtPlotLayout::setLegendPosition ( QwtPlot::LegendPosition  pos,
double  ratio 
)

Specify the position of the legend.

Parameters
posThe legend's position.
ratioRatio between legend and the bounding rectangle of title, footer, canvas and axes. The legend will be shrunk if it would need more space than the given ratio. The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0 it will be reset to the default ratio. The default vertical/horizontal ratio is 0.33/0.5.
See also
QwtPlot::setLegendPosition()

Definition at line 345 of file qwt_plot_layout.cpp.

void QwtPlotLayout::setLegendPosition ( QwtPlot::LegendPosition  pos)

Specify the position of the legend.

Parameters
posThe legend's position. Valid values are QwtPlot::LeftLegend, QwtPlot::RightLegend, QwtPlot::TopLegend, QwtPlot::BottomLegend.
See also
QwtPlot::setLegendPosition()

Definition at line 383 of file qwt_plot_layout.cpp.

void QwtPlotLayout::setLegendRatio ( double  ratio)

Specify the relative size of the legend in the plot

Parameters
ratioRatio between legend and the bounding rectangle of title, footer, canvas and axes. The legend will be shrunk if it would need more space than the given ratio. The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0 it will be reset to the default ratio. The default vertical/horizontal ratio is 0.33/0.5.

Definition at line 407 of file qwt_plot_layout.cpp.

void QwtPlotLayout::setLegendRect ( const QRectF &  rect)
protected

Set the geometry for the legend.

This method is intended to be used from derived layouts overloading activate()

Parameters
rectRectangle for the legend
See also
legendRect(), activate()

Definition at line 475 of file qwt_plot_layout.cpp.

void QwtPlotLayout::setScaleRect ( int  axis,
const QRectF &  rect 
)
protected

Set the geometry for an axis.

This method is intended to be used from derived layouts overloading activate()

Parameters
axisAxis index
rectRectangle for the scale
See also
scaleRect(), activate()

Definition at line 500 of file qwt_plot_layout.cpp.

void QwtPlotLayout::setSpacing ( int  spacing)

Change the spacing of the plot. The spacing is the distance between the plot components.

Parameters
spacingNew spacing
See also
setCanvasMargin(), spacing()

Definition at line 318 of file qwt_plot_layout.cpp.

void QwtPlotLayout::setTitleRect ( const QRectF &  rect)
protected

Set the geometry for the title.

This method is intended to be used from derived layouts overloading activate()

See also
titleRect(), activate()

Definition at line 429 of file qwt_plot_layout.cpp.

int QwtPlotLayout::spacing ( ) const
Returns
Spacing
See also
margin(), setSpacing()

Definition at line 327 of file qwt_plot_layout.cpp.

QRectF QwtPlotLayout::titleRect ( ) const
Returns
Geometry for the title
See also
activate(), invalidate()

Definition at line 438 of file qwt_plot_layout.cpp.

Member Data Documentation

PrivateData* QwtPlotLayout::d_data
private

Definition at line 117 of file qwt_plot_layout.h.


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


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 04:02:50