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< Option > | Options |
Layout options. | |
Public Member Functions | |
virtual void | activate (const QwtPlot *, const QRectF &rect, Options options=0x00) |
Recalculate the geometry of all components. | |
bool | alignCanvasToScale (int axisId) const |
int | canvasMargin (int axis) 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. | |
QRectF | scaleRect (int axis) const |
void | setAlignCanvasToScale (int axisId, bool) |
void | setAlignCanvasToScales (bool) |
Set the align-canvas-to-axis-scales flag for all axes. | |
void | setCanvasMargin (int margin, int axis=-1) |
void | setLegendPosition (QwtPlot::LegendPosition pos, double ratio) |
Specify the position of the legend. | |
void | setLegendPosition (QwtPlot::LegendPosition pos) |
Specify the position of the legend. | |
void | setLegendRatio (double ratio) |
void | setSpacing (int) |
int | spacing () const |
QRectF | titleRect () const |
virtual | ~QwtPlotLayout () |
Destructor. | |
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. | |
void | setFooterRect (const QRectF &) |
Set the geometry for the footer. | |
void | setLegendRect (const QRectF &) |
Set the geometry for the legend. | |
void | setScaleRect (int axis, const QRectF &) |
Set the geometry for an axis. | |
void | setTitleRect (const QRectF &) |
Set the geometry for the title. | |
Private Attributes | |
PrivateData * | d_data |
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.
Definition at line 26 of file qwt_plot_layout.h.
typedef QFlags<Option> QwtPlotLayout::Options |
Layout options.
Definition at line 58 of file qwt_plot_layout.h.
Options to configure the plot layout engine
Definition at line 33 of file qwt_plot_layout.h.
QwtPlotLayout::QwtPlotLayout | ( | ) | [explicit] |
Constructor.
Definition at line 200 of file qwt_plot_layout.cpp.
QwtPlotLayout::~QwtPlotLayout | ( | ) | [virtual] |
Destructor.
Definition at line 212 of file qwt_plot_layout.cpp.
void QwtPlotLayout::activate | ( | const QwtPlot * | plot, |
const QRectF & | plotRect, | ||
Options | options = 0x00 |
||
) | [virtual] |
Recalculate the geometry of all components.
plot | Plot to be layout |
plotRect | Rectangle where to place the components |
options | Layout options |
Definition at line 1270 of file qwt_plot_layout.cpp.
bool QwtPlotLayout::alignCanvasToScale | ( | int | axisId | ) | const |
Return the align-canvas-to-axis-scales setting. The canvas may:
axisId | Axis index |
Definition at line 301 of file qwt_plot_layout.cpp.
QRectF QwtPlotLayout::alignLegend | ( | const QRectF & | canvasRect, |
const QRectF & | legendRect | ||
) | const [protected] |
Align the legend to the canvas
canvasRect | Geometry of the canvas |
legendRect | Maximum geometry for the legend |
Definition at line 813 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.
options | Layout options |
canvasRect | Geometry of the canvas ( IN/OUT ) |
scaleRect | Geometries of the scales ( IN/OUT ) |
Definition at line 1007 of file qwt_plot_layout.cpp.
int QwtPlotLayout::canvasMargin | ( | int | axisId | ) | const |
axisId | Axis index |
Definition at line 249 of file qwt_plot_layout.cpp.
QRectF QwtPlotLayout::canvasRect | ( | ) | const |
Definition at line 532 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.
options | Options how to layout the legend |
rect | Bounding rectangle for title, footer, axes and canvas. |
dimTitle | Expanded height of the title widget |
dimFooter | Expanded height of the footer widget |
dimAxis | Expanded heights of the axis in axis orientation. |
Definition at line 851 of file qwt_plot_layout.cpp.
QRectF QwtPlotLayout::footerRect | ( | ) | const |
Definition at line 454 of file qwt_plot_layout.cpp.
void QwtPlotLayout::invalidate | ( | ) | [virtual] |
Invalidate the geometry of all components.
Definition at line 541 of file qwt_plot_layout.cpp.
QRectF QwtPlotLayout::layoutLegend | ( | Options | options, |
const QRectF & | 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 752 of file qwt_plot_layout.cpp.
Definition at line 387 of file qwt_plot_layout.cpp.
double QwtPlotLayout::legendRatio | ( | ) | const |
Definition at line 410 of file qwt_plot_layout.cpp.
QRectF QwtPlotLayout::legendRect | ( | ) | const |
Definition at line 478 of file qwt_plot_layout.cpp.
QSize QwtPlotLayout::minimumSizeHint | ( | const QwtPlot * | plot | ) | const [virtual] |
plot | Plot widget |
Definition at line 557 of file qwt_plot_layout.cpp.
QRectF QwtPlotLayout::scaleRect | ( | int | axis | ) | const |
axis | Axis index |
Definition at line 505 of file qwt_plot_layout.cpp.
void QwtPlotLayout::setAlignCanvasToScale | ( | int | axisId, |
bool | on | ||
) |
Change the align-canvas-to-axis-scales setting. The canvas may:
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.
axisId | Axis index |
on | New align-canvas-to-axis-scales setting |
Definition at line 286 of file qwt_plot_layout.cpp.
void QwtPlotLayout::setAlignCanvasToScales | ( | bool | on | ) |
Set the align-canvas-to-axis-scales flag for all axes.
on | True/False |
Definition at line 263 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 230 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()
Definition at line 523 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()
Definition at line 445 of file qwt_plot_layout.cpp.
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 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 343 of file qwt_plot_layout.cpp.
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 377 of file qwt_plot_layout.cpp.
void QwtPlotLayout::setLegendRatio | ( | double | ratio | ) |
Specify the relative size of the legend in the plot
ratio | Ratio 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 401 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()
rect | Rectangle for the legend |
Definition at line 469 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()
axis | Axis index |
rect | Rectangle for the scale |
Definition at line 494 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 316 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()
Definition at line 423 of file qwt_plot_layout.cpp.
int QwtPlotLayout::spacing | ( | ) | const |
QRectF QwtPlotLayout::titleRect | ( | ) | const |
Definition at line 432 of file qwt_plot_layout.cpp.
PrivateData* QwtPlotLayout::d_data [private] |
Definition at line 117 of file qwt_plot_layout.h.