Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

# QwtPlotLayout Class Reference

List of all members.

## Detailed Description

Layout class for QwtPlot.

Organizes the geometry for the different QwtPlot components.

Definition at line 25 of file qwt_plot_layout.h.

## Public Types
enum | Options { AlignScales = 1, IgnoreScrollbars = 2, IgnoreFrames = 4, IgnoreMargin = 8, IgnoreLegend = 16 }
## Public Member Functions
| QwtPlotLayout ()
virtual | ~QwtPlotLayout ()
void | setMargin (int)
int | margin () const
void | setCanvasMargin (int margin, int axis=-1)
int | canvasMargin (int axis) const
void | setAlignCanvasToScales (bool)
bool | alignCanvasToScales () const
void | setSpacing (int)
int | spacing () const
void | setLegendPosition (QwtPlot::Position pos, double ratio)
void | setLegendPosition (QwtPlot::Position pos)
QwtPlot::Position | legendPosition () const
void | setLegendRatio (double ratio)
double | legendRatio () const
void | setLegendPos (int pos, double ratio=0.0)
int | legendPos () const
virtual QSize | minimumSizeHint (const QwtPlot *) const
virtual void | activate (const QwtPlot *, const QRect &rect, int options=0)
virtual void | invalidate ()
const QRect & | titleRect () const
const QRect & | legendRect () const
const QRect & | scaleRect (int axis) const
const QRect & | canvasRect () const
## Protected Member Functions
QRect | layoutLegend (int options, const QRect &) const
QRect | alignLegend (const QRect &canvasRect, const QRect &legendRect) const
void | expandLineBreaks (int options, const QRect &rect, int &dimTitle, int dimAxes[QwtPlot::axisCnt]) const
void | alignScales (int options, QRect &canvasRect, QRect scaleRect[QwtPlot::axisCnt]) const
## Protected Attributes
QRect | d_titleRect
QRect | d_legendRect
QRect | d_scaleRect [QwtPlot::axisCnt]
QRect | d_canvasRect
QwtPlotLayoutData * | d_layoutData

## Constructor & Destructor Documentation

QwtPlotLayout::QwtPlotLayout | ( |  | ) |

| Constructor. Definition at line 66 of file qwt_plot_layout.cpp. References invalidate(), setCanvasMargin(), and setLegendPosition().

QwtPlotLayout::~QwtPlotLayout | ( |  | ) | `[virtual]`

| Destructor. Definition at line 79 of file qwt_plot_layout.cpp.

## Member Function Documentation

void QwtPlotLayout::activate | ( | const QwtPlot * | plot,
|  | const QRect & | plotRect,
|  | int | options = `0`
| ) | `[virtual]`

  | Recalculate the geometry of all components. Parameters:
  | plot | Plot to be layout
  | plotRect | Rect where to place the components
  | options | Options
See also: QwtPlotLayout::invalidate(), QwtPlotLayout::titleRect(), QwtPlotLayout::legendRect(), QwtPlotLayout::scaleRect(), QwtPlotLayout::canvasRect() Definition at line 910 of file qwt_plot_layout.cpp. References alignLegend(), alignScales(), expandLineBreaks(), invalidate(), QwtLegend::isEmpty(), layoutLegend(), QwtPlot::legend(), and scaleRect(). Referenced by QwtPlot::print(), and QwtPlot::updateLayout().

bool QwtPlotLayout::alignCanvasToScales | ( |  | ) | 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. Returns: align-canvas-to-axis-scales setting See also: QwtPlotLayout::setAlignCanvasToScales, QwtPlotLayout::setCanvasMargin() Note: In this context the term 'scale' means the backbone of a scale. Definition at line 180 of file qwt_plot_layout.cpp.

QRect QwtPlotLayout::alignLegend | ( | const QRect & | canvasRect,
|  | const QRect & | legendRect
| ) | const`[protected]`

  | Align the legend to the canvas Parameters:
  | canvasRect | Geometry of the canvas
  | legendRect | Maximum geometry for the legend
Returns: Geometry for the aligned legend Definition at line 630 of file qwt_plot_layout.cpp. Referenced by activate().

void QwtPlotLayout::alignScales | ( | int | options,
|  | QRect & | canvasRect,
|  | QRect | scaleRect[QwtPlot::axisCnt]
| ) | const`[protected]`

| Align the ticks of the axis to the canvas borders using the empty corners. Definition at line 773 of file qwt_plot_layout.cpp. References scaleRect(). Referenced by activate().

int QwtPlotLayout::canvasMargin | ( | int | axis | ) | const

| Returns: Margin around the scale tick borders See also: QwtPlotLayout::setCanvasMargin() Definition at line 143 of file qwt_plot_layout.cpp. Referenced by QwtPlot::canvasMap(), and QwtPlot::print().

const QRect & QwtPlotLayout::canvasRect | ( |  | ) | const

| Returns: Geometry for the canvas See also: QwtPlotLayout::activate(), QwtPlotLayout::invalidate() Definition at line 374 of file qwt_plot_layout.cpp. Referenced by QwtPlot::print(), and QwtPlot::updateLayout().

void QwtPlotLayout::expandLineBreaks | ( | int | options,
|  | const QRect & | rect,
|  | int & | dimTitle,
|  | 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:
  | options | Options how to layout the legend
  | rect | Bounding rect for title, axes and canvas.
  | dimTitle | Expanded height of the title widget
  | dimAxis | Expanded heights of the axis in axis orientation.
Definition at line 664 of file qwt_plot_layout.cpp. Referenced by activate().

void QwtPlotLayout::invalidate | ( |  | ) | `[virtual]`

| Invalidate the geometry of all components. See also: QwtPlotLayout::activate() Definition at line 383 of file qwt_plot_layout.cpp. Referenced by activate(), QwtPlot::print(), and QwtPlotLayout().

QRect QwtPlotLayout::layoutLegend | ( | int | options,
|  | const QRect & | rect
| ) | const`[protected]`

  | Find the geometry for the legend Parameters:
  | options | Options how to layout the legend
  | rect | Rectangle where to place the legend
Returns: Geometry for the legend Definition at line 572 of file qwt_plot_layout.cpp. References legendRect(). Referenced by activate().

int QwtPlotLayout::legendPos | ( |  | ) | const

| Returns: Position of the legend See also: QwtPlotLayout::setLegendPosition(), QwtPlot::setLegendPosition(), QwtPlot::legendPosition() Warning: This function is deprecated. Use QwtPlotLayout::setLegendPosition(). Definition at line 300 of file qwt_plot_layout.cpp.

QwtPlot::Position QwtPlotLayout::legendPosition | ( |  | ) | const

| Returns: Position of the legend See also: QwtPlotLayout::setLegendPosition(), QwtPlot::setLegendPosition(), QwtPlot::legendPosition() Definition at line 266 of file qwt_plot_layout.cpp. Referenced by QwtPlot::legendPos(), QwtPlot::legendPosition(), QwtPlot::setLegendPosition(), setLegendRatio(), and QwtPlot::updateTabOrder().

double QwtPlotLayout::legendRatio | ( |  | ) | const

| Returns: The relative size of the legend in the plot. See also: QwtPlotLayout::setLegendPos(), QwtPlot::setLegendPos() Definition at line 328 of file qwt_plot_layout.cpp.

const QRect & QwtPlotLayout::legendRect | ( |  | ) | const

| Returns: Geometry for the legend See also: QwtPlotLayout::activate(), QwtPlotLayout::invalidate() Definition at line 348 of file qwt_plot_layout.cpp. Referenced by layoutLegend(), QwtPlot::print(), and QwtPlot::updateLayout().

int QwtPlotLayout::margin | ( |  | ) | const

| Returns: margin See also: QwtPlotLayout::setMargin(), QwtPlotLayout::spacing(), QwtPlot::margin() Definition at line 106 of file qwt_plot_layout.cpp. Referenced by QwtPlot::margin(), and QwtPlot::setMargin().

QSize QwtPlotLayout::minimumSizeHint | ( | const QwtPlot * | plot | ) | const`[virtual]`

| Return a minimum size hint. See also: QwtPlot::minimumSizeHint() Definition at line 395 of file qwt_plot_layout.cpp. References QwtPlot::axis(), QwtScale::baseLineDist(), QwtPlot::canvas(), QwtLegend::heightForWidth(), QwtLegend::isEmpty(), QwtPlot::legend(), QwtScaleDraw::majTickLength(), QwtScale::minBorderDist(), QwtScale::minimumSizeHint(), QwtScale::scaleDraw(), QwtLegend::sizeHint(), and QwtPlot::titleLabel(). Referenced by QwtPlot::minimumSizeHint().

const QRect & QwtPlotLayout::scaleRect | ( | int | axis | ) | const

  | Parameters:
  | axis | Axis index
Returns: Geometry for the scale See also: QwtPlotLayout::activate(), QwtPlotLayout::invalidate() Definition at line 359 of file qwt_plot_layout.cpp. Referenced by activate(), alignScales(), QwtPlot::print(), and QwtPlot::updateLayout().

void QwtPlotLayout::setAlignCanvasToScales | ( | bool | alignCanvasToScales | ) |

  | 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. Parameters:
  | alignCanvasToScales | New align-canvas-to-axis-scales setting
See also: QwtPlotLayout::alignCanvasToTicks, QwtPlotLayout::setCanvasMargin() Note: In this context the term 'scale' means the backbone of a scale. Warning: In case of alignCanvasToScales == TRUE canvasMargin will have no effect Definition at line 165 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:
  | margin | New margin
  | axis | One of QwtPlot::Axis. Specifies where the position of the margin. -1 means margin at all borders.
See also: QwtPlotLayout::canvasMargin() Warning: The canvas will have no effect when alignCanvasToScales is TRUE Definition at line 124 of file qwt_plot_layout.cpp. Referenced by QwtPlotLayout().

void QwtPlotLayout::setLegendPos | ( | int | pos,
|  | double | ratio = `0.0`
| ) |

  | Specify the position of the legend. Parameters:
  | pos | The legend's position. Valid values are `Qwt::Left`, `Qwt::Right`, `Qwt::Top`, `QwtBottom`.
  | ratio | Ratio between legend and the bounding rect of title, canvas and axes. The legend will be shrinked 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() Warning: This function is deprecated. Use QwtPlotLayout::setLegendPosition(). Definition at line 288 of file qwt_plot_layout.cpp. References setLegendPosition().

void QwtPlotLayout::setLegendPosition | ( | QwtPlot::Position | pos | ) |

  | Specify the position of the legend. Parameters:
  | pos | The legend's position. Valid values are `QwtPlot::Left`, `QwtPlot::Right`, `QwtPlot::Top`, `QwtPlot::Bottom`.
See also: QwtPlot::setLegendPosition() Definition at line 255 of file qwt_plot_layout.cpp. References setLegendPosition().

void QwtPlotLayout::setLegendPosition | ( | QwtPlot::Position | pos,
|  | double | ratio
| ) |

  | Specify the position of the legend. Parameters:
  | pos | The legend's position. Valid values are `QwtPlot::Left`, `QwtPlot::Right`, `QwtPlot::Top`, `QwtPlot::Bottom`.
  | ratio | Ratio between legend and the bounding rect of title, canvas and axes. The legend will be shrinked 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 221 of file qwt_plot_layout.cpp. Referenced by QwtPlotLayout(), setLegendPos(), setLegendPosition(), QwtPlot::setLegendPosition(), and setLegendRatio().

void QwtPlotLayout::setLegendRatio | ( | double | ratio | ) |

  | Specify the relative size of the legend in the plot Parameters:
  | ratio | Ratio between legend and the bounding rect of title, canvas and axes. The legend will be shrinked 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 318 of file qwt_plot_layout.cpp. References legendPosition(), and setLegendPosition().

void QwtPlotLayout::setMargin | ( | int | margin | ) |

  | Change the margin of the plot. The margin is the space around all components. Parameters:
  | margin | new margin
See also: QwtPlotLayout::margin(), QwtPlotLayout::setSpacing(), QwtPlot::setMargin() Definition at line 93 of file qwt_plot_layout.cpp. Referenced by QwtPlot::setMargin().

void QwtPlotLayout::setSpacing | ( | int | spacing | ) |

  | Change the spacing of the plot. The spacing is the distance between the plot components. Parameters:
  | spacing | new spacing
See also: QwtPlotLayout::setMargin(), QwtPlotLayout::spacing() Definition at line 193 of file qwt_plot_layout.cpp.

int QwtPlotLayout::spacing | ( |  | ) | const

| Returns: spacing See also: QwtPlotLayout::margin(), QwtPlotLayout::setSpacing() Definition at line 202 of file qwt_plot_layout.cpp.

const QRect & QwtPlotLayout::titleRect | ( |  | ) | const

| Returns: Geometry for the title See also: QwtPlotLayout::activate(), QwtPlotLayout::invalidate() Definition at line 338 of file qwt_plot_layout.cpp. Referenced by QwtPlot::print(), and QwtPlot::updateLayout().