Qwt User's Guide  6.1.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Pages
qwt_plot_layout.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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 
10 #ifndef QWT_PLOT_LAYOUT_H
11 #define QWT_PLOT_LAYOUT_H
12 
13 #include "qwt_global.h"
14 #include "qwt_plot.h"
15 
26 class QWT_EXPORT QwtPlotLayout
27 {
28 public:
33  enum Option
34  {
36  AlignScales = 0x01,
37 
42  IgnoreScrollbars = 0x02,
43 
45  IgnoreFrames = 0x04,
46 
48  IgnoreLegend = 0x08,
49 
51  IgnoreTitle = 0x10,
52 
54  IgnoreFooter = 0x20
55  };
56 
58  typedef QFlags<Option> Options;
59 
60  explicit QwtPlotLayout();
61  virtual ~QwtPlotLayout();
62 
63  void setCanvasMargin( int margin, int axis = -1 );
64  int canvasMargin( int axis ) const;
65 
66  void setAlignCanvasToScales( bool );
67 
68  void setAlignCanvasToScale( int axisId, bool );
69  bool alignCanvasToScale( int axisId ) const;
70 
71  void setSpacing( int );
72  int spacing() const;
73 
74  void setLegendPosition( QwtPlot::LegendPosition pos, double ratio );
75  void setLegendPosition( QwtPlot::LegendPosition pos );
76  QwtPlot::LegendPosition legendPosition() const;
77 
78  void setLegendRatio( double ratio );
79  double legendRatio() const;
80 
81  virtual QSize minimumSizeHint( const QwtPlot * ) const;
82 
83  virtual void activate( const QwtPlot *,
84  const QRectF &rect, Options options = 0x00 );
85 
86  virtual void invalidate();
87 
88  QRectF titleRect() const;
89  QRectF footerRect() const;
90  QRectF legendRect() const;
91  QRectF scaleRect( int axis ) const;
92  QRectF canvasRect() const;
93 
94  class LayoutData;
95 
96 protected:
97 
98  void setTitleRect( const QRectF & );
99  void setFooterRect( const QRectF & );
100  void setLegendRect( const QRectF & );
101  void setScaleRect( int axis, const QRectF & );
102  void setCanvasRect( const QRectF & );
103 
104  QRectF layoutLegend( Options options, const QRectF & ) const;
105  QRectF alignLegend( const QRectF &canvasRect,
106  const QRectF &legendRect ) const;
107 
108  void expandLineBreaks( Options options, const QRectF &rect,
109  int &dimTitle, int &dimFooter, int dimAxes[QwtPlot::axisCnt] ) const;
110 
111  void alignScales( Options options, QRectF &canvasRect,
112  QRectF scaleRect[QwtPlot::axisCnt] ) const;
113 
114 private:
115  class PrivateData;
116 
117  PrivateData *d_data;
118 };
119 
120 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotLayout::Options )
121 
122 #endif
Number of axes.
Definition: qwt_plot.h:108
LegendPosition
Definition: qwt_plot.h:116
Layout engine for QwtPlot.
Definition: qwt_plot_layout.h:26
A 2-D plotting widget.
Definition: qwt_plot.h:74
QFlags< Option > Options
Layout options.
Definition: qwt_plot_layout.h:58
Option
Definition: qwt_plot_layout.h:33