Qwt User's Guide
svn
|
#include <qwt_plot_layout.h>
Public Types | |
enum | Option { AlignScales = 0x01, IgnoreScrollbars = 0x02, IgnoreFrames = 0x04, IgnoreLegend = 0x08 } |
typedef QFlags< Option > | Options |
Public Member Functions | |
virtual void | activate (const QwtPlot *, const QRectF &rect, Options options=0x00) |
bool | alignCanvasToScales () const |
int | canvasMargin (int axis) const |
const QRectF & | canvasRect () const |
virtual void | invalidate () |
QwtPlot::LegendPosition | legendPosition () const |
double | legendRatio () const |
const QRectF & | legendRect () const |
virtual QSize | minimumSizeHint (const QwtPlot *) const |
QwtPlotLayout () | |
const QRectF & | scaleRect (int axis) const |
void | setAlignCanvasToScales (bool) |
void | setCanvasMargin (int margin, int axis=-1) |
void | setLegendPosition (QwtPlot::LegendPosition pos, double ratio) |
void | setLegendPosition (QwtPlot::LegendPosition pos) |
void | setLegendRatio (double ratio) |
void | setSpacing (int) |
int | spacing () const |
const QRectF & | titleRect () const |
virtual | ~QwtPlotLayout () |
Protected Member Functions | |
QRectF | alignLegend (const QRectF &canvasRect, const QRectF &legendRect) const |
void | alignScales (int options, QRectF &canvasRect, QRectF scaleRect[QwtPlot::axisCnt]) const |
void | expandLineBreaks (int options, const QRectF &rect, int &dimTitle, int dimAxes[QwtPlot::axisCnt]) const |
QRectF | layoutLegend (Options options, const QRectF &) const |
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.
typedef QFlags<Option> QwtPlotLayout::Options |
Layout options.
Options to configure the plot layout engine
QwtPlotLayout::QwtPlotLayout | ( | ) | [explicit] |
Constructor.
QwtPlotLayout::~QwtPlotLayout | ( | ) | [virtual] |
Destructor.
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 | Rect where to place the components |
options | Layout options |
bool QwtPlotLayout::alignCanvasToScales | ( | ) | const |
Return the align-canvas-to-axis-scales setting. The canvas may:
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 |
void QwtPlotLayout::alignScales | ( | int | options, |
QRectF & | canvasRect, | ||
QRectF | scaleRect[QwtPlot::axisCnt] | ||
) | const [protected] |
Align the ticks of the axis to the canvas borders using the empty corners.
int QwtPlotLayout::canvasMargin | ( | int | axis | ) | const |
const QRectF & QwtPlotLayout::canvasRect | ( | ) | const |
void QwtPlotLayout::expandLineBreaks | ( | int | options, |
const QRectF & | 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. |
void QwtPlotLayout::invalidate | ( | ) | [virtual] |
Invalidate the geometry of all components.
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 |
QwtPlot::LegendPosition QwtPlotLayout::legendPosition | ( | ) | const |
double QwtPlotLayout::legendRatio | ( | ) | const |
const QRectF & QwtPlotLayout::legendRect | ( | ) | const |
QSize QwtPlotLayout::minimumSizeHint | ( | const QwtPlot * | plot | ) | const [virtual] |
Return a minimum size hint.
const QRectF & QwtPlotLayout::scaleRect | ( | int | axis | ) | const |
void QwtPlotLayout::setAlignCanvasToScales | ( | bool | alignCanvasToScales | ) |
Change the align-canvas-to-axis-scales setting. The canvas may:
alignCanvasToScales | New align-canvas-to-axis-scales setting |
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. |
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. |
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 . |
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. |
void QwtPlotLayout::setSpacing | ( | int | spacing | ) |
Change the spacing of the plot. The spacing is the distance between the plot components.
spacing | new spacing |
int QwtPlotLayout::spacing | ( | ) | const |
const QRectF & QwtPlotLayout::titleRect | ( | ) | const |