Changeset 8127 in ntrip for trunk/BNC/qwt/qwt_plot.h
- Timestamp:
- May 10, 2017, 3:20:54 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_plot.h
r4271 r8127 17 17 #include "qwt_interval.h" 18 18 #include <qframe.h> 19 #include <qlist.h> 20 #include <qvariant.h> 19 21 20 22 class QwtPlotLayout; 21 class Qwt Legend;23 class QwtAbstractLegend; 22 24 class QwtScaleWidget; 23 25 class QwtScaleEngine; … … 25 27 class QwtScaleDraw; 26 28 class QwtTextLabel; 27 class QwtPlotCanvas;28 29 29 30 /*! … … 36 37 from QwtPlotItem. 37 38 A plot can have up to four axes, with each plot item attached to an x- and 38 a y axis. The scales at the axes can be explicit ely set (QwtScaleDiv), or39 a y axis. The scales at the axes can be explicitly set (QwtScaleDiv), or 39 40 are calculated from the plot items, using algorithms (QwtScaleEngine) which 40 41 can be configured separately for each axis. 42 43 The simpleplot example is a good starting point to see how to set up a 44 plot widget. 41 45 42 46 \image html plot.png … … 56 60 QwtPlotCurve *curve2 = new QwtPlotCurve("Curve 2"); 57 61 58 // co py the data into the curves62 // connect or copy the data to the curves 59 63 curve1->setData(...); 60 64 curve2->setData(...); … … 71 75 { 72 76 Q_OBJECT 77 78 Q_PROPERTY( QBrush canvasBackground 79 READ canvasBackground WRITE setCanvasBackground ) 80 Q_PROPERTY( bool autoReplot READ autoReplot WRITE setAutoReplot ) 81 82 #if 0 83 // This property is intended to configure the plot 84 // widget from a special dialog in the deigner plugin. 85 // Disabled until such a dialog has been implemented. 86 73 87 Q_PROPERTY( QString propertiesDocument 74 88 READ grabProperties WRITE applyProperties ) 89 #endif 75 90 76 91 public: … … 98 113 99 114 \sa insertLegend() 100 \note In case of ExternalLegend, the legend is not101 handled by QwtPlotRenderer102 115 */ 103 116 enum LegendPosition … … 109 122 RightLegend, 110 123 111 //! The legend will be below QwtPlot::xBottom axis.124 //! The legend will be below the footer 112 125 BottomLegend, 113 126 114 //! The legend will be between QwtPlot::xTop axis and the title. 115 TopLegend, 116 117 /*! 118 External means that only the content of the legend 119 will be handled by QwtPlot, but not its geometry. 120 This type can be used to have a legend in an 121 external window ( or on the canvas ). 122 */ 123 ExternalLegend 127 //! The legend will be above the title 128 TopLegend 124 129 }; 125 130 126 131 explicit QwtPlot( QWidget * = NULL ); 127 explicit QwtPlot( const QwtText &title, QWidget * p= NULL );132 explicit QwtPlot( const QwtText &title, QWidget * = NULL ); 128 133 129 134 virtual ~QwtPlot(); … … 132 137 QString grabProperties() const; 133 138 134 void setAutoReplot( bool tf= true );139 void setAutoReplot( bool = true ); 135 140 bool autoReplot() const; 136 141 137 142 // Layout 143 144 void setPlotLayout( QwtPlotLayout * ); 138 145 139 146 QwtPlotLayout *plotLayout(); … … 149 156 const QwtTextLabel *titleLabel() const; 150 157 158 // Footer 159 160 void setFooter( const QString & ); 161 void setFooter( const QwtText &t ); 162 QwtText footer() const; 163 164 QwtTextLabel *footerLabel(); 165 const QwtTextLabel *footerLabel() const; 166 151 167 // Canvas 152 168 153 QwtPlotCanvas *canvas(); 154 const QwtPlotCanvas *canvas() const; 169 void setCanvas( QWidget * ); 170 171 QWidget *canvas(); 172 const QWidget *canvas() const; 155 173 156 174 void setCanvasBackground( const QBrush & ); 157 175 QBrush canvasBackground() const; 158 159 void setCanvasLineWidth( int w );160 int canvasLineWidth() const;161 176 162 177 virtual QwtScaleMap canvasMap( int axisId ) const; … … 187 202 QwtInterval axisInterval( int axisId ) const; 188 203 189 const QwtScaleDiv *axisScaleDiv( int axisId ) const; 190 QwtScaleDiv *axisScaleDiv( int axisId ); 204 const QwtScaleDiv &axisScaleDiv( int axisId ) const; 191 205 192 206 const QwtScaleDraw *axisScaleDraw( int axisId ) const; … … 211 225 // Legend 212 226 213 void insertLegend( QwtLegend *, LegendPosition = QwtPlot::RightLegend, 214 double ratio = -1.0 ); 215 216 QwtLegend *legend(); 217 const QwtLegend *legend() const; 227 void insertLegend( QwtAbstractLegend *, 228 LegendPosition = QwtPlot::RightLegend, double ratio = -1.0 ); 229 230 QwtAbstractLegend *legend(); 231 const QwtAbstractLegend *legend() const; 232 233 void updateLegend(); 234 void updateLegend( const QwtPlotItem * ); 218 235 219 236 // Misc … … 226 243 227 244 void updateAxes(); 245 void updateCanvasMargins(); 246 247 virtual void getCanvasMarginsHint( 248 const QwtScaleMap maps[], const QRectF &canvasRect, 249 double &left, double &top, double &right, double &bottom) const; 228 250 229 251 virtual bool event( QEvent * ); 252 virtual bool eventFilter( QObject *, QEvent * ); 230 253 231 254 virtual void drawItems( QPainter *, const QRectF &, 232 255 const QwtScaleMap maps[axisCnt] ) const; 233 256 257 virtual QVariant itemToInfo( QwtPlotItem * ) const; 258 virtual QwtPlotItem *infoToItem( const QVariant & ) const; 259 234 260 Q_SIGNALS: 235 261 /*! 236 A signal which is emitted when the user has clicked on 237 a legend item, which is in QwtLegend::ClickableItem mode. 238 239 \param plotItem Corresponding plot item of the 240 selected legend item 241 242 \note clicks are disabled as default 243 \sa QwtLegend::setItemMode(), QwtLegend::itemMode() 262 A signal indicating, that an item has been attached/detached 263 264 \param plotItem Plot item 265 \param on Attached/Detached 244 266 */ 245 void legendClicked( QwtPlotItem *plotItem);267 void itemAttached( QwtPlotItem *plotItem, bool on ); 246 268 247 269 /*! 248 A signal which is emitted when the user has clicked on 249 a legend item, which is in QwtLegend::CheckableItem mode 250 251 \param plotItem Corresponding plot item of the 252 selected legend item 253 \param on True when the legen item is checked 254 255 \note clicks are disabled as default 256 \sa QwtLegend::setItemMode(), QwtLegend::itemMode() 270 A signal with the attributes how to update 271 the legend entries for a plot item. 272 273 \param itemInfo Info about a plot item, build from itemToInfo() 274 \param data Attributes of the entries ( usually <= 1 ) for 275 the plot item. 276 277 \sa itemToInfo(), infoToItem(), QwtAbstractLegend::updateLegend() 257 278 */ 258 259 void legendChecked( QwtPlotItem *plotItem, bool on);279 void legendDataChanged( const QVariant &itemInfo, 280 const QList<QwtLegendData> &data ); 260 281 261 282 public Q_SLOTS: … … 263 284 void autoRefresh(); 264 285 265 protected Q_SLOTS:266 virtual void legendItemClicked();267 virtual void legendItemChecked( bool );268 269 286 protected: 270 287 static bool axisValid( int axisId ); 271 288 272 virtual void updateTabOrder();273 274 289 virtual void resizeEvent( QResizeEvent *e ); 275 290 291 private Q_SLOTS: 292 void updateLegendItems( const QVariant &itemInfo, 293 const QList<QwtLegendData> &data ); 294 276 295 private: 296 friend class QwtPlotItem; 297 void attachItem( QwtPlotItem *, bool ); 298 277 299 void initAxesData(); 278 300 void deleteAxesData();
Note:
See TracChangeset
for help on using the changeset viewer.