Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_plot_canvas.h
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_plot_canvas.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_plot_canvas.h
r9383 r11158 1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*-*****************************1 /****************************************************************************** 2 2 * Qwt Widget Library 3 3 * Copyright (C) 1997 Josef Wilgen … … 12 12 13 13 #include "qwt_global.h" 14 #include "qwt_plot_abstract_canvas.h" 15 14 16 #include <qframe.h> 15 #include <qpainterpath.h>16 17 17 18 class QwtPlot; 18 19 class QPixmap; 20 class QPainterPath; 19 21 20 22 /*! 21 \brief Canvas of a QwtPlot. 23 \brief Canvas of a QwtPlot. 22 24 23 25 Canvas is the widget where all plot items are displayed 24 26 25 \sa QwtPlot::setCanvas(), QwtPlotGLCanvas 26 */ 27 class QWT_EXPORT QwtPlotCanvas : public QFrame 27 \sa QwtPlot::setCanvas(), QwtPlotGLCanvas, QwtPlotOpenGLCanvas 28 */ 29 class QWT_EXPORT QwtPlotCanvas : public QFrame, public QwtPlotAbstractCanvas 28 30 { 29 31 Q_OBJECT … … 31 33 Q_PROPERTY( double borderRadius READ borderRadius WRITE setBorderRadius ) 32 34 33 public: 35 public: 34 36 35 37 /*! 36 \brief Paint attributes 38 \brief Paint attributes 37 39 38 The default setting enables BackingStore and Opaque. 40 The default setting enables BackingStore and Opaque. 39 41 40 \sa setPaintAttribute(), testPaintAttribute() 42 \sa setPaintAttribute(), testPaintAttribute() 41 43 */ 42 44 enum PaintAttribute 43 45 { 44 46 /*! 45 \brief Paint double buffered reusing the content 47 \brief Paint double buffered reusing the content 46 48 of the pixmap buffer when possible. 47 49 48 Using a backing store might improve the performance 49 significantly, when working with widget overlays ( like rubber bands ). 50 Disabling the cache might improve the performance for 51 incremental paints (using QwtPlotDirectPainter ). 50 Using a backing store might improve the performance 51 significantly, when working with widget overlays ( like rubber bands ). 52 Disabling the cache might improve the performance for 53 incremental paints (using QwtPlotDirectPainter ). 52 54 53 \sa backingStore(), invalidateBackingStore() 55 \sa backingStore(), invalidateBackingStore() 54 56 */ 55 57 BackingStore = 1, 56 58 57 59 /*! 58 \brief Try to fill the complete contents rectangle 60 \brief Try to fill the complete contents rectangle 59 61 of the plot canvas 60 62 61 When using styled backgrounds Qt assumes, that the 62 canvas doesn't fill its area completely 63 ( f.e because of rounded borders ) and fills the area 64 below the canvas. When this is done with gradients it might 65 result in a serious performance bottleneck - depending on the size. 63 When using styled backgrounds Qt assumes, that the 64 canvas doesn't fill its area completely 65 ( f.e because of rounded borders ) and fills the area 66 below the canvas. When this is done with gradients it might 67 result in a serious performance bottleneck - depending on the size. 66 68 67 When the Opaque attribute is enabled the canvas tries to 68 identify the gaps with some heuristics and to fill those only. 69 When the Opaque attribute is enabled the canvas tries to 70 identify the gaps with some heuristics and to fill those only. 69 71 70 \warning Will not work for semitransparent backgrounds 72 \warning Will not work for semitransparent backgrounds 71 73 */ 72 74 Opaque = 2, 73 75 74 76 /*! 75 \brief Try to improve painting of styled backgrounds 77 \brief Try to improve painting of styled backgrounds 76 78 77 QwtPlotCanvas supports the box model attributes for 78 customizing the layout with style sheets. Unfortunately 79 the design of Qt style sheets has no concept how to 80 handle backgrounds with rounded corners - beside of padding. 79 QwtPlotCanvas supports the box model attributes for 80 customizing the layout with style sheets. Unfortunately 81 the design of Qt style sheets has no concept how to 82 handle backgrounds with rounded corners - beside of padding. 81 83 82 When HackStyledBackground is enabled the plot canvas tries 83 to separate the background from the background border 84 by reverse engineering to paint the background before and 85 the border after the plot items. In this order the border 86 gets perfectly antialiased and you can avoid some pixel 87 artifacts in the corners. 84 When HackStyledBackground is enabled the plot canvas tries 85 to separate the background from the background border 86 by reverse engineering to paint the background before and 87 the border after the plot items. In this order the border 88 gets perfectly antialiased and you can avoid some pixel 89 artifacts in the corners. 88 90 */ 89 91 HackStyledBackground = 4, 90 92 91 93 /*! 92 When ImmediatePaint is set replot() calls repaint() 93 instead of update(). 94 When ImmediatePaint is set replot() calls repaint() 95 instead of update(). 94 96 95 \sa replot(), QWidget::repaint(), QWidget::update() 97 \sa replot(), QWidget::repaint(), QWidget::update() 96 98 */ 97 99 ImmediatePaint = 8 98 100 }; 99 101 100 //! Paint attributes 101 typedef QFlags<PaintAttribute> PaintAttributes; 102 Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute ) 102 103 103 /*! 104 \brief Focus indicator 105 The default setting is NoFocusIndicator 106 \sa setFocusIndicator(), focusIndicator(), drawFocusIndicator() 107 */ 108 109 enum FocusIndicator 110 { 111 //! Don't paint a focus indicator 112 NoFocusIndicator, 113 114 /*! 115 The focus is related to the complete canvas. 116 Paint the focus indicator using drawFocusIndicator() 117 */ 118 CanvasFocusIndicator, 119 120 /*! 121 The focus is related to an item (curve, point, ...) on 122 the canvas. It is up to the application to display a 123 focus indication using f.e. highlighting. 124 */ 125 ItemFocusIndicator 126 }; 127 128 explicit QwtPlotCanvas( QwtPlot * = NULL ); 104 explicit QwtPlotCanvas( QwtPlot* = NULL ); 129 105 virtual ~QwtPlotCanvas(); 130 131 QwtPlot *plot();132 const QwtPlot *plot() const;133 134 void setFocusIndicator( FocusIndicator );135 FocusIndicator focusIndicator() const;136 137 void setBorderRadius( double );138 double borderRadius() const;139 106 140 107 void setPaintAttribute( PaintAttribute, bool on = true ); 141 108 bool testPaintAttribute( PaintAttribute ) const; 142 109 143 const QPixmap *backingStore() const;144 void invalidateBackingStore(); 110 const QPixmap* backingStore() const; 111 Q_INVOKABLE void invalidateBackingStore(); 145 112 146 virtual bool event( QEvent * );113 virtual bool event( QEvent* ) QWT_OVERRIDE; 147 114 148 Q_INVOKABLE QPainterPath borderPath( const QRect & ) const;115 Q_INVOKABLE QPainterPath borderPath( const QRect& ) const; 149 116 150 public Q_SLOTS: 117 public Q_SLOTS: 151 118 void replot(); 152 119 153 protected: 154 virtual void paintEvent( QPaintEvent * );155 virtual void resizeEvent( QResizeEvent * );120 protected: 121 virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE; 122 virtual void resizeEvent( QResizeEvent* ) QWT_OVERRIDE; 156 123 157 virtual void drawFocusIndicator( QPainter * ); 158 virtual void drawBorder( QPainter * ); 124 virtual void drawBorder( QPainter* ) QWT_OVERRIDE; 159 125 160 void updateStyleSheetInfo(); 161 162 private: 163 void drawCanvas( QPainter *, bool withBackground ); 164 126 private: 165 127 class PrivateData; 166 PrivateData *d_data;128 PrivateData* m_data; 167 129 }; 168 130
Note:
See TracChangeset
for help on using the changeset viewer.
