QWT 7.0.1
Loading...
Searching...
No Matches
qwt_plot_layout.h
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *
9 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_PLOT_LAYOUT_H
28#define QWT_PLOT_LAYOUT_H
29
30#include "qwt_global.h"
31#include "qwt_plot.h"
32#include "qwt_axis_id.h"
44class QWT_EXPORT QwtPlotLayout
45{
46public:
51 enum Option
52 {
54 AlignScales = 0x01,
55
60 IgnoreScrollbars = 0x02,
61
63 IgnoreFrames = 0x04,
64
66 IgnoreLegend = 0x08,
67
69 IgnoreTitle = 0x10,
70
72 IgnoreFooter = 0x20
73 };
74
75 Q_DECLARE_FLAGS(Options, Option)
76
77 explicit QwtPlotLayout();
78 virtual ~QwtPlotLayout();
79
80 void setCanvasMargin(int margin, int axis = -1);
81 int canvasMargin(int axisId) const;
82
83 void setAlignCanvasToScales(bool);
84
85 void setAlignCanvasToScale(int axisId, bool);
86 bool alignCanvasToScale(int axisId) const;
87
88 void setSpacing(int);
89 int spacing() const;
90
91 void setLegendPosition(QwtPlot::LegendPosition pos, double ratio);
92 void setLegendPosition(QwtPlot::LegendPosition pos);
93 QwtPlot::LegendPosition legendPosition() const;
94
95 void setLegendRatio(double ratio);
96 double legendRatio() const;
97
98 virtual QSize minimumSizeHint(const QwtPlot*) const;
99
100 virtual void activate(const QwtPlot* plot, const QRectF& plotRect, Options options = Options());
101
102 virtual void invalidate();
103
104 QRectF titleRect() const;
105 QRectF footerRect() const;
106 QRectF legendRect() const;
107 QRectF scaleRect(QwtAxisId) const;
108 QRectF canvasRect() const;
109
110protected:
111 void setTitleRect(const QRectF&);
112 void setFooterRect(const QRectF&);
113 void setLegendRect(const QRectF&);
114 void setScaleRect(QwtAxisId, const QRectF&);
115 void setCanvasRect(const QRectF&);
116
117 QwtPlotLayoutEngine* layoutEngine();
118
119 void doActivate(const QwtPlot* plot, const QRectF& plotRect, Options options = Options());
120
121private:
122 Q_DISABLE_COPY(QwtPlotLayout)
123
124 class PrivateData;
125 PrivateData* m_data;
126};
127
128Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotLayout::Options)
129
130#endif
The QwtPlotLayoutEngine class.
Definition qwt_plot_layout_engine.h:21
Layout engine for QwtPlot.
Definition qwt_plot_layout.h:45
Option
Options to configure the plot layout engine.
Definition qwt_plot_layout.h:52
A 2-D plotting widget.
Definition qwt_plot.h:99
LegendPosition
Position of the legend, relative to the canvas.
Definition qwt_plot.h:114