Changeset 9383 in ntrip for trunk/BNC/qwt/qwt_plot_tradingcurve.cpp
- Timestamp:
- Mar 19, 2021, 9:15:03 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_plot_tradingcurve.cpp
r8127 r9383 135 135 /*! 136 136 Assign a series of samples 137 137 138 138 setSamples() is just a wrapper for setData() without any additional 139 139 value - beside that it is easier to find for the developer. 140 140 141 141 \param data Data 142 142 \warning The item takes ownership of the data object, deleting 143 it when its not used anymore. 143 it when its not used anymore. 144 144 */ 145 145 void QwtPlotTradingCurve::setSamples( … … 147 147 { 148 148 setData( data ); 149 } 149 } 150 150 151 151 /*! … … 177 177 } 178 178 179 /*! 179 /*! 180 180 Build and assign the symbol pen 181 181 182 182 In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it 183 183 non cosmetic ( see QPen::isCosmetic() ). This method has been introduced 184 184 to hide this incompatibility. 185 185 186 186 \param color Pen color 187 187 \param width Pen width 188 188 \param style Pen style 189 189 190 190 \sa pen(), brush() 191 */ 192 void QwtPlotTradingCurve::setSymbolPen( 191 */ 192 void QwtPlotTradingCurve::setSymbolPen( 193 193 const QColor &color, qreal width, Qt::PenStyle style ) 194 { 194 { 195 195 setSymbolPen( QPen( color, width, style ) ); 196 196 } … … 236 236 Direction direction, const QBrush &brush ) 237 237 { 238 if ( direction < 0 || direction >= 2 ) 238 // silencing -Wtautological-constant-out-of-range-compare 239 const int index = static_cast< int >( direction ); 240 if ( index < 0 || index >= 2 ) 239 241 return; 240 242 241 if ( brush != d_data->symbolBrush[ direction] )242 { 243 d_data->symbolBrush[ direction] = brush;243 if ( brush != d_data->symbolBrush[ index ] ) 244 { 245 d_data->symbolBrush[ index ] = brush; 244 246 245 247 legendChanged(); … … 257 259 QBrush QwtPlotTradingCurve::symbolBrush( Direction direction ) const 258 260 { 259 if ( direction < 0 || direction >= 2 ) 261 const int index = static_cast< int >( direction ); 262 if ( index < 0 || index >= 2 ) 260 263 return QBrush(); 261 264 262 return d_data->symbolBrush[ direction];265 return d_data->symbolBrush[ index ]; 263 266 } 264 267 … … 273 276 \param extent Symbol width in scale coordinates 274 277 275 \sa symbolExtent(), scaledSymbolWidth(), 278 \sa symbolExtent(), scaledSymbolWidth(), 276 279 setMinSymbolWidth(), setMaxSymbolWidth() 277 280 */ … … 338 341 { 339 342 d_data->maxSymbolWidth = width; 340 343 341 344 legendChanged(); 342 345 itemChanged(); … … 360 363 { 361 364 QRectF rect = QwtPlotSeriesItem::boundingRect(); 362 if ( rect.isValid() &&orientation() == Qt::Vertical )365 if ( orientation() == Qt::Vertical ) 363 366 rect.setRect( rect.y(), rect.x(), rect.height(), rect.width() ); 364 367 … … 487 490 case Bar: 488 491 { 489 drawBar( painter, translatedSample, 492 drawBar( painter, translatedSample, 490 493 orient, inverted, symbolWidth ); 491 494 break; … … 494 497 { 495 498 painter->setBrush( d_data->symbolBrush[ brushIndex ] ); 496 drawCandleStick( painter, translatedSample, 499 drawCandleStick( painter, translatedSample, 497 500 orient, symbolWidth ); 498 501 break; … … 521 524 \param sample Samples already translated into paint device coordinates 522 525 \param orientation Vertical or horizontal 523 \param inverted True, when the opposite scale 526 \param inverted True, when the opposite scale 524 527 ( Qt::Vertical: x, Qt::Horizontal: y ) is increasing 525 528 in the opposite direction as QPainter coordinates. … … 555 558 */ 556 559 void QwtPlotTradingCurve::drawBar( QPainter *painter, 557 const QwtOHLCSample &sample, Qt::Orientation orientation, 560 const QwtOHLCSample &sample, Qt::Orientation orientation, 558 561 bool inverted, double width ) const 559 562 { … … 594 597 */ 595 598 void QwtPlotTradingCurve::drawCandleStick( QPainter *painter, 596 const QwtOHLCSample &sample, Qt::Orientation orientation, 599 const QwtOHLCSample &sample, Qt::Orientation orientation, 597 600 double width ) const 598 601 { … … 628 631 \return A rectangle filled with the color of the symbol pen 629 632 630 \param index Index of the legend entry 633 \param index Index of the legend entry 631 634 ( usually there is only one ) 632 635 \param size Icon size … … 671 674 ( orientation() == Qt::Vertical ) ? &xMap : &yMap; 672 675 673 const double pos = map->transform( map->s1() + d_data->symbolExtent ); 676 const double pos = map->transform( map->s1() + d_data->symbolExtent ); 674 677 675 678 double width = qAbs( pos - map->p1() );
Note:
See TracChangeset
for help on using the changeset viewer.