Layout engine for QwtPlot. More...
#include <qwt_plot_layout.h>
Classes | |
class | PrivateData |
Public Types | |
enum | Option { AlignScales = 0x01, IgnoreScrollbars = 0x02, IgnoreFrames = 0x04, IgnoreLegend = 0x08, IgnoreTitle = 0x10, IgnoreFooter = 0x20 } |
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 (QwtAxisId) 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) |
Specify the position of the legend. More... | |
void | setLegendPosition (QwtPlot::LegendPosition pos, double ratio) |
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 | |
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 (QwtAxisId, const QRectF &) |
Set the geometry for an axis. More... | |
void | setTitleRect (const QRectF &) |
Set the geometry for the title. More... | |
Private Attributes | |
PrivateData * | m_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 27 of file qwt_plot_layout.h.
Options to configure the plot layout engine
Definition at line 41 of file qwt_plot_layout.h.
|
explicit |
Constructor.
Definition at line 1036 of file qwt_plot_layout.cpp.
|
virtual |
Destructor.
Definition at line 1048 of file qwt_plot_layout.cpp.
|
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 1508 of file qwt_plot_layout.cpp.
bool QwtPlotLayout::alignCanvasToScale | ( | int | axisPos | ) | const |
Return the align-canvas-to-axis-scales setting. The canvas may:
axisPos | Axis position |
Definition at line 1141 of file qwt_plot_layout.cpp.
int QwtPlotLayout::canvasMargin | ( | int | axisPos | ) | const |
axisPos | Axis position |
Definition at line 1089 of file qwt_plot_layout.cpp.
QRectF QwtPlotLayout::canvasRect | ( | ) | const |
Definition at line 1380 of file qwt_plot_layout.cpp.
QRectF QwtPlotLayout::footerRect | ( | ) | const |
Definition at line 1304 of file qwt_plot_layout.cpp.
|
virtual |
Invalidate the geometry of all components.
Definition at line 1389 of file qwt_plot_layout.cpp.
QwtPlot::LegendPosition QwtPlotLayout::legendPosition | ( | ) | const |
Definition at line 1237 of file qwt_plot_layout.cpp.
double QwtPlotLayout::legendRatio | ( | ) | const |
Definition at line 1260 of file qwt_plot_layout.cpp.
QRectF QwtPlotLayout::legendRect | ( | ) | const |
Definition at line 1328 of file qwt_plot_layout.cpp.
|
virtual |
plot | Plot widget |
Definition at line 1404 of file qwt_plot_layout.cpp.
QRectF QwtPlotLayout::scaleRect | ( | QwtAxisId | axisId | ) | const |
axisId | Axis |
Definition at line 1355 of file qwt_plot_layout.cpp.
void QwtPlotLayout::setAlignCanvasToScale | ( | int | axisPos, |
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 QwtAxis::YLeft is set, the left end of the the x-axes ( QwtAxis::XTop, QwtAxis::XBottom ) is aligned.
axisId | Axis index |
on | New align-canvas-to-axis-scales setting |
Definition at line 1126 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 1103 of file qwt_plot_layout.cpp.
void QwtPlotLayout::setCanvasMargin | ( | int | margin, |
int | axisPos = -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 |
axisPos | One of QwtAxis::Position. Specifies where the position of the margin. -1 means margin at all borders. |
Definition at line 1066 of file qwt_plot_layout.cpp.
|
protected |
Set the geometry for the canvas.
This method is intended to be used from derived layouts overloading activate()
Definition at line 1371 of file qwt_plot_layout.cpp.
|
protected |
Set the geometry for the footer.
This method is intended to be used from derived layouts overloading activate()
Definition at line 1295 of file qwt_plot_layout.cpp.
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 1227 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 1183 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 1251 of file qwt_plot_layout.cpp.
|
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 1319 of file qwt_plot_layout.cpp.
|
protected |
Set the geometry for an axis.
This method is intended to be used from derived layouts overloading activate()
axisId | Axis |
rect | Rectangle for the scale |
Definition at line 1344 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 1156 of file qwt_plot_layout.cpp.
|
protected |
Set the geometry for the title.
This method is intended to be used from derived layouts overloading activate()
Definition at line 1273 of file qwt_plot_layout.cpp.
int QwtPlotLayout::spacing | ( | ) | const |
QRectF QwtPlotLayout::titleRect | ( | ) | const |
Definition at line 1282 of file qwt_plot_layout.cpp.
|
private |
Definition at line 112 of file qwt_plot_layout.h.