Organizes the geometry for the different QwtPlot components.
Definition at line 22 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::LegendPosition pos, double ratio) |
void | setLegendPosition (QwtPlot::LegendPosition pos) |
QwtPlot::LegendPosition | legendPosition () const |
void | setLegendRatio (double ratio) |
double | legendRatio () 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 |
Definition at line 25 of file qwt_plot_layout.h.
QwtPlotLayout::QwtPlotLayout | ( | ) | [explicit] |
Constructor.
Definition at line 183 of file qwt_plot_layout.cpp.
References QwtPlot::BottomLegend, invalidate(), setCanvasMargin(), and setLegendPosition().
QwtPlotLayout::~QwtPlotLayout | ( | ) | [virtual] |
void QwtPlotLayout::setMargin | ( | int | margin | ) |
Change the margin of the plot. The margin is the space around all components.
margin | new margin |
Definition at line 207 of file qwt_plot_layout.cpp.
int QwtPlotLayout::margin | ( | ) | const |
Definition at line 218 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.
margin | New margin | |
axis | One of QwtPlot::Axis. Specifies where the position of the margin. -1 means margin at all borders. |
Definition at line 236 of file qwt_plot_layout.cpp.
Referenced by QwtPlotLayout().
int QwtPlotLayout::canvasMargin | ( | int | axis | ) | const |
Definition at line 254 of file qwt_plot_layout.cpp.
Referenced by QwtPlot::canvasMap(), and QwtPlot::print().
void QwtPlotLayout::setAlignCanvasToScales | ( | bool | alignCanvasToScales | ) |
Change the align-canvas-to-axis-scales setting. The canvas may:
alignCanvasToScales | New align-canvas-to-axis-scales setting |
Definition at line 274 of file qwt_plot_layout.cpp.
bool QwtPlotLayout::alignCanvasToScales | ( | ) | const |
Return the align-canvas-to-axis-scales setting. The canvas may:
Definition at line 288 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.
spacing | new spacing |
Definition at line 300 of file qwt_plot_layout.cpp.
int QwtPlotLayout::spacing | ( | ) | const |
void QwtPlotLayout::setLegendPosition | ( | QwtPlot::LegendPosition | pos, | |
double | ratio | |||
) |
Specify the position of the legend.
pos | The legend's position. | |
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. |
Definition at line 327 of file qwt_plot_layout.cpp.
References QwtPlot::BottomLegend, QwtPlot::ExternalLegend, QwtPlot::LeftLegend, QwtPlot::RightLegend, and QwtPlot::TopLegend.
Referenced by QwtPlotLayout(), setLegendPosition(), and setLegendRatio().
void QwtPlotLayout::setLegendPosition | ( | QwtPlot::LegendPosition | pos | ) |
Specify the position of the legend.
pos | The legend's position. Valid values are QwtPlot::LeftLegend , QwtPlot::RightLegend , QwtPlot::TopLegend , QwtPlot::BottomLegend . |
Definition at line 364 of file qwt_plot_layout.cpp.
References setLegendPosition().
QwtPlot::LegendPosition QwtPlotLayout::legendPosition | ( | ) | const |
Definition at line 374 of file qwt_plot_layout.cpp.
Referenced by setLegendRatio().
void QwtPlotLayout::setLegendRatio | ( | double | ratio | ) |
Specify the relative size of the legend in the plot
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. |
Definition at line 388 of file qwt_plot_layout.cpp.
References legendPosition(), and setLegendPosition().
double QwtPlotLayout::legendRatio | ( | ) | const |
Definition at line 397 of file qwt_plot_layout.cpp.
QSize QwtPlotLayout::minimumSizeHint | ( | const QwtPlot * | plot | ) | const [virtual] |
Return a minimum size hint.
Definition at line 464 of file qwt_plot_layout.cpp.
References QwtPlot::axisEnabled(), QwtPlot::axisWidget(), QwtPlot::canvas(), QwtScaleWidget::minimumSizeHint(), QwtAbstractScaleDraw::Ticks, QwtPlot::xBottom, QwtPlot::xTop, QwtPlot::yLeft, and QwtPlot::yRight.
void QwtPlotLayout::activate | ( | const QwtPlot * | plot, | |
const QRect & | plotRect, | |||
int | options = 0 | |||
) | [virtual] |
Recalculate the geometry of all components.
plot | Plot to be layout | |
plotRect | Rect where to place the components | |
options | Options |
Definition at line 1023 of file qwt_plot_layout.cpp.
References alignLegend(), alignScales(), QwtPlot::BottomLegend, expandLineBreaks(), QwtPlot::ExternalLegend, IgnoreFrames, IgnoreLegend, IgnoreMargin, invalidate(), QwtLegend::isEmpty(), layoutLegend(), QwtPlot::LeftLegend, QwtPlot::legend(), QwtPlot::RightLegend, scaleRect(), QwtPlot::TopLegend, QwtPlot::xTop, and QwtPlot::yLeft.
void QwtPlotLayout::invalidate | ( | ) | [virtual] |
Invalidate the geometry of all components.
Definition at line 452 of file qwt_plot_layout.cpp.
Referenced by activate(), and QwtPlotLayout().
const QRect & QwtPlotLayout::titleRect | ( | ) | const |
Definition at line 407 of file qwt_plot_layout.cpp.
const QRect & QwtPlotLayout::legendRect | ( | ) | const |
Definition at line 417 of file qwt_plot_layout.cpp.
Referenced by layoutLegend().
const QRect & QwtPlotLayout::scaleRect | ( | int | axis | ) | const |
axis | Axis index |
Definition at line 428 of file qwt_plot_layout.cpp.
Referenced by activate(), alignScales(), and QwtPlot::print().
const QRect & QwtPlotLayout::canvasRect | ( | ) | const |
Definition at line 443 of file qwt_plot_layout.cpp.
Referenced by QwtPlot::print().
QRect QwtPlotLayout::layoutLegend | ( | int | options, | |
const QRect & | rect | |||
) | const [protected] |
Find the geometry for the legend
options | Options how to layout the legend | |
rect | Rectangle where to place the legend |
Definition at line 648 of file qwt_plot_layout.cpp.
References QwtPlot::BottomLegend, QwtPlot::ExternalLegend, IgnoreScrollbars, QwtPlot::LeftLegend, legendRect(), QwtPlot::RightLegend, and QwtPlot::TopLegend.
Referenced by activate().
QRect QwtPlotLayout::alignLegend | ( | const QRect & | canvasRect, | |
const QRect & | legendRect | |||
) | const [protected] |
Align the legend to the canvas
canvasRect | Geometry of the canvas | |
legendRect | Maximum geometry for the legend |
Definition at line 709 of file qwt_plot_layout.cpp.
References QwtPlot::BottomLegend, and QwtPlot::TopLegend.
Referenced by activate().
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.
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 744 of file qwt_plot_layout.cpp.
References IgnoreFrames, QwtPlot::xTop, and QwtPlot::yLeft.
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 850 of file qwt_plot_layout.cpp.
References IgnoreFrames, scaleRect(), QwtPlot::xTop, and QwtPlot::yLeft.
Referenced by activate().